Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improved portability of scripts
  • Loading branch information
kraih committed Feb 18, 2012
1 parent 18ffb67 commit 7016647
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 18 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,6 +1,7 @@
This file documents the revision history for Perl extension Mojolicious.

2.51 2012-02-18 00:00:00
- Improved portability of scripts.
- Improved documentation.

2.50 2012-02-18 00:00:00
Expand Down
8 changes: 6 additions & 2 deletions lib/Mojolicious/Command/generate/app.pm
Expand Up @@ -54,9 +54,13 @@ __DATA__
use Mojo::Base -strict;
use File::Basename 'dirname';
use File::Spec::Functions 'splitdir';
use File::Spec::Functions qw/catfile splitdir/;
push @INC, join('/', splitdir(dirname(__FILE__)), '..', 'lib');
# Source directory has precedence
my @base = splitdir(dirname(__FILE__));
-e catfile(@base, '..', 'Makefile.PL')
? unshift(@INC, join('/', @base, '..', 'lib'))
: push(@INC, join('/', @base, '..', 'lib'));
# Check if Mojolicious is installed;
die <<EOF unless eval 'use Mojolicious::Commands; 1';
Expand Down
8 changes: 6 additions & 2 deletions lib/Mojolicious/Guides/Growing.pod
Expand Up @@ -655,9 +655,13 @@ environments.
use warnings;

use File::Basename 'dirname';
use File::Spec::Functions 'splitdir';
use File::Spec::Functions qw/catfile splitdir/;

push @INC, join('/', splitdir(dirname(__FILE__)), '..', 'lib');
# Source directory has precedence
my @base = splitdir(dirname(__FILE__));
-e catfile(@base, '..', 'Makefile.PL')
? unshift(@INC, join('/', @base, '..', 'lib'))
: push(@INC, join('/', @base, '..', 'lib'));

# Check if Mojolicious is installed
die <<EOF unless eval 'use Mojolicious::Commands; 1';
Expand Down
10 changes: 6 additions & 4 deletions script/hypnotoad
Expand Up @@ -4,12 +4,14 @@ use strict;
use warnings;

use File::Basename 'dirname';
use File::Spec::Functions 'splitdir';
use File::Spec::Functions qw/catfile splitdir/;
use Getopt::Long qw/GetOptions :config no_auto_abbrev no_ignore_case/;

push @INC, join('/', splitdir(dirname(__FILE__)), '..', 'lib');
unshift @INC, join('/', splitdir(dirname(__FILE__)), '..', 'lib')
if $ENV{TEST_HYPNOTOAD};
# Source directory has precedence
my @base = splitdir(dirname(__FILE__));
-e catfile(@base, '..', 'Makefile.PL')
? unshift(@INC, join('/', @base, '..', 'lib'))
: push(@INC, join('/', @base, '..', 'lib'));

# Check if Mojolicious is installed
die <<EOF unless eval 'use Mojo::Server::Hypnotoad; 1';
Expand Down
8 changes: 6 additions & 2 deletions script/mojo
Expand Up @@ -4,9 +4,13 @@ use strict;
use warnings;

use File::Basename 'dirname';
use File::Spec::Functions 'splitdir';
use File::Spec::Functions qw/catfile splitdir/;

push @INC, join('/', splitdir(dirname(__FILE__)), '..', 'lib');
# Source directory has precedence
my @base = splitdir(dirname(__FILE__));
-e catfile(@base, '..', 'Makefile.PL')
? unshift(@INC, join('/', @base, '..', 'lib'))
: push(@INC, join('/', @base, '..', 'lib'));

# Check if Mojolicious is installed
die <<EOF unless eval 'use Mojolicious::Commands; 1';
Expand Down
10 changes: 6 additions & 4 deletions script/morbo
Expand Up @@ -4,12 +4,14 @@ use strict;
use warnings;

use File::Basename 'dirname';
use File::Spec::Functions 'splitdir';
use File::Spec::Functions qw/catfile splitdir/;
use Getopt::Long qw/GetOptions :config no_auto_abbrev no_ignore_case/;

push @INC, join('/', splitdir(dirname(__FILE__)), '..', 'lib');
unshift @INC, join('/', splitdir(dirname(__FILE__)), '..', 'lib')
if $ENV{TEST_MORBO};
# Source directory has precedence
my @base = splitdir(dirname(__FILE__));
-e catfile(@base, '..', 'Makefile.PL')
? unshift(@INC, join('/', @base, '..', 'lib'))
: push(@INC, join('/', @base, '..', 'lib'));

# Check if Mojolicious is installed
die <<EOF unless eval 'use Mojo::Server::Morbo; 1';
Expand Down
12 changes: 8 additions & 4 deletions t/mojolicious/external/script/my_app
Expand Up @@ -3,16 +3,20 @@
use strict;
use warnings;

use File::Basename 'dirname';
use File::Spec::Functions 'splitdir';

# "Behold, a time traveling machine.
# Time? I can't go back there!
# Ah, but this machine only goes forward in time.
# That way you can't accidentally change history or do something disgusting
# like sleep with your own grandmother.
# I wouldn't want to do that again."
push @INC, join('/', splitdir(dirname(__FILE__)), '..', 'lib');
use File::Basename 'dirname';
use File::Spec::Functions qw/catfile splitdir/;

# Source directory has precedence
my @base = splitdir(dirname(__FILE__));
-e catfile(@base, '..', 'Makefile.PL')
? unshift(@INC, join('/', @base, '..', 'lib'))
: push(@INC, join('/', @base, '..', 'lib'));

# Check if Mojolicious is installed
die <<EOF unless eval 'use Mojolicious::Commands; 1';
Expand Down

0 comments on commit 7016647

Please sign in to comment.