@@ -74,8 +74,8 @@ option skel => (
7474 format_doc => ' directory' ,
7575 required => 0,
7676 default => sub{
77- my $self = shift ;
78- path( $self -> parent_command-> _dist_dir, ' skel' );
77+ my $self = shift ;
78+ path( $self -> parent_command-> _dist_dir, ' skel' );
7979 },
8080);
8181
@@ -95,7 +95,7 @@ option git => (
9595 default => 0,
9696);
9797
98- option remote => (
98+ option remote => (
9999 is => ' ro' ,
100100 short => ' r' ,
101101 doc => ' URI for git repository (implies -g)' ,
@@ -104,12 +104,19 @@ option remote => (
104104 required => 0,
105105);
106106
107+ option no_package_files => (
108+ is => ' ro' ,
109+ doc => " don't create files needed for CPAN packaging" ,
110+ required => 0,
111+ default => 0,
112+ );
113+
107114# Last chance to validate args before we attempt to do something with them
108115sub BUILD {
109116 my ( $self , $args ) = @_ ;
110117
111- $self -> osprey_usage( 1, qq{
112- Invalid application name. Application names must not contain single colons,
118+ $self -> osprey_usage( 1, qq{
119+ Invalid application name. Application names must not contain single colons,
113120dots, hyphens or start with a number.
114121 } ) unless is_module_name( $self -> application );
115122
@@ -165,8 +172,10 @@ sub run {
165172 };
166173
167174 $self -> _copy_templates( $files_to_copy , $vars , $self -> overwrite );
168- $self -> _create_manifest( $files_to_copy , $app_path );
169- $self -> _add_to_manifest_skip( $app_path );
175+ unless ( $self -> no_package_files ) {
176+ $self -> _create_manifest( $files_to_copy , $app_path );
177+ $self -> _add_to_manifest_skip( $app_path );
178+ }
170179
171180 $self -> _check_git( $vars );
172181 $self -> _check_yaml;
@@ -183,7 +192,7 @@ sub _check_git {
183192
184193WARNING: Couldn't initialize a git repo despite being asked to do so.
185194
186- To resolve this, cd to your application directory and run the following
195+ To resolve this, cd to your application directory and run the following
187196commands:
188197
189198 git init
@@ -200,13 +209,13 @@ commands:
200209 path( $gitignore )-> copy( $app_path );
201210
202211 chdir File::Spec-> rel2abs( $app_path ) or die " Can't cd to $app_path : $! " ;
203- if ( _run_shell_cmd( ' git' , ' init' ) != 0 or
204- _run_shell_cmd( ' git' , ' add' , ' .' ) != 0 or
212+ if ( _run_shell_cmd( ' git' , ' init' ) != 0 or
213+ _run_shell_cmd( ' git' , ' add' , ' .' ) != 0 or
205214 _run_shell_cmd( ' git' , ' commit' , " -m 'Initial commit of $app_name by Dancer2'" ) != 0 ) {
206215 print $git_error ;
207216 }
208217 else {
209- if ( $self -> remote &&
218+ if ( $self -> remote &&
210219 _run_shell_cmd( ' git' , ' remote' , ' add' , ' origin' , $self -> remote ) != 0 ) {
211220 print $git_error ;
212221 print " git remote add origin " . $self -> remote . " \n " ;
@@ -290,7 +299,7 @@ sub _build_file_list {
290299 warn " File not found: $file " unless $file -> exists ; # Paranoia
291300 next if $file -> basename =~ m { ^\. git(/|$) } ;
292301 next if $file -> is_dir;
293-
302+
294303 my $filename = $file -> relative( $from );
295304 push @result , [ $file , path( $to , $filename )];
296305 }
@@ -302,6 +311,9 @@ sub _copy_templates {
302311
303312 foreach my $pair (@$files ) {
304313 my ( $from , $to ) = @{$pair };
314+ next if $self -> no_package_files && $from =~ / MANIFEST\. SKIP$ / ;
315+ next if $self -> no_package_files && $from =~ / Makefile.PL$ / ;
316+
305317 if ( -f $to && !$overwrite ) {
306318 print " ! $to exists, overwrite? (or rerun this command with -o) [N/y/a]: " ;
307319 my $res = <STDIN >; chomp ($res );
@@ -315,7 +327,7 @@ sub _copy_templates {
315327 $to_dir -> mkpath;
316328 }
317329
318- # Skeleton files whose names are prefixed with + need to be executable, but we must strip
330+ # Skeleton files whose names are prefixed with + need to be executable, but we must strip
319331 # that from the name when copying them
320332 my $to_file = path( $to )-> basename;
321333 my $ex = ( $to_file =~ s / ^\+ // );
@@ -378,7 +390,7 @@ sub _process_template {
378390 return $engine -> render( \$template , $tokens );
379391}
380392
381- # These are good candidates to move to Dancer2::CLI if other commands
393+ # These are good candidates to move to Dancer2::CLI if other commands
382394# need them later.
383395sub _get_app_path {
384396 my ( $self , $path , $appname ) = @_ ;
@@ -431,8 +443,8 @@ sub _run_shell_cmd {
431443
432444 my $exit_status = try {
433445 my $pid = IPC::Open3::open3(
434- my $stdin ,
435- my $stdout ,
446+ my $stdin ,
447+ my $stdout ,
436448 my $stderr = Symbol::gensym,
437449 @cmds ,
438450 );
0 commit comments