Skip to content
Browse files

Several changes involving adding more no_ parameter for non cpan dist…

…ributions
  • Loading branch information...
1 parent 7c2b309 commit 45f49f500485a14879d5dd5ca653c81b4d2094cd @Getty committed Dec 24, 2013
Showing with 117 additions and 25 deletions.
  1. +4 −3 .travis.yml
  2. +113 −22 lib/Dist/Zilla/PluginBundle/Author/GETTY.pm
View
7 .travis.yml
@@ -1,15 +1,16 @@
---
before_install:
- - export AUTOMATED_TESTING=1 HARNESS_OPTIONS=j10:c HARNESS_TIMER=1
+ - export HARNESS_OPTIONS=j10:c HARNESS_TIMER=1
- rm .travis.yml
- git config --global user.name "Dist Zilla Plugin TravisCI"
- git config --global user.email $HOSTNAME":not-for-mail@travis-ci.org"
install:
- cpanm --quiet --notest --skip-satisfied Dist::Zilla
- - "dzil authordeps | grep -vP '[^\\w:]' | xargs -n 5 -P 10 cpanm --quiet --notest --skip-satisfied"
- - "dzil listdeps | grep -vP '[^\\w:]' | cpanm --quiet --notest --skip-satisfied"
+ - dzil authordeps | grep -ve '^\W' | xargs -n 5 -P 10 cpanm --quiet --notest --skip-satisfied
+ - dzil listdeps | grep -ve '^\W' | cpanm --quiet --notest --skip-satisfied
language: perl
perl:
+ - 5.18
- 5.16
- 5.14
- 5.12
View
135 lib/Dist/Zilla/PluginBundle/Author/GETTY.pm
@@ -6,6 +6,8 @@ use Moose::Autobox;
use Dist::Zilla;
with 'Dist::Zilla::Role::PluginBundle::Easy';
+use Dist::Zilla::Plugin::TravisCI ();
+
=head1 SYNOPSIS
name = Your-App
@@ -32,6 +34,9 @@ are default):
no_install = 0
no_makemaker = 0
no_installrelease = 0
+ no_changes = 0
+ no_changelog_from_git = 0
+ no_podweaver = 0
installrelease_command = cpanm .
In default configuration it is equivalent to:
@@ -98,6 +103,12 @@ You can also use shortcuts for integrating L<Dist::Zilla::Plugin::Run>:
run_if_release_test = ./Build install
run_if_release_test = make install
+You can use all options of L<Dist::Zilla::Plugin::TravisCI> just by prefix
+them with B<travis_>, like here:
+
+ [@Author::GETTY]
+ travis_before_install = duckpan DDGC::Static
+
It also combines on request with L<Dist::Zilla::Plugin::Alien>, you can set
all parameter of the Alien plugin here, just by preceeding with I<alien_>, the
only required parameter here is C<alien_repo>:
@@ -143,6 +154,15 @@ default a dzil build or release would also generate a B<.travis.yml>.
If set to 1, then L<Dist::Zilla::Plugin::ChangelogFromGit> will be disabled, and
L<Dist::Zilla::Plugin::NextRelease> will be used instead.
+=head2 no_changes
+
+If set to 1, then neither L<Dist::Zilla::Plugin::ChangelogFromGit> or
+L<Dist::Zilla::Plugin::NextRelease> will be used.
+
+=head2 no_podweaver
+
+If set to 1, then L<Dist::Zilla::Plugin::PodWeaver> is not used.
+
=head2 duckpan
If set to 1, this attribute will activate L<Dist::Zilla::Plugin::UploadToDuckPAN>.
@@ -285,6 +305,13 @@ has no_changelog_from_git => (
default => sub { $_[0]->payload->{no_changelog_from_git} },
);
+has no_changes => (
+ is => 'ro',
+ isa => 'Bool',
+ lazy => 1,
+ default => sub { $_[0]->payload->{no_changes} },
+);
+
has no_install => (
is => 'ro',
isa => 'Bool',
@@ -299,6 +326,13 @@ has no_makemaker => (
default => sub { $_[0]->payload->{no_makemaker} || $_[0]->is_alien },
);
+has no_podweaver => (
+ is => 'ro',
+ isa => 'Bool',
+ lazy => 1,
+ default => sub { $_[0]->payload->{no_podweaver} },
+);
+
has is_task => (
is => 'ro',
isa => 'Bool',
@@ -325,11 +359,35 @@ my @run_ways = qw( run run_if_trial run_no_trial run_if_release run_no_release )
my @run_attributes = map { my $o = $_; map { join('_',$_,$o) } @run_ways } @run_options;
+for my $attr (@run_attributes) {
+ has $attr => (
+ is => 'ro',
+ isa => 'ArrayRef[Str]',
+ lazy => 1,
+ default => sub { [] },
+ );
+}
+
my @alien_options = qw( repo name bins pattern_prefix pattern_suffix pattern_version pattern );
my @alien_attributes = map { 'alien_'.$_ } @alien_options;
-for my $attr (@run_attributes, @alien_attributes) {
+for my $attr (@alien_attributes) {
+ has $attr => (
+ is => 'ro',
+ isa => 'Str',
+ lazy => 1,
+ default => sub { $_[0]->payload->{$attr} || "" },
+ );
+}
+
+my @travis_str_options = (
+ @Dist::Zilla::Plugin::TravisCI::bools,
+);
+
+my @travis_str_attributes = map { 'travis_'.$_ } @travis_str_options;
+
+for my $attr (@travis_str_attributes) {
has $attr => (
is => 'ro',
isa => 'Str',
@@ -338,6 +396,26 @@ for my $attr (@run_attributes, @alien_attributes) {
);
}
+my @travis_array_options = (
+ @Dist::Zilla::Plugin::TravisCI::phases,
+ @Dist::Zilla::Plugin::TravisCI::emptymvarrayattr,
+ 'irc_template',
+ 'perl_version',
+);
+
+my @travis_array_attributes = map { 'travis_'.$_ } @travis_array_options;
+
+for my $attr (@travis_array_attributes) {
+ has $attr => (
+ is => 'ro',
+ isa => 'ArrayRef[Str]',
+ lazy => 1,
+ default => sub { [] },
+ );
+}
+
+sub mvp_multivalue_args { @travis_array_attributes, @run_attributes }
+
sub configure {
my ($self) = @_;
@@ -397,7 +475,7 @@ sub configure {
for (@run_options) {
my $net = $_;
my $func = 'run_'.$_;
- if ($self->$func) {
+ if (@{$self->$func}) {
my $plugin = join('',map { ucfirst($_) } split(/_/,$_));
$self->add_plugins([
'Run::'.$plugin => {
@@ -417,9 +495,18 @@ sub configure {
));
unless ($self->no_travis) {
- $self->add_plugins(qw(
- TravisCI
- ));
+ $self->add_plugins([
+ TravisCI => {
+ ( map {
+ my $func = 'travis_'.$_;
+ $self->$func ? ( $_ => $self->$func ) : ();
+ } @travis_str_options ),
+ ( map {
+ my $func = 'travis_'.$_;
+ scalar @{$self->$func} ? ( $_ => $self->$func ) : ();
+ } @travis_array_options ),
+ },
+ ]);
}
if ($self->is_alien) {
@@ -473,28 +560,32 @@ sub configure {
} ],
);
- if ($self->no_changelog_from_git) {
- $self->add_plugins(qw(
- NextRelease
- ));
- } else {
- $self->add_plugins([
- 'ChangelogFromGit' => {
- max_age => 99999,
- tag_regexp => '^v(.+)$',
- file_name => 'Changes',
- wrap_column => 74,
- debug => 0,
- }
- ]);
+ unless ($self->no_changes) {
+ if ($self->no_changelog_from_git) {
+ $self->add_plugins(qw(
+ NextRelease
+ ));
+ } else {
+ $self->add_plugins([
+ 'ChangelogFromGit' => {
+ max_age => 99999,
+ tag_regexp => '^v(.+)$',
+ file_name => 'Changes',
+ wrap_column => 74,
+ debug => 0,
+ }
+ ]);
+ }
}
if ($self->is_task) {
$self->add_plugins('TaskWeaver');
} else {
- $self->add_plugins([
- PodWeaver => { config_plugin => $self->weaver_config }
- ]);
+ unless ($self->no_podweaver) {
+ $self->add_plugins([
+ PodWeaver => { config_plugin => $self->weaver_config }
+ ]);
+ }
}
$self->add_bundle('@Git' => {

0 comments on commit 45f49f5

Please sign in to comment.
Something went wrong with that request. Please try again.