Skip to content

Commit 81496d5

Browse files
committed
Add CLI option to skip packaging files for new app
Not many Dancer2 apps are made to be distributed on CPAN, so provide a way to not generate those files in the base skeleton app.
1 parent 2fe51c1 commit 81496d5

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/Dancer2/CLI/Gen.pm

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@ 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
108115
sub BUILD {
109116
my ( $self, $args ) = @_;
@@ -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;
@@ -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);

0 commit comments

Comments
 (0)