Codebase list libcatalyst-devel-perl / c314bd4
[svn-upgrade] new version libcatalyst-devel-perl (1.31) Ansgar Burchardt 13 years ago
20 changed file(s) with 286 addition(s) and 81 deletion(s). Raw diff Collapse all Expand all
00 This file documents the revision history for Perl extension Catalyst-Devel.
1
2 1.31 2011-01-20 01:08:00
3 - Fix for copying generated files into installed apps + tests
4 to ensure it keeps working. abraxxa++
5 - Make Pod tests author only
6
7 1.30 2011-01-11 23:54:00
8 - Increased Catalyst::Plugin::ConfigLoader dependency to 0.30
9 - Include File::Copy::Recursive in inc/ when building a dist of an
10 application.
11
12 1.29 2011-01-11 23:51:00
13 - Add documentation for the --proc_title option to the generated
14 fastcgi scripts
15 - Don't bother with the BEGIN { use_ok dance for created tests
16 - the test will fail to compile (and ergo fail) using just use,
17 and that's less typing (and less copy-pasting)
18 - Split method for creating tests into multiple methods to allow
19 subclasses to override the generation of some tests.
20 - Allow the author to be defined in the call to ->new to help things
21 which want to call Catalyst::Helper programatically.
22 - Remove $VERSION = eval $VERSION handwave in generated code as:
23 - Gives a perl critic violation.
24 - If you're shipping a dev release, best practice is you should do
25 it by renaming the tarball, rather than having a _ in the VERSION.
26 - Allow catalyst.pl . to work for already created applications
27 when in the application's directory.
28 - Note that plugin order is important in the generated skeleton.
29 - Don't pollute M::I plugin detector with GetOptions symbol from
30 GetOpt::Long
31 - Fix typo in share/script/myapp_server.pl.tt (RT #58475)
132
233 1.28 2010-06-16 02:43:00
334 - Fix generated Pod tests so that the first check is if the TEST_POD
11 inc/Module/AutoInstall.pm
22 inc/Module/Install.pm
33 inc/Module/Install/AuthorRequires.pm
4 inc/Module/Install/AuthorTests.pm
45 inc/Module/Install/AutoInstall.pm
56 inc/Module/Install/Base.pm
67 inc/Module/Install/Can.pm
4748 share/t/03podcoverage.t.tt
4849 share/t/comptest.tt
4950 t/01use.t
50 t/02pod.t
51 t/03podcoverage.t
51 t/author/pod.t
52 t/author/podcoverage.t
53 t/author/version_numbers.t
5254 t/back_compat.t
5355 t/generated_app.t
5456 t/get_sharedir_file.t
6163 t/optional_http-server-restart.t
6264 t/render_file_contents.t
6365 t/render_share_dir_file.t
64 xt/version_numbers.t
1818 - inc
1919 - share
2020 - t
21 - xt
2221 requires:
2322 Catalyst: 5.80015
2423 Catalyst::Action::RenderView: 0.10
25 Catalyst::Plugin::ConfigLoader: 0.23
24 Catalyst::Plugin::ConfigLoader: 0.30
2625 Catalyst::Plugin::Static::Simple: 0.28
2726 Config::General: 2.42
2827 ExtUtils::MakeMaker: 6.11
4342 homepage: http://dev.catalyst.perl.org/
4443 license: http://dev.perl.org/licenses/
4544 repository: git://git.shadowcat.co.uk/catagits/Catalyst-Devel.git
46 version: 1.28
45 version: 1.31
11 use warnings;
22 use inc::Module::Install 0.91;
33 use Module::Install::AuthorRequires;
4 use Module::Install::AuthorTests;
45
56 name 'Catalyst-Devel';
67 all_from 'lib/Catalyst/Devel.pm';
1314 requires 'Catalyst' => '5.80015';
1415 requires 'Catalyst::Action::RenderView' => '0.10';
1516 requires 'Catalyst::Plugin::Static::Simple' => '0.28';
16 requires 'Catalyst::Plugin::ConfigLoader' => '0.23';
17 requires 'Catalyst::Plugin::ConfigLoader' => '0.30';
1718 requires 'Config::General' => '2.42'; # as of 1.07, we use .conf and not .yaml
1819 requires 'File::ChangeNotify' => '0.07';
1920 requires 'File::Copy::Recursive';
20 requires 'Module::Install' => '0.91';
2121 requires 'Path::Class' => '0.09';
2222 requires 'Template' => '2.14';
23
24 # The Catalyst applications this module distribution have a Makefile.PL using
25 # Module::Install as well as the Module::Install::Catalyst extension included in
26 # this distribution. Therefore we really *depend* on Module::Install to be
27 # installed, even though we also use it to build this distribution and include
28 # it in its inc/ directory for releases.
29 requires 'Module::Install' => '0.91';
2330
2431 author_requires 'IPC::Run3';
2532 author_requires 'Module::Info';
2835 test_requires 'Test::More' => '0.94';
2936
3037 install_share 'share';
38
39 author_tests 't/author';
3140
3241 if ( $^O eq 'MSWin32' ) {
3342 # Proc::Background needs this on Win32 but doesn't actually
0 #line 1
1 package Module::Install::AuthorTests;
2
3 use 5.005;
4 use strict;
5 use Module::Install::Base;
6 use Carp ();
7
8 #line 16
9
10 use vars qw{$VERSION $ISCORE @ISA};
11 BEGIN {
12 $VERSION = '0.002';
13 $ISCORE = 1;
14 @ISA = qw{Module::Install::Base};
15 }
16
17 #line 42
18
19 sub author_tests {
20 my ($self, @dirs) = @_;
21 _add_author_tests($self, \@dirs, 0);
22 }
23
24 #line 56
25
26 sub recursive_author_tests {
27 my ($self, @dirs) = @_;
28 _add_author_tests($self, \@dirs, 1);
29 }
30
31 sub _wanted {
32 my $href = shift;
33 sub { /\.t$/ and -f $_ and $href->{$File::Find::dir} = 1 }
34 }
35
36 sub _add_author_tests {
37 my ($self, $dirs, $recurse) = @_;
38 return unless $Module::Install::AUTHOR;
39
40 my @tests = $self->tests ? (split / /, $self->tests) : 't/*.t';
41
42 # XXX: pick a default, later -- rjbs, 2008-02-24
43 my @dirs = @$dirs ? @$dirs : Carp::confess "no dirs given to author_tests";
44 @dirs = grep { -d } @dirs;
45
46 if ($recurse) {
47 require File::Find;
48 my %test_dir;
49 File::Find::find(_wanted(\%test_dir), @dirs);
50 $self->tests( join ' ', @tests, map { "$_/*.t" } sort keys %test_dir );
51 } else {
52 $self->tests( join ' ', @tests, map { "$_/*.t" } sort @dirs );
53 }
54 }
55
56 #line 107
57
58 1;
33 use warnings;
44
55 # Change Catalyst::Helper also.
6 our $VERSION = '1.28';
6 our $VERSION = '1.31';
77 our $CATALYST_SCRIPT_GEN = 40;
88
99 $VERSION = eval $VERSION;
1212 use Catalyst::Exception;
1313 use Path::Class qw/dir file/;
1414 use File::ShareDir qw/dist_dir/;
15 use YAML::Tiny;
1516 use namespace::autoclean;
1617
1718 with 'MooseX::Emulate::Class::Accessor::Fast';
1819
1920 # Change Catalyst/Devel.pm also
20 our $VERSION = '1.28';
21 our $VERSION = '1.31';
2122
2223 my %cache;
2324
7778 # Needs to be here for PAR
7879 require Catalyst;
7980
81 if($name eq '.') {
82 if(!-e 'META.yml') {
83 system perl => 'Makefile.PL'
84 and Catalyst::Exception->throw(message => q(
85 Failed to run "perl Makefile.PL".
86 ));
87 }
88
89 $name = YAML::Tiny->read('META.yml')->[0]->{'name'};
90 $name =~ s/-/::/g;
91 $self->{dir} = '.';
92 }
93
8094 if ( $name =~ /[^\w:]/ || $name =~ /^\d/ || $name =~ /\b:\b|:{3,}/) {
8195 warn "Error: Invalid application name.\n";
8296 return 0;
8397 }
98
99
100 if(!defined $self->{'dir'}) {
101 $self->{dir} = $name;
102 $self->{dir} =~ s/\:\:/-/g;
103 }
104
84105 $self->{name } = $name;
85 $self->{dir } = $name;
86 $self->{dir } =~ s/\:\:/-/g;
87106 $self->{script } = dir( $self->{dir}, 'script' );
88107 $self->{appprefix } = Catalyst::Utils::appprefix($name);
89108 $self->{appenv } = Catalyst::Utils::class2env($name);
92111 : "#!$Config{perlpath}";
93112 $self->{scriptgen } = $Catalyst::Devel::CATALYST_SCRIPT_GEN;
94113 $self->{catalyst_version} = $Catalyst::VERSION;
95 $self->{author } = $self->{author} = $ENV{'AUTHOR'}
114 $self->{author } ||= $ENV{'AUTHOR'}
96115 || eval { @{ [ getpwuid($<) ] }[6] }
97116 || 'Catalyst developer';
98117
102121
103122 if ($gen_app) {
104123 for ( qw/ _mk_dirs _mk_config _mk_appclass _mk_rootclass _mk_readme
105 _mk_changes _mk_apptest _mk_images _mk_favicon/ ) {
124 _mk_changes _mk_apptest _mk_podtest _mk_podcoveragetest
125 _mk_images _mk_favicon/ ) {
106126
107127 $self->$_;
108128 }
404424 my $self = shift;
405425 my $t = $self->{t};
406426 $self->render_sharedir_file( file('t', '01app.t.tt'), file($t, "01app.t") );
427 }
428
429 sub _mk_podtest {
430 my $self = shift;
431 my $t = $self->{t};
407432 $self->render_sharedir_file( file('t', '02pod.t.tt'), file($t, "02pod.t") );
433 }
434
435 sub _mk_podcoveragetest {
436 my $self = shift;
437 my $t = $self->{t};
408438 $self->render_sharedir_file( file('t', '03podcoverage.t.tt'), file($t, "03podcoverage.t") );
409439 }
410440
77
88 use File::Find;
99 use FindBin;
10 use File::Copy::Recursive 'rcopy';
10 use File::Copy::Recursive;
1111 use File::Spec ();
12 use Getopt::Long qw(GetOptionsFromString :config no_ignore_case);
12 use Getopt::Long ();
1313 use Data::Dumper;
1414
1515 my $SAFETY = 0;
5757
5858 sub catalyst {
5959 my $self = shift;
60
61 if($Module::Install::AUTHOR) {
62 $self->admin->copy_package(
63 'File::Copy::Recursive',
64 $INC{"File/Copy/Recursive.pm"},
65 );
66 }
67
6068 print <<EOF;
6169 *** Module::Install::Catalyst
6270 EOF
93101 my @path = split '-', $self->name;
94102 for my $orig (@files) {
95103 my $path = File::Spec->catdir( 'blib', 'lib', @path, $orig );
96 rcopy( $orig, $path );
104 File::Copy::Recursive::rcopy( $orig, $path );
97105 }
98106 }
99107
213221
214222 sub catalyst_par_options {
215223 my ( $self, $optstring ) = @_;
216 my %o = ();
217224 eval "use PAR::Packer ()";
218225 if ($@) {
219226 warn "WARNING: catalyst_par_options ignored - you need PAR::Packer\n"
220227 }
221228 else {
222 GetOptionsFromString($optstring, \%o, PAR::Packer->options);
229 my $p = Getopt::Long::Parser->new(config => ['no_ignore_case']);
230 my %o;
231 require Text::ParseWords;
232 {
233 local @ARGV = Text::ParseWords::shellwords($optstring);
234 $p->getoptions(\%o, PAR::Packer->options);
235 }
223236 %PAROPTS = ( %PAROPTS, %o);
224237 }
225238 }
33
44 use Catalyst::Runtime 5.80;
55
6 # Set flags and add plugins for the application
6 # Set flags and add plugins for the application.
7 #
8 # Note that ORDERING IS IMPORTANT here as plugins are initialized in order,
9 # therefore you almost certainly want to keep ConfigLoader at the head of the
10 # list if you're using it.
711 #
812 # -Debug: activates the debug mode for very useful log messages
913 # ConfigLoader: will load the configuration from a Config::General file in the
2024 extends 'Catalyst';
2125
2226 our $VERSION = '0.01';
23 $VERSION = eval $VERSION;
2427
2528 # Configure the application.
2629 #
2929 or empty string to disable
3030 -e --keeperr send error messages to STDOUT, not
3131 to the webserver
32 --proc_title Set the process title (is possible)
3233
3334 =head1 DESCRIPTION
3435
3131 a restart when modified
3232 (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
3333 --restart_directory the directory to search for
34 modified files, can be set mulitple times
34 modified files, can be set multiple times
3535 (defaults to '[SCRIPT_DIR]/..')
3636 --follow_symlinks follow symlinks in search directories
3737 (defaults to false. this is a no-op on Win32)
22 use warnings;
33 use Test::More;
44
5 BEGIN { use_ok 'Catalyst::Test', '[% name %]' }
5 use Catalyst::Test '[% name %]';
66
77 ok( request('/')->is_success, 'Request should succeed' );
88
00 use strict;
11 use warnings;
2 [% IF long_type == 'Controller' %][% IF mech %]use Test::More;
2 use Test::More;
3 [% IF long_type == 'Controller' %][% IF mech %]
34
4 eval "use Test::WWW::Mechanize::Catalyst '[% name %]'";
5 if ($@) {
5 unless (eval q{use Test::WWW::Mechanize::Catalyst '[% name %]'; 1}) {
66 plan skip_all => 'Test::WWW::Mechanize::Catalyst required';
77 exit 0;
88 }
1010 ok( my $mech = Test::WWW::Mechanize::Catalyst->new, 'Created mech object' );
1111
1212 $mech->get_ok( 'http://localhost[% uri %]' );
13 [%- ELSE %]use Test::More;
13 [%- ELSE %]
1414
15 BEGIN { use_ok 'Catalyst::Test', '[% app %]' }
16 BEGIN { use_ok '[% class %]' }
15 use Catalyst::Test '[% app %]';
16 use [% class %];
1717
1818 ok( request('[% uri %]')->is_success, 'Request should succeed' );
1919 [%- END -%]
+0
-7
t/02pod.t less more
0 use Test::More;
1
2 eval "use Test::Pod 1.14";
3 plan skip_all => 'Test::Pod 1.14 required' if $@;
4 plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
5
6 all_pod_files_ok();
+0
-11
t/03podcoverage.t less more
0 use Test::More;
1
2 eval "use Test::Pod::Coverage 1.04";
3 plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
4
5 eval "use Pod::Coverage 0.20";
6 plan skip_all => 'Pod::Coverage 0.20 required' if $@;
7
8 plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
9
10 all_pod_coverage_ok( { trustme => [ qr/^(?:BUILD|DEMOLISH)$/ ] } );
0 use Test::More 0.88;
1 use Test::Pod 1.14;
2
3 all_pod_files_ok();
4
0 use strict;
1 use warnings;
2 use Test::More;
3 use Test::Pod::Coverage 1.04;
4 use Pod::Coverage 0.20;
5
6 all_pod_coverage_ok( { trustme => [ qr/^(?:BUILD|DEMOLISH)$/ ] } );
7
0 use strict;
1 use warnings;
2
3 use FindBin qw/$Bin/;
4 use File::Spec;
5 use File::Find::Rule;
6 use Module::Info;
7
8 use Test::More;
9
10 my %versions;
11 for my $pm_file ( File::Find::Rule->file->name( qr/\.pm$/ )->in(File::Spec->catdir($Bin, '..', '..', 'lib') ) ) {
12 my $mod = Module::Info->new_from_file($pm_file);
13
14 ( my $stripped_file = $pm_file ) =~ s{.*lib/}{};
15
16 $versions{$stripped_file} = $mod->version;
17 }
18
19 my $ver = delete $versions{'Catalyst/Devel.pm'};
20 ok $ver;
21 ok scalar(keys %versions);
22
23 for my $module ( sort keys %versions ) {
24 next unless $versions{$module};
25
26 is( $versions{$module}, $ver,
27 "version for $module is the same as in Catalyst/Devel.pm" );
28 }
29
30 done_testing;
31
1717 unless -d $share_dir;
1818
1919 $ENV{CATALYST_DEVEL_SHAREDIR} = $share_dir;
20 my $instdir = tempdir(CLEANUP => 1);
21
22 $ENV{PERL_MM_OPT} = "INSTALL_BASE=$instdir";
23 $ENV{INSTALL_BASE} = $instdir;
24 if ($ENV{MAKEFLAGS}) {
25 $ENV{MAKEFLAGS} =~ s/PREFIX=[^\s]+//;
26 $ENV{MAKEFLAGS} =~ s/INSTALL_BASE=[^\s]+//;
27 }
2028
2129 my $dir = tempdir(CLEANUP => 1);
2230 my $devnull = File::Spec->devnull;
7179 script/testapp_create.pl
7280 |;
7381
74 foreach my $fn (map { File::Spec->catdir(@$_) } map { [ split /\// ] } @files) {
82 foreach my $fn (map { File::Spec->catdir(@$_) } map { [ File::Spec::Unix->splitdir($_) ] } @files) {
7583 test_fn($fn);
7684 }
7785 create_ok($_, 'My' . $_) for qw/Model View Controller/;
8391
8492 run_generated_component_tests();
8593
94 my $server_script_file = File::Spec->catdir(qw/script testapp_server.pl/);
8695 my $server_script = do {
87 open(my $fh, '<', File::Spec->catdir(qw/script testapp_server.pl/)) or fail $!;
96 open(my $fh, '<', $server_script_file) or fail $!;
8897 local $/;
8998 <$fh>;
9099 };
93102 ok $server_script =~ qr/CATALYST_SCRIPT_GEN}\s+=\s+(\d+)/,
94103 'SCRIPT_GEN found in generated output';
95104 is $1, $Catalyst::Devel::CATALYST_SCRIPT_GEN, 'Script gen correct';
105
106 {
107 open(my $fh, '>', $server_script_file) or fail $!;
108 print $fh "MOO\n";
109 }
110 my $helper = Catalyst::Helper->new(
111 {
112 '.newfiles' => 0,
113 'makefile' => 0,
114 'scripts' => 1,
115 name => '.',
116 }
117 );
118 $helper->mk_app( '.' ) or fail;
119
120 my $server_script_new = do {
121 open(my $fh, '<', $server_script_file) or fail $!;
122 local $/;
123 <$fh>;
124 };
125
126 is $server_script, $server_script_new;
127
128 diag "Installed app is in $instdir";
129 command_ok( [ ($Config{make} || 'make', 'install') ] );
130
131 my $inst_app_dir = File::Spec->catdir($instdir);
132 chdir($inst_app_dir) or die "Cannot chdir to $inst_app_dir: $!";
133 lib->import(File::Spec->catdir($instdir, 'lib', 'perl5'));
134
135 my @installed_files = qw|
136 lib/perl5/TestApp.pm
137 lib/perl5/TestApp/testapp.conf
138 lib/perl5/TestApp/Controller/Root.pm
139 lib/perl5/TestApp/root/static/images/catalyst_logo.png
140 lib/perl5/TestApp/root/static/images/btn_120x50_built.png
141 lib/perl5/TestApp/root/static/images/btn_120x50_built_shadow.png
142 lib/perl5/TestApp/root/static/images/btn_120x50_powered.png
143 lib/perl5/TestApp/root/static/images/btn_120x50_powered_shadow.png
144 lib/perl5/TestApp/root/static/images/btn_88x31_built.png
145 lib/perl5/TestApp/root/static/images/btn_88x31_built_shadow.png
146 lib/perl5/TestApp/root/static/images/btn_88x31_powered.png
147 lib/perl5/TestApp/root/static/images/btn_88x31_powered_shadow.png
148 lib/perl5/TestApp/root/favicon.ico
149 bin/testapp_cgi.pl
150 bin/testapp_fastcgi.pl
151 bin/testapp_server.pl
152 bin/testapp_test.pl
153 bin/testapp_create.pl
154 |;
155
156 foreach my $fn (map { File::Spec->catdir(@$_) } map { [ File::Spec::Unix->splitdir($_) ] } @installed_files) {
157 my $ffn = File::Spec->catfile($inst_app_dir, $fn);
158 ok -r $ffn, "'$fn' installed in correct location";
159 }
96160
97161 chdir('/');
98162 done_testing;
+0
-32
xt/version_numbers.t less more
0 use strict;
1 use warnings;
2
3 use FindBin qw/$Bin/;
4 use File::Spec;
5 use File::Find::Rule;
6 use Module::Info;
7
8 use Test::More;
9
10 my %versions;
11 for my $pm_file ( File::Find::Rule->file->name( qr/\.pm$/ )->in(File::Spec->catdir($Bin, '..', 'lib') ) ) {
12 my $mod = Module::Info->new_from_file($pm_file);
13
14 ( my $stripped_file = $pm_file ) =~ s{.*lib/}{};
15
16 $versions{$stripped_file} = $mod->version;
17 }
18
19 my $ver = delete $versions{'Catalyst/Devel.pm'};
20 ok $ver;
21 ok scalar(keys %versions);
22
23 for my $module ( sort keys %versions ) {
24 next unless $versions{$module};
25
26 is( $versions{$module}, $ver,
27 "version for $module is the same as in Catalyst/Devel.pm" );
28 }
29
30 done_testing;
31