From: Christopher H. Laco Date: Thu, 6 Jul 2006 22:36:11 +0000 (+0000) Subject: Renabled pod coverage test and added missing pod X-Git-Tag: v0.01001~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=aaeaf963adf6f25d0b94f91141b93b4260f5bd47;p=dbsrgits%2FDBIx-Class-UUIDColumns.git Renabled pod coverage test and added missing pod Added test skipage if SQL::Translator is not installed Added SQL::Translator to build_requires Cleanup t/var during distclean --- diff --git a/Build.PL b/Build.PL index 07ff45f..c17d80e 100644 --- a/Build.PL +++ b/Build.PL @@ -10,6 +10,7 @@ my %arguments = ( }, build_requires => { 'DBD::SQLite' => 1.11, + 'SQL::Translator' => 0.07 }, recommends => { 'Data::UUID' => 0, @@ -20,7 +21,8 @@ my %arguments = ( }, create_makefile_pl => 'passthrough', create_readme => 1, - test_files => [ glob('t/*.t')] + test_files => [ glob('t/*.t')], + add_to_cleanup => ['t/var/*'] ); Module::Build->new(%arguments)->create_build_script; diff --git a/MANIFEST b/MANIFEST new file mode 100644 index 0000000..5327ee5 --- /dev/null +++ b/MANIFEST @@ -0,0 +1,24 @@ +Build.PL +Changes +lib/DBIx/Class/UUIDColumns.pm +lib/DBIx/Class/UUIDColumns/UUIDMaker.pm +lib/DBIx/Class/UUIDColumns/UUIDMaker/APR/UUID.pm +lib/DBIx/Class/UUIDColumns/UUIDMaker/Data/Uniqid.pm +lib/DBIx/Class/UUIDColumns/UUIDMaker/Data/UUID.pm +lib/DBIx/Class/UUIDColumns/UUIDMaker/UUID.pm +lib/DBIx/Class/UUIDColumns/UUIDMaker/Win32/Guidgen.pm +lib/DBIx/Class/UUIDColumns/UUIDMaker/Win32API/GUID.pm +Makefile.PL +MANIFEST This list of files +MANIFEST.SKIP +META.yml +README +t/02pod.t +t/03podcoverage.t +t/04basic.t +t/05uuid.t +t/lib/CustomUUIDMaker.pm +t/lib/UUIDTest.pm +t/lib/UUIDTest/Schema.pm +t/lib/UUIDTest/Schema/Test.pm +t/lib/UUIDTest/Setup.pm diff --git a/META.yml b/META.yml new file mode 100644 index 0000000..2cf4cbc --- /dev/null +++ b/META.yml @@ -0,0 +1,36 @@ +--- +name: DBIx-Class-UUIDColumns +version: 0.01000 +author: ~ +abstract: Implicit uuid columns +license: perl +requires: + DBIx::Class: 0.06002 +recommends: + APR::UUID: 0 + Data::UUID: 0 + UUID: 0 + Win32::Guidgen: 0 + Win32API::GUID: 0 +build_requires: + DBD::SQLite: 1.11 + SQL::Translator: 0.07 +provides: + DBIx::Class::UUIDColumns: + file: lib/DBIx/Class/UUIDColumns.pm + version: 0.01000 + DBIx::Class::UUIDColumns::UUIDMaker: + file: lib/DBIx/Class/UUIDColumns/UUIDMaker.pm + DBIx::Class::UUIDColumns::UUIDMaker::APR::UUID: + file: lib/DBIx/Class/UUIDColumns/UUIDMaker/APR/UUID.pm + DBIx::Class::UUIDColumns::UUIDMaker::Data::UUID: + file: lib/DBIx/Class/UUIDColumns/UUIDMaker/Data/UUID.pm + DBIx::Class::UUIDColumns::UUIDMaker::Data::Uniqid: + file: lib/DBIx/Class/UUIDColumns/UUIDMaker/Data/Uniqid.pm + DBIx::Class::UUIDColumns::UUIDMaker::UUID: + file: lib/DBIx/Class/UUIDColumns/UUIDMaker/UUID.pm + DBIx::Class::UUIDColumns::UUIDMaker::Win32::Guidgen: + file: lib/DBIx/Class/UUIDColumns/UUIDMaker/Win32/Guidgen.pm + DBIx::Class::UUIDColumns::UUIDMaker::Win32API::GUID: + file: lib/DBIx/Class/UUIDColumns/UUIDMaker/Win32API/GUID.pm +generated_by: Module::Build version 0.26 diff --git a/Makefile.PL b/Makefile.PL new file mode 100644 index 0000000..51d31fd --- /dev/null +++ b/Makefile.PL @@ -0,0 +1,31 @@ +# Note: this file was auto-generated by Module::Build::Compat version 0.03 + + unless (eval "use Module::Build::Compat 0.02; 1" ) { + print "This module requires Module::Build to install itself.\n"; + + require ExtUtils::MakeMaker; + my $yn = ExtUtils::MakeMaker::prompt + (' Install Module::Build now from CPAN?', 'y'); + + unless ($yn =~ /^y/i) { + die " *** Cannot install without Module::Build. Exiting ...\n"; + } + + require Cwd; + require File::Spec; + require CPAN; + + # Save this 'cause CPAN will chdir all over the place. + my $cwd = Cwd::cwd(); + my $makefile = File::Spec->rel2abs($0); + + CPAN::Shell->install('Module::Build::Compat') + or die " *** Cannot install without Module::Build. Exiting ...\n"; + + chdir $cwd or die "Cannot chdir() back to $cwd: $!"; + } + eval "use Module::Build::Compat 0.02; 1" or die $@; + use lib '_build/lib'; + Module::Build::Compat->run_build_pl(args => \@ARGV); + require Module::Build; + Module::Build::Compat->write_makefile(build_class => 'Module::Build'); diff --git a/README b/README new file mode 100644 index 0000000..bb25b26 --- /dev/null +++ b/README @@ -0,0 +1,76 @@ +NAME + DBIx::Class::UUIDColumns - Implicit uuid columns + +SYNOPSIS + In your DBIx::Class table class: + + __PACKAGE__->load_components(qw/UUIDColumns ... Core/); + __PACKAGE__->uuid_columns('artist_id'); + + Note: The component needs to be loaded *before* Core. + +DESCRIPTION + This DBIx::Class component resembles the behaviour of Class::DBI::UUID, + to make some columns implicitly created as uuid. + + When loaded, "UUIDColumns" will search for a suitable uuid generation + module from the following list of supported modules: + + Data::UUID + APR::UUID* + UUID + Win32::Guidgen + Win32API::GUID + + If no supporting module can be found, an exception will be thrown. + + *APR::UUID will not be loaded under OpenBSD due to an as yet + unidentified XS issue. + + If you would like to use a specific module, you can set "uuid_class": + + __PACKAGE__->uuid_class('::Data::UUID'); + __PACKAGE__->uuid_class('MyUUIDGenerator'); + +METHODS + get_uuid + Returns a uuid string from the current uuid_maker. + + insert + Inserts a new uuid string into each column in "uuid_columns". + + uuid_columns + Takes a list of columns to be filled with uuids during insert. + + __PACKAGE__->uuid_columns('artist_id'); + + uuid_class + Takes the name of a UUIDMaker subclass to be used for uuid value + generation. This can be a fully qualified class name, or a shortcut name + starting with :: that matches one of the available + DBIx::Class::UUIDColumns::UUIDMaker subclasses: + + __PACKAGE__->uuid_class('CustomUUIDGenerator'); + # loads CustomeUUIDGenerator + + __PACKAGE__->uuid_class('::Data::UUID'); + # loads DBIx::Class::UUIDMaker::Data::UUID; + + Note that "uuid_class" chacks to see that the specified class isa + DBIx::Class::UUIDColumns::UUIDMaker subbclass and throws and exception + if it isn't. + + uuid_maker + Returns the current UUIDMaker instance for the given module. + + my $uuid = __PACKAGE__->uuid_maker->as_string; + +SEE ALSO + DBIx::Class::UUIDColumns::UUIDMaker + +AUTHORS + Chia-liang Kao Chris Laco + +LICENSE + You may distribute this code under the same terms as Perl itself. + diff --git a/lib/DBIx/Class/UUIDColumns.pm b/lib/DBIx/Class/UUIDColumns.pm index 75efb8e..22cfc55 100644 --- a/lib/DBIx/Class/UUIDColumns.pm +++ b/lib/DBIx/Class/UUIDColumns.pm @@ -118,6 +118,14 @@ If you would like to use a specific module, you can set L: =head1 METHODS +=head2 get_uuid + +Returns a uuid string from the current uuid_maker. + +=head2 insert + +Inserts a new uuid string into each column in L. + =head2 uuid_columns Takes a list of columns to be filled with uuids during insert. diff --git a/lib/DBIx/Class/UUIDColumns/UUIDMaker.pm b/lib/DBIx/Class/UUIDColumns/UUIDMaker.pm index 6cbc18d..7499792 100644 --- a/lib/DBIx/Class/UUIDColumns/UUIDMaker.pm +++ b/lib/DBIx/Class/UUIDColumns/UUIDMaker.pm @@ -40,6 +40,10 @@ subclasses. Returns the new uuid as a string. +=head2 new + +Returns a new uuid maker subclass. + =head1 SEE ALSO L, diff --git a/t/03podcoverage.t.disabled b/t/03podcoverage.t similarity index 100% rename from t/03podcoverage.t.disabled rename to t/03podcoverage.t diff --git a/t/05uuid.t b/t/05uuid.t index 024bacf..a4e243c 100644 --- a/t/05uuid.t +++ b/t/05uuid.t @@ -3,13 +3,18 @@ use warnings; use Test::More; BEGIN { - plan eval "require Data::UUID" || - eval "require APR::UUID" || - eval "require UUID" || - eval "require Win32::Guidgen" || - eval "require Win32API::GUID" - ? ( tests => 3 ) - : ( skip_all => 'needs Data::UUID for testing' ); + plan skip_all => 'needs Data::UUID for testing' + unless + eval 'require Data::UUID' || + eval 'require APR::UUID' || + eval 'require UUID' || + eval 'require Win32::Guidgen' || + eval 'require Win32API::GUID'; + + plan skip_all => 'needs SQL::Translator for testing' + unless eval 'require SQL::Translator'; + + plan tests => 3; } use lib qw(t/lib); @@ -34,4 +39,4 @@ Class::C3->reinitialize(); $row = $schema->resultset('Test')->create({ }); ok UUIDTest::is_uuid( $row->id ), 'got something that loks like a UUID from Data::UUID'; -1; \ No newline at end of file +1;