From 956d549bcdc70ee353b0ea10ddfa75b3bc945870 Mon Sep 17 00:00:00 2001 From: Gryphon Shafer Date: Thu, 25 Sep 2014 11:04:31 -0700 Subject: [PATCH] Some OCD cleanup; addition of Travis and Coveralls --- .gitignore | 24 ++++++++--------- .travis.yml | 31 ++++++++++++++++++++++ Changes | 3 +++ MANIFEST | 7 +++-- Makefile.PL | 34 +++++++++++++++--------- README => README.md | 33 +++++++++-------------- lib/SQL/Abstract/Complete.pm | 9 ++++--- t/00-load.t | 10 +++---- t/Complete.t | 4 ++- t/boilerplate.t | 51 ------------------------------------ t/manifest.t | 18 ++++++++----- t/pod-coverage.t | 22 ++++++---------- t/pod.t | 12 ++++----- 13 files changed, 120 insertions(+), 138 deletions(-) create mode 100644 .travis.yml rename README => README.md (53%) delete mode 100644 t/boilerplate.t diff --git a/.gitignore b/.gitignore index 5436e84..f3a3016 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ -blib/ -.build/ +/blib/ +/.build/ _build/ cover_db/ inc/ @@ -7,14 +7,14 @@ Build !Build/ Build.bat .last_cover_stats -Makefile -Makefile.old -MANIFEST.bak -META.yml -MYMETA.yml +/Makefile +/Makefile.old +/MANIFEST.bak +/META.yml +/META.json +/MYMETA.* nytprof.out -pm_to_blib -.tar.gz -.lwpcookies -.tmp -SQL-Abstract-Complete-* +/pm_to_blib +*.o +*.bs +dest diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ce050f5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,31 @@ +--- +language: perl +perl: + - blead + - 5.20 + - 5.18 + - 5.16 + - 5.14 +env: PERL_CPANM_OPT="--quiet --notest --force --skip-satisfied" +before_install: + - git clone git://github.com/haarg/perl-travis-helper + - source perl-travis-helper/init + - build-perl + - perl -V + - cpanm -v -n -f Test::Pod Test::Pod::Coverage Test::CheckManifest Devel::Cover::Report::Coveralls + - git config --global github.user gryphonshafer +install: + - export RELEASE_TESTING=1 AUTOMATED_TESTING=1 AUTHOR_TESTING=1 HARNESS_OPTIONS=c HARNESS_TIMER=1 + - cpanm -v -n --installdeps . +script: + - perl Makefile.PL && make test + - PERL5OPT=-MDevel::Cover=-coverage,statement,branch,condition,path,subroutine prove -lrsv t + - cover +after_success: + - cover -report coveralls +notifications: + email: + on_failure: always + on_success: change + recipients: + - gryphon@gryphonshafer.com diff --git a/Changes b/Changes index b79e3ed..c231e77 100644 --- a/Changes +++ b/Changes @@ -5,3 +5,6 @@ Revision history for SQL::Abstract::Complete 1.03 Mon Jun 10 16:49:35 PDT 2013 Switch from Clone::Fast to Storable dclone for deep copy + +1.04 Wed Sep 25 10:00:58 PDT 2014 + Some OCD cleanup; addition of Travis and Coveralls. diff --git a/MANIFEST b/MANIFEST index 41c2951..16b65a5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,10 +1,9 @@ Changes -MANIFEST -Makefile.PL -README lib/SQL/Abstract/Complete.pm +Makefile.PL +MANIFEST +README.md t/00-load.t -t/boilerplate.t t/Complete.t t/manifest.t t/pod-coverage.t diff --git a/Makefile.PL b/Makefile.PL index cc6ea66..a53b4a0 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,21 +1,31 @@ +#!/usr/bin/env perl use strict; use warnings; use ExtUtils::MakeMaker; WriteMakefile( - NAME => 'SQL::Abstract::Complete', - AUTHOR => q{Gryphon Shafer }, - VERSION_FROM => 'lib/SQL/Abstract/Complete.pm', - ABSTRACT_FROM => 'lib/SQL/Abstract/Complete.pm', - ($ExtUtils::MakeMaker::VERSION >= 6.3002 - ? ('LICENSE'=> 'perl') - : ()), - PL_FILES => {}, - PREREQ_PM => { - 'Test::More' => 0, + 'NAME' => 'SQL::Abstract::Complete', + 'AUTHOR' => 'Gryphon Shafer ', + 'VERSION_FROM' => 'lib/SQL/Abstract/Complete.pm', + 'ABSTRACT_FROM' => 'lib/SQL/Abstract/Complete.pm', + 'PL_FILES' => {}, + 'MIN_PERL_VERSION' => '5.010', + 'PREREQ_PM' => { 'SQL::Abstract' => 1.5, 'Storable' => 0, + 'Test::Most' => 0, }, - dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, - clean => { FILES => 'SQL-Abstract-Complete-*' }, + 'dist' => { 'COMPRESS' => 'gzip -9f', 'SUFFIX' => 'gz' }, + 'clean' => { 'FILES' => 'SQL-Abstract-Complete-*' }, + ( $ExtUtils::MakeMaker::VERSION >= 6.3002 ? ( 'LICENSE' => 'perl' ) : () ), + ( eval { ExtUtils::MakeMaker->VERSION(6.46) } ? ( 'META_MERGE' => { + 'meta-spec' => { version => 2 }, + 'resources' => { + 'repository' => { + 'type' => 'git', + 'url' => 'https://github.com/gryphonshafer/SQL-Abstract-Complete.git', + 'web' => 'https://github.com/gryphonshafer/SQL-Abstract-Complete', + }, + } } ) : () + ), ); diff --git a/README b/README.md similarity index 53% rename from README rename to README.md index 14b4867..4de83c7 100644 --- a/README +++ b/README.md @@ -1,4 +1,4 @@ -SQL::Abstract::Complete - Generate complete SQL from Perl data structures +# SQL::Abstract::Complete - Generate complete SQL from Perl data structures This module was inspired by the excellent SQL::Abstract, from which in inherits. However, in trying to use the module, I found that what I really @@ -7,12 +7,14 @@ by clauses. So, I set out to create a more complete abstract SQL generation module. (To be fair, SQL::Abstract kept it's first $table argument inflexible for backwards compatibility reasons.) +[![Build Status](https://travis-ci.org/gryphonshafer/SQL-Abstract-Complete.svg)](https://travis-ci.org/gryphonshafer/SQL-Abstract-Complete) +[![Coverage Status](https://coveralls.io/repos/gryphonshafer/SQL-Abstract-Complete/badge.png)](https://coveralls.io/r/gryphonshafer/SQL-Abstract-Complete) + This module only changes the select() method and adds a small new wrinkle to new(). Everything else from SQL::Abstract is inheritted as-is. Consequently, you should read the SQL::Abstract documentation before continuing. - -INSTALLATION +## Installation To install this module, run the following commands: @@ -21,7 +23,7 @@ To install this module, run the following commands: make test make install -SUPPORT AND DOCUMENTATION +## Support and Documentation After installing, you can find documentation for this module with the perldoc command. @@ -30,23 +32,14 @@ perldoc command. You can also look for information at: - RT, CPAN's request tracker - http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Abstract-Complete +- [GitHub](https://github.com/gryphonshafer/SQL-Abstract-Complete "GitHub") +- [AnnoCPAN](http://annocpan.org/dist/SQL-Abstract-Complete "AnnoCPAN") +- [CPAN Ratings](http://cpanratings.perl.org/m/SQL-Abstract-Complete "CPAN Ratings") +- [Search CPAN](http://search.cpan.org/dist/SQL-Abstract-Complete "Search CPAN") - AnnoCPAN, Annotated CPAN documentation - http://annocpan.org/dist/SQL-Abstract-Complete +## Author and License - CPAN Ratings - http://cpanratings.perl.org/d/SQL-Abstract-Complete - - Search CPAN - http://search.cpan.org/dist/SQL-Abstract-Complete/ - - -AUTHOR AND LICENSE - -Gryphon Shafer, gryphon@cpan.org +Gryphon Shafer, [gryphon@cpan.org](mailto:gryphon@cpan.org "Email Gryphon Shafer") This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.4 or, -at your option, any later version of Perl 5 you may have available. +it under the same terms as Perl itself. diff --git a/lib/SQL/Abstract/Complete.pm b/lib/SQL/Abstract/Complete.pm index 0219720..7c2aa62 100644 --- a/lib/SQL/Abstract/Complete.pm +++ b/lib/SQL/Abstract/Complete.pm @@ -1,12 +1,14 @@ package SQL::Abstract::Complete; use strict; use warnings; + use SQL::Abstract 1.5; use Storable 'dclone'; + use vars '@ISA'; @ISA = 'SQL::Abstract'; -our $VERSION = '1.03'; +our $VERSION = '1.04'; sub new { my $self = shift; @@ -140,7 +142,7 @@ sub select { } 1; -__END__ + =pod =head1 NAME @@ -334,7 +336,6 @@ Gryphon Shafer Egryphon@cpan.orgE. =head1 LICENSE This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.8.4 or, -at your option, any later version of Perl 5 you may have available. +it under the same terms as Perl itself. =cut diff --git a/t/00-load.t b/t/00-load.t index 55a0969..f1d821c 100644 --- a/t/00-load.t +++ b/t/00-load.t @@ -1,8 +1,6 @@ -#!perl -T -use Test::More tests => 1; - -BEGIN { - use_ok( 'SQL::Abstract::Complete' ) || print "Bail out!\n"; -} +#!/usr/bin/env perl +use Test::Most; +BEGIN { use_ok('SQL::Abstract::Complete') } diag( "Testing SQL::Abstract::Complete $SQL::Abstract::Complete::VERSION, Perl $], $^X" ); +done_testing(); diff --git a/t/Complete.t b/t/Complete.t index 933750d..35a242b 100644 --- a/t/Complete.t +++ b/t/Complete.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More 'tests' => 22; +use Test::Most; use constant MODULE => 'SQL::Abstract::Complete'; @@ -147,3 +147,5 @@ is( is( $sac->_sqlcase('from'), 'FROM', q{$sac->_sqlcase('from')} ); is( $sac->_sqlcase(undef), '', '$sac->_sqlcase(undef)' ); + +done_testing; diff --git a/t/boilerplate.t b/t/boilerplate.t deleted file mode 100644 index 8dd9399..0000000 --- a/t/boilerplate.t +++ /dev/null @@ -1,51 +0,0 @@ -#!perl -T -use strict; -use warnings; -use Test::More tests => 3; - -sub not_in_file_ok { - my ($filename, %regex) = @_; - open( my $fh, '<', $filename ) or die "couldn't open $filename for reading: $!"; - - my %violated; - - while (my $line = <$fh>) { - while (my ($desc, $regex) = each %regex) { - if ($line =~ $regex) { - push @{$violated{$desc}||=[]}, $.; - } - } - } - - if (%violated) { - fail("$filename contains boilerplate text"); - diag "$_ appears on lines @{$violated{$_}}" for ( keys %violated ); - } - else { - pass("$filename contains no boilerplate text"); - } -} - -sub module_boilerplate_ok { - my ($module) = @_; - not_in_file_ok($module => - 'the great new $MODULENAME' => qr/ - The great new /, - 'boilerplate description' => qr/Quick summary of what the module/, - 'stub function definition' => qr/function[12]/, - ); -} - -TODO: { - local $TODO = "Need to replace the boilerplate text"; - - not_in_file_ok(README => - "The README is used..." => qr/The README is used/, - "'version information here'" => qr/to provide version information/, - ); - - not_in_file_ok(Changes => - "placeholder date/time" => qr(Date/time) - ); - - module_boilerplate_ok('lib/SQL/Abstract/Complete.pm'); -} diff --git a/t/manifest.t b/t/manifest.t index 15a25cf..714eb7f 100644 --- a/t/manifest.t +++ b/t/manifest.t @@ -1,8 +1,12 @@ -#!perl -T -use strict; -use warnings; -use Test::More; +#!/usr/bin/env perl +use Test::Most; -eval "use Test::CheckManifest 0.9"; -plan skip_all => "Test::CheckManifest 0.9 required" if $@; -ok_manifest({filter => [qr/\.git/]}); +eval('use Test::CheckManifest 0.9'); +plan( 'skip_all' => "Test::CheckManifest 0.9 required" ) if $@; +ok_manifest( { 'filter' => [ + qr/\.git/, + qr/\.travis\.yml$/, + qr/perl-travis-helper/, + qr/cover_db/, +] } ); +done_testing(); diff --git a/t/pod-coverage.t b/t/pod-coverage.t index 621c860..ba4f14d 100644 --- a/t/pod-coverage.t +++ b/t/pod-coverage.t @@ -1,19 +1,13 @@ -#!perl -T -use strict; -use warnings; -use Test::More; +#!/usr/bin/env perl +use Test::Most; -# Ensure a recent version of Test::Pod::Coverage my $min_tpc = 1.08; -eval "use Test::Pod::Coverage $min_tpc"; -plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage" - if $@; +eval("use Test::Pod::Coverage $min_tpc"); +plan( 'skip_all' => "Test::Pod::Coverage $min_tpc required for testing POD coverage" ) if $@; -# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version, -# but older versions don't recognize some common documentation styles my $min_pc = 0.18; -eval "use Pod::Coverage $min_pc"; -plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage" - if $@; +eval("use Pod::Coverage $min_pc"); +plan( 'skip_all' => "Pod::Coverage $min_pc required for testing POD coverage" ) if $@; -all_pod_coverage_ok(); +all_pod_coverage_ok( { 'trustme' => ['BUILD'] } ); +done_testing(); diff --git a/t/pod.t b/t/pod.t index 236d03c..187cf82 100644 --- a/t/pod.t +++ b/t/pod.t @@ -1,11 +1,9 @@ -#!perl -T -use strict; -use warnings; -use Test::More; +#!/usr/bin/env perl +use Test::Most; -# Ensure a recent version of Test::Pod my $min_tp = 1.22; -eval "use Test::Pod $min_tp"; -plan skip_all => "Test::Pod $min_tp required for testing POD" if $@; +eval("use Test::Pod $min_tp"); +plan( 'skip_all' => "Test::Pod $min_tp required for testing POD" ) if $@; all_pod_files_ok(); +done_testing();