Skip to content
Browse files

Added several features like Dist::Zilla::Plugin::Run integration and …

…duckpan / no_cpan / no_install options
  • Loading branch information...
1 parent f09949a commit 6c78010aa715064046951251162ef07d011d44c4 @Getty committed Feb 4, 2013
Showing with 108 additions and 21 deletions.
  1. +14 −11 dist.ini
  2. +94 −10 lib/Dist/Zilla/PluginBundle/Author/GETTY.pm
View
25 dist.ini
@@ -10,17 +10,20 @@ copyright_year = 2012
Dist::Zilla = 1.092990 ; new-style bundle expansion
Pod::Elemental = 0.092970
Pod::Weaver = 3.100310 ; =func, compat fixes
-Dist::Zilla::Plugin::PodWeaver = 3.092971
-Dist::Zilla::Plugin::Repository = 0
-Dist::Zilla::Plugin::TaskWeaver = 0.093330
-Dist::Zilla::Plugin::BumpVersionFromGit = 0
-Dist::Zilla::Plugin::GithubMeta = 0
+Dist::Zilla::Plugin::PodWeaver = 3.101641
+Dist::Zilla::Plugin::Repository = 0.19
+Dist::Zilla::Plugin::TaskWeaver = 0.101624
+Dist::Zilla::Plugin::BumpVersionFromGit = 0.009
+Dist::Zilla::Plugin::GithubMeta = 0.28
Dist::Zilla::Plugin::InstallRelease = 0.007
-Dist::Zilla::Plugin::Authority = 0
-Dist::Zilla::Plugin::ChangelogFromGit = 0
-Dist::Zilla::PluginBundle::Git = 0
-Pod::Elemental::Transformer::List = 0
-App::cpanminus = 0
+Dist::Zilla::Plugin::Authority = 1.006
+Dist::Zilla::Plugin::ChangelogFromGit = 0.006
+Dist::Zilla::Plugin::UploadToDuckPAN = 0.001
+Dist::Zilla::Plugin::MakeMaker::SkipInstall = 1.100
+Dist::Zilla::Plugin::Run = 0.014
+Dist::Zilla::PluginBundle::Git = 2.008
+Pod::Elemental::Transformer::List = 0.101620
+App::cpanminus = 1.5021
[Prereqs / TestRequires]
-Test::More = 0.90
+Test::More = 0.98
View
104 lib/Dist/Zilla/PluginBundle/Author/GETTY.pm
@@ -51,9 +51,13 @@ You can configure it (given values are default):
author = GETTY
release_branch = master
weaver_config = @Author::GETTY
+ no_cpan = 0
+ duckpan = 0
+ no_install = 0
If the C<task> argument is given to the bundle, PodWeaver is replaced with
-TaskWeaver and Git::NextVersion is replaced with AutoVersion:
+TaskWeaver and Git::NextVersion is replaced with AutoVersion, you can also
+give independent a bigger major version with C<version>:
[@Author::GETTY]
task = 1
@@ -64,6 +68,16 @@ are omitted.
[@Author::GETTY]
manual_version = 1.222333
+You can also use shortcuts for integrating L<Dist::Zilla::Plugin::Run>:
+
+ [@Author::GETTY]
+ run_after_build = script/do_this.pl --dir %s --version %s
+ run_before_build = script/do_this.pl --version %s
+ run_before_release = script/myapp_before1.pl %s
+ run_release = deployer.pl --dir %d --tgz %a --name %n --version %v
+ run_after_release = script/myapp_after.pl --archive %s --version %s
+ run_test = script/tester.pl --name %n --version %v some_file.ext
+
=cut
use Dist::Zilla::PluginBundle::Basic;
@@ -87,14 +101,35 @@ has author => (
is => 'ro',
isa => 'Str',
lazy => 1,
- default => sub { 'GETTY' },
+ default => sub { $_[0]->payload->{author} || 'GETTY' },
);
has release_branch => (
is => 'ro',
isa => 'Str',
lazy => 1,
- default => sub { 'master' },
+ default => sub { $_[0]->payload->{release_branch} || 'master' },
+);
+
+has duckpan => (
+ is => 'ro',
+ isa => 'Bool',
+ lazy => 1,
+ default => sub { $_[0]->payload->{duckpan} },
+);
+
+has no_cpan => (
+ is => 'ro',
+ isa => 'Bool',
+ lazy => 1,
+ default => sub { $_[0]->payload->{no_cpan} },
+);
+
+has no_install => (
+ is => 'ro',
+ isa => 'Bool',
+ lazy => 1,
+ default => sub { $_[0]->payload->{no_install} },
);
has is_task => (
@@ -111,13 +146,47 @@ has weaver_config => (
default => sub { $_[0]->payload->{weaver_config} || '@Author::GETTY' },
);
+my @run_options = qw( after_build before_build before_release release after_release test );
+
+for (@run_options) {
+ has "run_".$_ => (
+ is => 'ro',
+ isa => 'Str',
+ lazy => 1,
+ default => sub { $_[0]->payload->{"run_".$_} || "" },
+ );
+}
+
sub configure {
my ($self) = @_;
$self->log_fatal("you must not specify both weaver_config and is_task")
if $self->is_task and $self->weaver_config ne '@Author::GETTY';
- $self->add_bundle('@Basic');
+ $self->log_fatal("you must not specify both author and no_cpan")
+ if $self->no_cpan and $self->author ne 'GETTY';
+
+ if ($self->no_cpan) {
+ $self->add_bundle('@Filter' => {
+ -bundle => '@Basic',
+ -remove => 'ShareDir',
+ -remove => 'UploadToCPAN',
+ });
+ } else {
+ $self->add_bundle('@Basic');
+ }
+
+ if ($self->duckpan) {
+ $self->add_plugins(qw(
+ UploadToDuckPAN
+ ));
+ }
+
+ if ($self->no_install) {
+ $self->add_plugins(qw(
+ MakeMaker::SkipInstall
+ ));
+ }
unless ($self->manual_version) {
if ($self->is_task) {
@@ -139,6 +208,19 @@ sub configure {
}
}
+ for (@run_options) {
+ my $net = $_;
+ my $func = 'run_'.$_;
+ if ($self->$func) {
+ my $plugin = join('',map { ucfirst($_) } split(/_/,$_));
+ $self->add_plugins([
+ $plugin => {
+ run => $self->$func,
+ }
+ ]);
+ }
+ }
+
$self->add_plugins(qw(
PkgVersion
MetaConfig
@@ -154,12 +236,14 @@ sub configure {
}
]);
- $self->add_plugins([
- 'Authority' => {
- authority => 'cpan:'.$self->author,
- do_metadata => 1,
- }
- ]);
+ unless ($self->no_cpan) {
+ $self->add_plugins([
+ 'Authority' => {
+ authority => 'cpan:'.$self->author,
+ do_metadata => 1,
+ }
+ ]);
+ }
$self->add_plugins([
'Git::CheckFor::CorrectBranch' => {

0 comments on commit 6c78010

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