This file documents the revision history for Perl extension Catalyst-Devel.
+ - Allow catalyst.pl . to work for already created applications
+ when in the application's directory.
- Note that plugin order is important in the generated skeleton.
- Don't pollute M::I plugin detector with GetOptions symbol from
GetOpt::Long
use Catalyst::Exception;
use Path::Class qw/dir file/;
use File::ShareDir qw/dist_dir/;
+use YAML::Tiny;
use namespace::autoclean;
with 'MooseX::Emulate::Class::Accessor::Fast';
# Needs to be here for PAR
require Catalyst;
+ if($name eq '.') {
+ if(!-e 'META.yml') {
+ system perl => 'Makefile.PL'
+ and Catalyst::Exception->throw(message => q(
+ Failed to run "perl Makefile.PL".
+ ));
+ }
+
+ $name = YAML::Tiny->read('META.yml')->[0]->{'name'};
+ $name =~ s/-/::/g;
+ $self->{dir} = '.';
+ }
+
if ( $name =~ /[^\w:]/ || $name =~ /^\d/ || $name =~ /\b:\b|:{3,}/) {
warn "Error: Invalid application name.\n";
return 0;
}
+
+
+ if(!defined $self->{'dir'}) {
+ $self->{dir} = $name;
+ $self->{dir} =~ s/\:\:/-/g;
+ }
+
$self->{name } = $name;
- $self->{dir } = $name;
- $self->{dir } =~ s/\:\:/-/g;
$self->{script } = dir( $self->{dir}, 'script' );
$self->{appprefix } = Catalyst::Utils::appprefix($name);
$self->{appenv } = Catalyst::Utils::class2env($name);
run_generated_component_tests();
+my $server_script_file = File::Spec->catdir(qw/script testapp_server.pl/);
my $server_script = do {
- open(my $fh, '<', File::Spec->catdir(qw/script testapp_server.pl/)) or fail $!;
+ open(my $fh, '<', $server_script_file) or fail $!;
local $/;
<$fh>;
};
'SCRIPT_GEN found in generated output';
is $1, $Catalyst::Devel::CATALYST_SCRIPT_GEN, 'Script gen correct';
+{
+ open(my $fh, '>', $server_script_file) or fail $!;
+ print $fh "MOO\n";
+}
+my $helper = Catalyst::Helper->new(
+ {
+ '.newfiles' => 0,
+ 'makefile' => 0,
+ 'scripts' => 1,
+ name => '.',
+ }
+);
+$helper->mk_app( '.' ) or fail;
+
+my $server_script_new = do {
+ open(my $fh, '<', $server_script_file) or fail $!;
+ local $/;
+ <$fh>;
+};
+
+is $server_script, $server_script_new;
+
chdir('/');
done_testing;