Skip to content

Commit

Permalink
-r defaults to the .psgi path and lib/ under that
Browse files Browse the repository at this point in the history
  • Loading branch information
miyagawa committed Dec 18, 2009
1 parent aa5015c commit f596838
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/plackup
Expand Up @@ -2,6 +2,7 @@
use strict;
use lib "lib";
use Cwd;
use File::Basename;
use Getopt::Long;
use Plack::Loader;
use Plack::Util;
Expand All @@ -16,6 +17,7 @@ my $env = "development";
my $help = 0;
my $backend;
my @reload;
my $reload;
my @includes;
my @modules;

Expand All @@ -40,7 +42,7 @@ GetOptions(
"e=s" => \$eval,
'I=s@' => \@includes,
'M=s@' => \@modules,
'r|reload' => sub { push @reload, 'lib', glob("*.psgi"); },
'r|reload' => sub { $reload = 1 },
'R|Reload=s' => sub { push @reload, split ",", $_[1] },
"h|help", => \$help,
);
Expand Down Expand Up @@ -87,9 +89,10 @@ if ($env eq 'development') {

my($loader, $app);

if (@reload) {
my %seen;
@reload = grep !$seen{$_}++, @reload;
if ($reload or @reload) {
if ($reload) {
push @reload, $eval ? "lib" : ( File::Basename::dirname($psgi) . "/lib", $psgi );
}
warn "plackup: Watching ", join(", ", @reload), " for changes\n";
require Plack::Loader::Reloadable;
$loader = Plack::Loader::Reloadable->new(\@reload);
Expand Down

0 comments on commit f596838

Please sign in to comment.