@@ -74,8 +74,8 @@ option skel => (
74
74
format_doc => ' directory' ,
75
75
required => 0,
76
76
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' );
79
79
},
80
80
);
81
81
@@ -95,7 +95,7 @@ option git => (
95
95
default => 0,
96
96
);
97
97
98
- option remote => (
98
+ option remote => (
99
99
is => ' ro' ,
100
100
short => ' r' ,
101
101
doc => ' URI for git repository (implies -g)' ,
@@ -104,12 +104,19 @@ option remote => (
104
104
required => 0,
105
105
);
106
106
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
+
107
114
# Last chance to validate args before we attempt to do something with them
108
115
sub BUILD {
109
116
my ( $self , $args ) = @_ ;
110
117
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,
113
120
dots, hyphens or start with a number.
114
121
} ) unless is_module_name( $self -> application );
115
122
@@ -165,8 +172,10 @@ sub run {
165
172
};
166
173
167
174
$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
+ }
170
179
171
180
$self -> _check_git( $vars );
172
181
$self -> _check_yaml;
@@ -183,7 +192,7 @@ sub _check_git {
183
192
184
193
WARNING: Couldn't initialize a git repo despite being asked to do so.
185
194
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
187
196
commands:
188
197
189
198
git init
@@ -200,13 +209,13 @@ commands:
200
209
path( $gitignore )-> copy( $app_path );
201
210
202
211
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
205
214
_run_shell_cmd( ' git' , ' commit' , " -m 'Initial commit of $app_name by Dancer2'" ) != 0 ) {
206
215
print $git_error ;
207
216
}
208
217
else {
209
- if ( $self -> remote &&
218
+ if ( $self -> remote &&
210
219
_run_shell_cmd( ' git' , ' remote' , ' add' , ' origin' , $self -> remote ) != 0 ) {
211
220
print $git_error ;
212
221
print " git remote add origin " . $self -> remote . " \n " ;
@@ -290,7 +299,7 @@ sub _build_file_list {
290
299
warn " File not found: $file " unless $file -> exists ; # Paranoia
291
300
next if $file -> basename =~ m { ^\. git(/|$) } ;
292
301
next if $file -> is_dir;
293
-
302
+
294
303
my $filename = $file -> relative( $from );
295
304
push @result , [ $file , path( $to , $filename )];
296
305
}
@@ -302,6 +311,9 @@ sub _copy_templates {
302
311
303
312
foreach my $pair (@$files ) {
304
313
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
+
305
317
if ( -f $to && !$overwrite ) {
306
318
print " ! $to exists, overwrite? (or rerun this command with -o) [N/y/a]: " ;
307
319
my $res = <STDIN >; chomp ($res );
@@ -315,7 +327,7 @@ sub _copy_templates {
315
327
$to_dir -> mkpath;
316
328
}
317
329
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
319
331
# that from the name when copying them
320
332
my $to_file = path( $to )-> basename;
321
333
my $ex = ( $to_file =~ s / ^\+ // );
@@ -378,7 +390,7 @@ sub _process_template {
378
390
return $engine -> render( \$template , $tokens );
379
391
}
380
392
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
382
394
# need them later.
383
395
sub _get_app_path {
384
396
my ( $self , $path , $appname ) = @_ ;
@@ -431,8 +443,8 @@ sub _run_shell_cmd {
431
443
432
444
my $exit_status = try {
433
445
my $pid = IPC::Open3::open3(
434
- my $stdin ,
435
- my $stdout ,
446
+ my $stdin ,
447
+ my $stdout ,
436
448
my $stderr = Symbol::gensym,
437
449
@cmds ,
438
450
);
0 commit comments