--- /dev/null
+use strict;
+use Module::Build;
+
+my $build = Module::Build->new(
+ create_makefile_pl => 'passthrough',
+ license => 'perl',
+ module_name => 'Catalyst',
+ requires => {
+ 'UNIVERSAL::require' => 0,
+ 'CGI::Simple' => 0,
+ 'Class::Accessor::Fast' => 0,
+ 'Class::Data::Inheritable' => 0,
+ 'HTTP::Daemon' => 0,
+ 'HTML::Entities' => 0,
+ 'HTTP::Headers' => 0,
+ 'HTTP::Request' => 0,
+ 'HTTP::Response' => 0,
+ 'LWP::UserAgent' => 0,
+ 'Module::Pluggable::Fast' => 0,
+ 'Path::Class' => 0,
+ 'Template' => 0,
+ 'Text::ASCIITable' => 0,
+ 'Tree::Simple' => 0,
+ 'Tree::Simple::Visitor::FindByPath' => 0,
+ 'URI' => 0,
+ },
+ script_files => [ glob('script/*') ],
+ test_files => [
+ glob('t/*.t'), glob('t/*/*.t'), glob('t/*/*/*.t'), glob('t/*/*/*/*.t')
+ ]
+);
+$build->create_build_script;
+
+print( '*' x 80, "\n" );
+print(
+ (qw/chansen draven fordmason naughton sri the_jester/)[ int( rand(6) ) ],
+ " is the greatest and gabb is ",
+ ( (localtime)[2] > 12 ? "drunk" : "hung over" ),
+ " again!\n"
+);
+print( '*' x 80, "\n" );
+
+eval "use mod_perl; use Apache::Request";
+print qq/Install "mod_perl" and "Apache::Request" for Apache support.\n/ if $@;
+
+eval "use FCGI";
+print qq/Install "FCGI" for FastCGI support.\n/ if $@;
This file documents the revision history for Perl extension Catalyst.
+5.10 Wed Apr 20 18:00:00 2005
+ - New installer for templates and stuff using Module::Build
+ - scripts are now prefixed, for being installable
+ IMPORTANT: You have to regenerate the script directory,
+ remove Makefile.PL and add Build.PL
+
5.03 Tue Apr 19 20:35:00 2005 (Revision 462)
- Fixed Test example (Torsten Seeman)
- Added Plugins chapter to manual
Changes
lib/Catalyst.pm
lib/Catalyst/Base.pm
+lib/Catalyst/Build.pm
lib/Catalyst/Dispatcher.pm
lib/Catalyst/Engine.pm
lib/Catalyst/Engine/Apache.pm
HTTP::Response => 0,
LWP::UserAgent => 0,
Module::Pluggable::Fast => 0,
+ Path::Class => 0,
Template => 0,
Text::ASCIITable => 0,
Tree::Simple => 0,
use UNIVERSAL::require;
use Catalyst::Log;
use Text::ASCIITable;
-our $CATALYST_SCRIPT_GEN = 2;
+use Path::Class;
+our $CATALYST_SCRIPT_GEN = 3;
__PACKAGE__->mk_classdata($_) for qw/dispatcher engine log/;
-our $VERSION = '5.03';
+our $VERSION = '5.10';
our @ISA;
=head1 NAME
}
$caller->engine($engine);
$caller->log->debug(qq/Loaded engine "$engine"/) if $caller->debug;
+
+ # Find home
+ my $name = $caller;
+ $name =~ s/\:\:/\//g;
+ my $path = $INC{"$name.pm"};
+ my $home = file($path)->absolute->dir;
+ $name =~ /(\w+)$/;
+ my $append = $1;
+ my $subdir = dir($home)->subdir($append);
+ for ( split '/', $name ) { $home = dir($home)->parent }
+ if ( $home =~ /blib$/ ) { $home = dir($home)->parent }
+ elsif ( !-f file( $home, 'Build.PL' ) ) { $home = $subdir }
+
+ if ( $caller->debug ) {
+ $home
+ ? ( -d $home )
+ ? $caller->log->debug(qq/Found home "$home"/)
+ : $caller->log->debug(qq/Home "$home" doesn't exist/)
+ : $caller->log->debug(q/Couldn't find home/);
+ }
+ $caller->config->{home} = $home;
+ $caller->config->{root} = dir($home)->subdir('root');
}
=item $c->engine
Andy Grundman, Andrew Ford, Andrew Ruthven, Autrijus Tang, Christian Hansen,
Christopher Hicks, Dan Sully, Danijel Milicevic, David Naughton,
-Gary Ashton Jones, Jesse Sheidlower, Johan Lindstrom, Marcus Ramberg,
-Tatsuhiko Miyagawa and all the others who've helped.
+Gary Ashton Jones, Jesse Sheidlower, Johan Lindstrom, Leon Brocard,
+Marcus Ramberg, Tatsuhiko Miyagawa and all the others who've helped.
=head1 LICENSE
use NEXT;
__PACKAGE__->mk_classdata($_) for qw/_attrcache _cache _config/;
-__PACKAGE__->_cache( [] );
__PACKAGE__->_attrcache( {} );
+__PACKAGE__->_cache( [] );
# note - see attributes(3pm)
sub MODIFY_CODE_ATTRIBUTES {
--- /dev/null
+package Catalyst::Build;
+
+use strict;
+use Module::Build;
+use base 'Module::Build';
+use Path::Class;
+use File::Find 'find';
+
+our $FAKE;
+our $ignore = '^('
+ . join( '|',
+ qw/Build Build.PL Changes Makefile.PL README _build blib lib script t/ )
+ . ')$';
+
+=head1 NAME
+
+Catalyst::Build - Module::Build extension for Catalyst
+
+=head1 SYNOPSIS
+
+See L<Catalyst>
+
+=head1 DESCRIPTION
+
+L<Module::Build> extension for Catalyst.
+
+=head1 METHODS
+
+=item ACTION_install
+
+=cut
+
+sub ACTION_install {
+ my $self = shift;
+ $self->SUPER::ACTION_install;
+ $self->ACTION_install_extras;
+}
+
+=item ACTION_fakeinstall
+
+=cut
+
+sub ACTION_fakeinstall {
+ my $self = shift;
+ $self->SUPER::ACTION_fakeinstall;
+ local $FAKE = 1;
+ $self->ACTION_install_extras;
+}
+
+=item ACTION_install_extras
+
+=cut
+
+sub ACTION_install_extras {
+ my $self = shift;
+ my $prefix = $self->{properties}{destdir} || '';
+ my $path = dir(
+ $prefix,
+ $self->{config}{installsitelib},
+ split( '::', $self->{properties}{module_name} )
+ );
+ my @files = $self->_find_extras;
+ print "Installing extras to $path\n";
+ for (@files) {
+ $FAKE
+ ? print "$_ -> $path/$_ (FAKE)\n"
+ : $self->copy_if_modified( $_, $path );
+ }
+}
+
+sub _find_extras {
+ my $self = shift;
+ my @all = glob '*';
+ my @files;
+ for my $file (@all) {
+ next if $file =~ /$ignore/;
+ if ( -d $file ) {
+ find(
+ sub {
+ return if -d;
+ push @files, $File::Find::name;
+ },
+ $file
+ );
+ }
+ else { push @files, $file }
+ }
+ return @files;
+}
+
+=back
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri@oook.de>
+
+=head1 LICENSE
+
+This library is free software . You can redistribute it and/or modify it under
+the same terms as perl itself.
+
+=cut
+
+1;
$self->{name} = $name;
$self->{dir} = $name;
$self->{dir} =~ s/\:\:/-/g;
+ $self->{appprefix} = lc $self->{dir};
+ $self->{appprefix} =~ s/-/_/g;
$self->{startperl} = $Config{startperl};
- $self->{scriptgen}=$Catalyst::CATALYST_SCRIPT_GEN;
- $self->{author}=$self->{author} = $ENV{'AUTHOR'} ||
- @{[getpwuid($<)]}[6];
+ $self->{scriptgen} = $Catalyst::CATALYST_SCRIPT_GEN;
+ $self->{author} = $self->{author} = $ENV{'AUTHOR'}
+ || @{ [ getpwuid($<) ] }[6];
$self->_mk_dirs;
$self->_mk_appclass;
+ $self->_mk_build;
$self->_mk_makefile;
$self->_mk_readme;
$self->_mk_changes;
my $self = shift;
my $app = shift;
$self->{app} = $app;
- $self->{author}=$self->{author} = $ENV{'AUTHOR'} ||
- @{[getpwuid($<)]}[6];
+ $self->{author} = $self->{author} = $ENV{'AUTHOR'}
+ || @{ [ getpwuid($<) ] }[6];
$self->{base} = File::Spec->catdir( $FindBin::Bin, '..' );
unless ( $_[0] =~ /^model|m|view|v|controller|c\$/i ) {
my $helper = shift;
$self->render_file( 'appclass', "$mod.pm" );
}
+sub _mk_build {
+ my $self = shift;
+ my $dir = $self->{dir};
+ $self->render_file( 'build', "$dir\/Build.PL" );
+}
+
sub _mk_makefile {
my $self = shift;
my $dir = $self->{dir};
sub _mk_cgi {
my $self = shift;
my $script = $self->{script};
- $self->render_file( 'cgi', "$script\/cgi.pl" );
- chmod 0700, "$script/cgi.pl";
+ my $appprefix = $self->{appprefix};
+ $self->render_file( 'cgi', "$script\/$appprefix\_cgi.pl" );
+ chmod 0700, "$script/$appprefix\_cgi.pl";
}
sub _mk_fcgi {
my $self = shift;
my $script = $self->{script};
- $self->render_file( 'fcgi', "$script\/fcgi.pl" );
- chmod 0700, "$script/fcgi.pl";
+ my $appprefix = $self->{appprefix};
+ $self->render_file( 'fcgi', "$script\/$appprefix\_fcgi.pl" );
+ chmod 0700, "$script/$appprefix\_fcgi.pl";
}
sub _mk_server {
my $self = shift;
my $script = $self->{script};
- $self->render_file( 'server', "$script\/server.pl" );
- chmod 0700, "$script/server.pl";
+ my $appprefix = $self->{appprefix};
+ $self->render_file( 'server', "$script\/$appprefix\_server.pl" );
+ chmod 0700, "$script/$appprefix\_server.pl";
}
sub _mk_test {
my $self = shift;
my $script = $self->{script};
- $self->render_file( 'test', "$script/test.pl" );
- chmod 0700, "$script/test.pl";
+ my $appprefix = $self->{appprefix};
+ $self->render_file( 'test', "$script/$appprefix\_test.pl" );
+ chmod 0700, "$script/$appprefix\_test.pl";
}
sub _mk_create {
my $self = shift;
my $script = $self->{script};
- $self->render_file( 'create', "$script\/create.pl" );
- chmod 0700, "$script/create.pl";
+ my $appprefix = $self->{appprefix};
+ $self->render_file( 'create', "$script\/$appprefix\_create.pl" );
+ chmod 0700, "$script/$appprefix\_create.pl";
}
sub _mk_compclass {
1;
-__makefile__
-use ExtUtils::MakeMaker;
-
-WriteMakefile(
- NAME => '[% name %]',
- VERSION_FROM => 'lib/[% class %].pm',
- PREREQ_PM => { Catalyst => 5 },
- test => { TESTS => join ' ', ( glob('t/*.t'), glob('t/*/*.t') ) }
+__build__
+use strict;
+use Catalyst::Build;
+
+my $build = Catalyst::Build->new(
+ create_makefile_pl => 'passthrough',
+ license => 'perl',
+ module_name => '[% name %]',
+ requires => { Catalyst => '5.04' },
+ script_files => [ glob('script/*') ],
+ test_files => [ glob('t/*.t'), glob('t/*/*.t') ]
);
+$build->create_build_script;
__readme__
-Run script/server.pl to test the application.
+Run script/[% apprefix %]_server.pl to test the application.
__changes__
This file documents the revision history for Perl extension [% name %].