From: Chris W. <la...@us...> - 2005-02-08 12:32:56
|
Update of /cvsroot/openinteract/OpenInteract2/sample/package_cpan In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18594/package_cpan Added Files: module_include.t README Makefile.PL FILES Brick.pm App.pm Log Message: add files necessary to make a CPAN module from a package --- NEW FILE: module_include.t --- # -*-perl-*- use strict; use Test::More tests => [% package_modules.size + 2 %]; require_ok( '[% full_app_class %]' ); require_ok( '[% full_brick_class %]' ); [% FOREACH module = package_modules.sort -%] require_ok( '[% module %]' ); [% END -%] --- NEW FILE: README --- sample/package_cpan: The files here are used as templates for creating a new CPAN distribution from a package. NOTE: If you add a file here be sure to add an entry in FILES so we know it should be copied over to the dist when it's created. --- NEW FILE: Makefile.PL --- use ExtUtils::MakeMaker; my %opts = ( 'NAME' => '[% full_app_class %]', 'VERSION' => '[% package_version %]', 'PL_FILES' => {}, 'NO_META' => 1, 'PREREQ_PM' => { 'OpenInteract2::Action' => 1.66, # proxy for OI2 [% FOREACH module = required_modules -%] [% module %] => 0, [% END -%] }, ); if ( $ExtUtils::MakeMaker::VERSION >= 5.43 ) { $opts{AUTHOR} = '[% author_names.join( ', ' ) %]', $opts{ABSTRACT} = q{[% abstract %]}, } WriteMakefile( %opts ); --- NEW FILE: FILES --- Makefile.PL --> Makefile.PL App.pm --> lib OpenInteract2 App [% subclass %].pm Brick.pm --> lib OpenInteract2 Brick [% subclass %].pm module_include.t --> t 00_basic_include.t --- NEW FILE: Brick.pm --- package [% full_brick_class %]; use strict; use base qw( OpenInteract2::Brick ); use OpenInteract2::Exception; my %INLINED_SUBS = ( [% FOREACH file_info = package_files -%] '[% file_info.name %]' => '[% file_info.inline_name %]', [% END -%] ); sub get_name { return '[% package_name %]'; } sub get_resources { return ( [% FOREACH file_info = package_files -%] '[% file_info.name %]' => [ '[% file_info.destination %]', '[% file_info.evaluate %]' ], [% END -%] ); } sub load { my ( $self, $resource_name ) = @_; my $inline_sub_name = $INLINED_SUBS{ $resource_name }; unless ( $inline_sub_name ) { OpenInteract2::Exception->throw( "Resource name '$resource_name' not found ", "in ", ref( $self ), "; cannot load content." ); } return $self->$inline_sub_name(); } OpenInteract2::Brick->register_factory_type( get_name() => __PACKAGE__ ); =pod =head1 NAME [% full_brick_class %] - Installation data for OpenInteract2 package '[% package_name %]' =head1 SYNOPSIS oi2_manage install_package --package=[% package_name %] =head1 DESCRIPTION You generally don't use this class directly. See the docs for L<[% full_app_class %]> and L<OpenInteract2::Brick> for more. =head1 SEE ALSO L<[% full_app_class %]> =head1 COPYRIGHT Copyright (c) 2005 [% author_names.join( ', ' ) %]. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHORS [% FOREACH author_info = authors %] [% author_info.name %] E<lt>[% author_info.email %]E<gt> [% END %] =cut [% FOREACH file_info = package_files %] sub [% file_info.inline_name %] { return <<'SUPERLONGSTRING'; [% file_info.contents %] SUPERLONGSTRING } [% END %] --- NEW FILE: App.pm --- package [% full_app_class %]; use strict; use base qw( Exporter OpenInteract2::App ); use OpenInteract2::Manage; $[% full_app_class %]::VERSION = '[% package_version %]'; @[% full_app_class %]::EXPORT = qw( install ); sub get_brick_name { return '[% brick_name %]'; } # Not a method, just an exported sub sub install { my ( $website_dir ) = @_; my $manage = OpenInteract2::Manage->new( 'install_package' ); $manage->param( website_dir => $website_dir ); $manage->param( package_class => __PACKAGE__ ); return $manage->execute; } =pod [% package_pod %] =back |