Skip to content
Browse files

-r defaults to the .psgi path and lib/ under that

  • Loading branch information...
1 parent aa5015c commit f59683817e44cf56f6fda790ea42fa42b2a88f60 @miyagawa miyagawa committed
Showing with 7 additions and 4 deletions.
  1. +7 −4 scripts/plackup
View
11 scripts/plackup
@@ -2,6 +2,7 @@
use strict;
use lib "lib";
use Cwd;
+use File::Basename;
use Getopt::Long;
use Plack::Loader;
use Plack::Util;
@@ -16,6 +17,7 @@ my $env = "development";
my $help = 0;
my $backend;
my @reload;
+my $reload;
my @includes;
my @modules;
@@ -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,
);
@@ -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);

0 comments on commit f596838

Please sign in to comment.
Something went wrong with that request. Please try again.