r36661 - in /branches/upstream/libcatalyst-model-cdbi-perl: ./ current/ current/lib/ current/lib/Catalyst/ current/lib/Catalyst/Helper/ current/lib/Catalyst/Helper/Model/ current/lib/Catalyst/Model/ current/t/
ryan52-guest at users.alioth.debian.org
ryan52-guest at users.alioth.debian.org
Fri May 29 15:14:30 UTC 2009
Author: ryan52-guest
Date: Fri May 29 15:14:26 2009
New Revision: 36661
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=36661
Log:
[svn-inject] Installing original source of libcatalyst-model-cdbi-perl
Added:
branches/upstream/libcatalyst-model-cdbi-perl/
branches/upstream/libcatalyst-model-cdbi-perl/current/
branches/upstream/libcatalyst-model-cdbi-perl/current/Changes
branches/upstream/libcatalyst-model-cdbi-perl/current/MANIFEST
branches/upstream/libcatalyst-model-cdbi-perl/current/META.yml
branches/upstream/libcatalyst-model-cdbi-perl/current/Makefile.PL
branches/upstream/libcatalyst-model-cdbi-perl/current/README
branches/upstream/libcatalyst-model-cdbi-perl/current/lib/
branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/
branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Helper/
branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Helper/Model/
branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Helper/Model/CDBI.pm
branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Model/
branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Model/CDBI.pm
branches/upstream/libcatalyst-model-cdbi-perl/current/t/
branches/upstream/libcatalyst-model-cdbi-perl/current/t/01use.t
branches/upstream/libcatalyst-model-cdbi-perl/current/t/02pod.t
branches/upstream/libcatalyst-model-cdbi-perl/current/t/03podcoverage.t
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/Changes?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/Changes (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/Changes Fri May 29 15:14:26 2009
@@ -1,0 +1,36 @@
+Revision history for Perl extension Catalyst::Model::CDBI.
+
+0.11
+ - Throw an exception during startup if there is an error loading
+ tables.
+
+0.10 Thu Oct 27 17:40:00 2005
+ - Pass all args to constructor ( Fix global config )
+
+0.09 Sat Apr 30 23:13:00 2005
+ - Fixed helper templates
+
+0.08 Sat Apr 30 23:13:00 2005
+ - added dependency for Class::DBI::Loader 0.20
+
+0.07 Sat Apr 23 16:46:00 2005
+ - fixed helper (Robert Boone)
+
+0.06 Fri Apr 15 15:52:00 2005
+ - Added POD tests.
+ - Some doc fixes.
+
+0.05 Mon Mar 14 22:00:00 2005
+ - fixed helper
+
+0.04 Thu Mar 10 10:00:00 2005
+ - support for test directories
+
+0.03 Fri Mar 04 20:00:00 2005
+ - new helper api
+
+0.02 Tue Mar 01 10:00:00 2005
+ - added helper
+
+0.01 Fri Jan 28 22:00:00 2005
+ - first release
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/MANIFEST?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/MANIFEST (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/MANIFEST Fri May 29 15:14:26 2009
@@ -1,0 +1,10 @@
+Changes
+lib/Catalyst/Helper/Model/CDBI.pm
+lib/Catalyst/Model/CDBI.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/01use.t
+t/02pod.t
+t/03podcoverage.t
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/META.yml?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/META.yml (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/META.yml Fri May 29 15:14:26 2009
@@ -1,0 +1,13 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Catalyst-Model-CDBI
+version: 0.11
+version_from: lib/Catalyst/Model/CDBI.pm
+installdirs: site
+requires:
+ Catalyst: 4.00
+ Class::DBI: 0
+ Class::DBI::Loader: 0.2
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/Makefile.PL?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/Makefile.PL (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/Makefile.PL Fri May 29 15:14:26 2009
@@ -1,0 +1,12 @@
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ NAME => 'Catalyst::Model::CDBI',
+ AUTHOR => 'Sebastian Riedel (sri at oook.de)',
+ PREREQ_PM => {
+ Catalyst => '4.00',
+ Class::DBI => 0,
+ Class::DBI::Loader => 0.20
+ },
+ VERSION_FROM => 'lib/Catalyst/Model/CDBI.pm'
+);
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/README?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/README (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/README Fri May 29 15:14:26 2009
@@ -1,0 +1,41 @@
+NAME
+ Catalyst::Model::CDBI - CDBI Model Class
+
+SYNOPSIS
+ # use the helper
+ create model CDBI CDBI dsn user password
+
+ # lib/MyApp/Model/CDBI.pm
+ package MyApp::Model::CDBI;
+
+ use base 'Catalyst::Model::CDBI';
+
+ __PACKAGE__->config(
+ dsn => 'dbi:Pg:dbname=myapp',
+ password => '',
+ user => 'postgres',
+ options => { AutoCommit => 1 },
+ relationships => 1
+ );
+
+ 1;
+
+ # As object method
+ $c->comp('MyApp::Model::CDBI::Table')->search(...);
+
+ # As class method
+ MyApp::Model::CDBI::Table->search(...);
+
+DESCRIPTION
+ This is the "Class::DBI", "Class::DBI::Loader" model class.
+
+SEE ALSO
+ Catalyst, Class::DBI
+
+AUTHOR
+ Sebastian Riedel, "sri at cpan.org"
+
+COPYRIGHT
+ This program is free software, you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Helper/Model/CDBI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Helper/Model/CDBI.pm?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Helper/Model/CDBI.pm (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Helper/Model/CDBI.pm Fri May 29 15:14:26 2009
@@ -1,0 +1,174 @@
+package Catalyst::Helper::Model::CDBI;
+
+use strict;
+use Class::DBI::Loader;
+use File::Spec;
+
+=head1 NAME
+
+Catalyst::Helper::Model::CDBI - Helper for CDBI Models
+
+=head1 SYNOPSIS
+
+ script/create.pl model CDBI CDBI dsn user password
+
+=head1 DESCRIPTION
+
+Helper for CDBI Model.
+
+=head2 METHODS
+
+=over 4
+
+=item mk_compclass
+
+Reads the database and makes a main model class as well as placeholders
+for each table.
+
+=item mk_comptest
+
+Makes tests for the CDBI Model.
+
+=back
+
+=cut
+
+sub mk_compclass {
+ my ( $self, $helper, $dsn, $user, $pass ) = @_;
+ $helper->{dsn} = $dsn || '';
+ $helper->{user} = $user || '';
+ $helper->{pass} = $pass || '';
+ $helper->{rel} = $dsn =~ /sqlite|pg|mysql/i ? 1 : 0;
+ my $file = $helper->{file};
+ $helper->{classes} = [];
+ $helper->render_file( 'cdbiclass', $file );
+ #push( @{ $helper->{classes} }, $helper->{class} );
+ return 1 unless $dsn;
+ my $loader = Class::DBI::Loader->new(
+ dsn => $dsn,
+ user => $user,
+ password => $pass,
+ namespace => $helper->{class}
+ );
+
+ my $path = $file;
+ $path =~ s/\.pm$//;
+ $helper->mk_dir($path);
+
+ for my $c ( $loader->classes ) {
+ $helper->{tableclass} = $c;
+ $helper->{tableclass} =~ /\W*(\w+)$/;
+ my $f = $1;
+ my $p = File::Spec->catfile( $path, "$f.pm" );
+ $helper->render_file( 'tableclass', $p );
+ push( @{ $helper->{classes} }, $c );
+ }
+ return 1;
+}
+
+sub mk_comptest {
+ my ( $self, $helper ) = @_;
+ my $test = $helper->{test};
+ my $name = $helper->{name};
+ for my $c ( @{ $helper->{classes} } ) {
+ $helper->{tableclass} = $c;
+ $helper->{tableclass} =~ /\:\:(\w+)\:\:(\w+)$/;
+ my $prefix;
+ unless ( $1 eq 'M' ) { $prefix = "$name\::$2" }
+ else { $prefix = $2 }
+ $prefix =~ s/::/-/g;
+ my $test = $helper->next_test($prefix);
+ $helper->render_file( 'test', $test );
+ }
+}
+
+=head1 SEE ALSO
+
+L<Catalyst::Manual>, L<Catalyst::Test>, L<Catalyst::Request>,
+L<Catalyst::Response>, L<Catalyst::Helper>
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at 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;
+__DATA__
+
+__cdbiclass__
+package [% class %];
+
+use strict;
+use base 'Catalyst::Model::CDBI';
+
+__PACKAGE__->config(
+ dsn => '[% dsn %]',
+ user => '[% user %]',
+ password => '[% pass %]',
+ options => {},
+ relationships => [% rel %]
+);
+
+=head1 NAME
+
+[% class %] - CDBI Model Component
+
+=head1 SYNOPSIS
+
+See L<[% app %]>
+
+=head1 DESCRIPTION
+
+CDBI Model Component.
+
+=head1 AUTHOR
+
+[% author %]
+
+=head1 LICENSE
+
+This library is free software . You can redistribute it and/or modify
+it under the same terms as perl itself.
+
+=cut
+
+1;
+__tableclass__
+package [% tableclass %];
+
+use strict;
+
+=head1 NAME
+
+[% tableclass %] - CDBI Table Class
+
+=head1 SYNOPSIS
+
+See L<[% app %]>
+
+=head1 DESCRIPTION
+
+CDBI Table Class.
+
+=head1 AUTHOR
+
+[% author %]
+
+=head1 LICENSE
+
+This library is free software . You can redistribute it and/or modify
+it under the same terms as perl itself.
+
+=cut
+
+1;
+__test__
+use Test::More tests => 2;
+use_ok( Catalyst::Test, '[% app %]' );
+use_ok('[% tableclass %]');
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Model/CDBI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Model/CDBI.pm?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Model/CDBI.pm (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/lib/Catalyst/Model/CDBI.pm Fri May 29 15:14:26 2009
@@ -1,0 +1,94 @@
+package Catalyst::Model::CDBI;
+
+use strict;
+use base qw/Catalyst::Base Class::DBI/;
+use NEXT;
+use Class::DBI::Loader;
+
+our $VERSION = '0.11';
+
+__PACKAGE__->mk_accessors('loader');
+
+=head1 NAME
+
+Catalyst::Model::CDBI - CDBI Model Class
+
+=head1 SYNOPSIS
+
+ # use the helper
+ create model CDBI CDBI dsn user password
+
+ # lib/MyApp/Model/CDBI.pm
+ package MyApp::Model::CDBI;
+
+ use base 'Catalyst::Model::CDBI';
+
+ __PACKAGE__->config(
+ dsn => 'dbi:Pg:dbname=myapp',
+ password => '',
+ user => 'postgres',
+ options => { AutoCommit => 1 },
+ relationships => 1
+ );
+
+ 1;
+
+ # As object method
+ $c->comp('MyApp::Model::CDBI::Table')->search(...);
+
+ # As class method
+ MyApp::Model::CDBI::Table->search(...);
+
+=head1 DESCRIPTION
+
+This is the C<Class::DBI> model class. It's built on top of
+C<Class::DBI::Loader>.
+
+=head2 new
+
+Initializes Class::DBI::Loader and loads classes using the class
+config. Also attempts to borg all the classes.
+
+=cut
+
+sub new {
+ my $class = shift;
+ my $self = $class->NEXT::new( @_ );
+ my $c = shift;
+ $self->{namespace} ||= ref $self;
+ $self->{additional_base_classes} ||= ();
+ push @{ $self->{additional_base_classes} }, ref $self;
+ eval { $self->loader( Class::DBI::Loader->new(%$self) ) };
+ if ($@) {
+ Catalyst::Exception->throw( message => $@ );
+ }
+ else {
+ $c->log->debug(
+ 'Loaded tables "' . join( ' ', $self->loader->tables ) . '"' )
+ if $c->debug;
+ }
+ for my $class ( $self->loader->classes ) {
+ $class->autoupdate(1);
+ $c->components->{$class} ||= bless {%$self}, $class;
+ no strict 'refs';
+ *{"$class\::new"} = sub { bless {%$self}, $class };
+ }
+ return $self;
+}
+
+=head1 SEE ALSO
+
+L<Catalyst>, L<Class::DBI> L<Class::DBI::Loader>
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at cpan.org>
+
+=head1 COPYRIGHT
+
+This program is free software, you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=cut
+
+1;
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/t/01use.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/t/01use.t?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/t/01use.t (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/t/01use.t Fri May 29 15:14:26 2009
@@ -1,0 +1,5 @@
+use strict;
+use Test::More tests => 2;
+
+BEGIN { use_ok('Catalyst::Model::CDBI') }
+BEGIN { use_ok('Catalyst::Helper::Model::CDBI') }
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/t/02pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/t/02pod.t?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/t/02pod.t (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/t/02pod.t Fri May 29 15:14:26 2009
@@ -1,0 +1,7 @@
+use Test::More;
+
+eval "use Test::Pod 1.14";
+plan skip_all => 'Test::Pod 1.14 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_files_ok();
Added: branches/upstream/libcatalyst-model-cdbi-perl/current/t/03podcoverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcatalyst-model-cdbi-perl/current/t/03podcoverage.t?rev=36661&op=file
==============================================================================
--- branches/upstream/libcatalyst-model-cdbi-perl/current/t/03podcoverage.t (added)
+++ branches/upstream/libcatalyst-model-cdbi-perl/current/t/03podcoverage.t Fri May 29 15:14:26 2009
@@ -1,0 +1,7 @@
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD};
+
+all_pod_coverage_ok();
More information about the Pkg-perl-cvs-commits
mailing list