From: Graham Knop Date: Sun, 2 Mar 2014 00:32:03 +0000 (-0500) Subject: use travis helper and new Makefile.PL boilerplate X-Git-Tag: v1.003003~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6866984e8dc85579ed2fc850f39b9105eb13a3c8;p=gitmo%2FRole-Tiny.git use travis helper and new Makefile.PL boilerplate --- diff --git a/.travis.yml b/.travis.yml index 5610ec1..e1e5913 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,19 +13,21 @@ matrix: - perl: 5.18 env: COVERAGE=1 before_install: - - source maint/travis-perlbrew - - perlbrew install-cpanm -f + - git clone git://github.com/haarg/perl-travis-helper + - source perl-travis-helper/init + - build-perl - perl -V + - build-dist + - cd $BUILD_DIR install: - - maint/travis-install ExtUtils::MakeMaker - - maint/travis-install --deps - - "[ -n \"$COVERAGE\" ] && maint/travis-install Devel::Cover Devel::Cover::Report::Coveralls || true" - - "[ -n \"$COVERAGE\" ] && cover -delete -silent || true" - - "[ -n \"$COVERAGE\" ] && export HARNESS_PERL_SWITCHES='-MDevel::Cover=-ignore,^x?t/,-blib,0' || true" + - cpan-install --deps + - cpan-install --coverage +before_script: + - coverage-setup script: - - prove -lv + - prove -lv $(test-dirs) after_success: - - "[ -n \"$COVERAGE\" ] && cover -report coveralls || true" + - coverage-report branches: except: - /^wip\// diff --git a/Makefile.PL b/Makefile.PL index 49d1ac2..9e656f5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,45 +1,102 @@ use strict; use warnings FATAL => 'all'; use 5.006; -use ExtUtils::MakeMaker; -(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; -my %BUILD_DEPS = ( - 'Test::More' => 0.96, - 'Test::Fatal' => 0.003, +my %META = ( + name => 'Role-Tiny', + license => 'perl_5', + prereqs => { + configure => { requires => { + 'ExtUtils::MakeMaker' => 0, + } }, + build => { requires => { + } }, + test => { requires => { + 'Test::More' => 0.96, + 'Test::Fatal' => 0.003, + } }, + runtime => { + requires => { + Exporter => '5.57', + ($] >= 5.010 ? () : ('MRO::Compat' => 0)), + }, + recommends => { + 'Class::Method::Modifiers' => 1.05, + }, + }, + develop => { requires => { + Moo => 0, + } }, + }, + resources => { + # r/w: gitmo@git.shadowcat.co.uk:Role-Tiny.git + repository => { + url => 'git://git.shadowcat.co.uk/gitmo/Role-Tiny.git', + web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo/Role-Tiny.git', + type => 'git', + }, + bugtracker => { + mailto => 'bug-Role-Tiny@rt.cpan.org', + web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Role-Tiny', + }, + x_IRC => 'irc://irc.perl.org/#moose', + license => [ 'http://dev.perl.org/licenses/' ], + }, + no_index => { + directory => [ 't', 'xt' ] + }, ); +my %MM_ARGS = (); + +############################################################################## +require ExtUtils::MakeMaker; +ExtUtils::MakeMaker->import; + +(do 'maint/Makefile.PL.include' or die $@) unless -f 'META.yml'; + # have to do this since old EUMM dev releases miss the eval $VERSION line -my $mymeta = eval($ExtUtils::MakeMaker::VERSION) >= 6.57_02; -my $mymeta_works = eval($ExtUtils::MakeMaker::VERSION) >= 6.57_07; +my $eumm_version = eval $ExtUtils::MakeMaker::VERSION; +my $mymeta_works = $eumm_version >= 6.57_07; +my $mymeta = $eumm_version >= 6.57_02; +my $has_test_requires = $eumm_version >= 6.63_03; + +my %configure_deps = %{$META{prereqs}{configure}{requires}}; +my %build_deps = %{$META{prereqs}{build}{requires}}; +my %test_deps = %{$META{prereqs}{test}{requires}}; +my %run_deps = %{$META{prereqs}{runtime}{requires}}; + +my $min_perl_version = delete $run_deps{perl}; + +if (not $has_test_requires) { + %build_deps = (%build_deps, %test_deps); + %test_deps = (); +} +if (not $mymeta_works) { + %run_deps = (%run_deps, %build_deps); + %build_deps = (); +} + +(my $module_name = $META{name}) =~ s/-/::/g; +(my $module_file = "lib/$module_name.pm") =~ s{::}{/}g; WriteMakefile( - NAME => 'Role::Tiny', - VERSION_FROM => 'lib/Role/Tiny.pm', - PREREQ_PM => { - Exporter => '5.57', - ($] >= 5.010 ? () : ('MRO::Compat' => 0)), - ($mymeta_works ? () : (%BUILD_DEPS)), - }, - $mymeta_works ? (BUILD_REQUIRES => \%BUILD_DEPS) : (), + NAME => $module_name, + VERSION_FROM => $module_file, + LICENSE => $META{license}, + + $eumm_version >= 6.47_01 && $min_perl_version + ? ( MIN_PERL_VERSION => $min_perl_version ) : (), + $eumm_version >= 6.51_03 + ? ( CONFIGURE_REQUIRES => \%configure_deps ) : (), + $eumm_version >= 6.55_01 + ? ( BUILD_REQUIRES => \%build_deps ) : (), + $eumm_version >= 6.63_03 + ? ( TEST_REQUIRES => \%test_deps ) : (), + PREREQ_PM => \%run_deps, + ($mymeta && !$mymeta_works ? (NO_MYMETA => 1) : ()), + -f 'META.yml' ? () : (META_ADD => { 'meta-spec' => { version => 2 }, %META }), - -f 'META.yml' ? () : (META_MERGE => { - 'meta-spec' => { version => 2 }, - no_index => { - directory => [ 'xt' ] - }, - resources => { - # r/w: gitmo@git.shadowcat.co.uk:Role-Tiny.git - repository => { - url => 'git://git.shadowcat.co.uk/gitmo/Role-Tiny.git', - web => 'http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo/Role-Tiny.git', - type => 'git', - }, - bugtracker => { - mailto => 'bug-Role-Tiny@rt.cpan.org', - web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=Role-Tiny', - }, - }, - }), + %MM_ARGS, ); diff --git a/maint/travis-install b/maint/travis-install deleted file mode 100755 index 2016e0f..0000000 --- a/maint/travis-install +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -function clean_up { - kill $PROG - wait 2>/dev/null -} - -export PERL_CPANM_OPT="--mirror http://www.cpan.org/" - -function cpanm_install { - local dep="$1" - printf "Installing (without testing) $dep ..." - ( - while true; do - sleep 3 - printf '.' - done - ) & - local PROG=$! - trap "clean_up $PROG; exit 1" SIGHUP SIGINT SIGTERM - local OUT=$(cpanm --verbose --no-interactive --no-man-pages --notest $dep 2>&1 ) - local STATUS=$? - kill $PROG - wait $PROG 2>/dev/null - trap - SIGHUP SIGINT SIGTERM - if [ $STATUS != 0 ]; then - echo ' Failed!' - echo "$OUT" - exit $? - fi - echo ' Done' -} - -for arg; do - case $arg in - --deps) - AUTHOR_OPTS='' - if [ -z "$AUTHOR_TESTING" ] || [ "$AUTHOR_TESTING" -ne 0 ]; then - AUTHOR_OPTS='--with-recommends' - fi - DEPS="$DEPS $(cpanm --showdeps -q . --with-develop $AUTHOR_OPTS)" - for dep in $DEPS; do - case $dep in - perl*) ;; - *) - cpanm_install $dep - ;; - esac - done - ;; - *) - cpanm_install $arg - ;; - esac -done diff --git a/maint/travis-perlbrew b/maint/travis-perlbrew deleted file mode 100644 index 5c687d1..0000000 --- a/maint/travis-perlbrew +++ /dev/null @@ -1,16 +0,0 @@ -BREWVER=${TRAVIS_PERL_VERSION/_*/} -BREWOPTS= -[[ "${TRAVIS_PERL_VERSION}_" =~ '_thr_' ]] && BREWOPTS="$BREWOPTS -Duseithreads" -[[ "$(sed -n -E -e's/^5\.([0-9]+).*/\1/p' <<< $TRAVIS_PERL_VERSION)" -ge 14 ]] && BREWOPTS="$BREWOPTS -j 2" - -if ! perlbrew use | grep -q "Currently using $TRAVIS_PERL_VERSION"; then - echo "Building perl $TRAVIS_PERL_VERSION..." - PERLBUILD=$(perlbrew install --as $TRAVIS_PERL_VERSION --notest --noman --verbose $BREWOPTS $BREWVER 2>&1) - perlbrew use $TRAVIS_PERL_VERSION - if ! perlbrew use | grep -q "Currently using $TRAVIS_PERL_VERSION"; then - echo "Unable to switch to $TRAVIS_PERL_VERSION - compilation failed...?" 1>&2 - echo "$PERLBUILD" 1>&2 - exit 1 - fi -fi -perlbrew install-cpanm -f