Skip to content

Commit

Permalink
Allow changing readme build phase via ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
rwstauner committed Oct 17, 2015
1 parent fe228aa commit 6e979b5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/Dist/Zilla/PluginBundle/Author/RWSTAUNER.pm
Expand Up @@ -131,6 +131,15 @@ has releaser => (
},
);

has readme_phase => (
is => 'ro',
isa => 'Str',
lazy => 1,
default => sub {
$_[0]->_config(readme_phase => $ENV{DZIL_README_PHASE} || 'release');
}
);

has skip_plugins => (
is => 'ro',
isa => 'Maybe[Regexp]',
Expand Down Expand Up @@ -305,14 +314,14 @@ sub configure {
':version' => '0.142180', # 'phase'
type => 'markdown', # L<> to metacpan
location => 'root',
phase => 'release',
phase => $self->readme_phase,
}
],
[
# ... and add status badges to it.
'GitHubREADME::Badge' => {
':version' => '0.16', # 'phase', svg
phase => 'release',
phase => $self->readme_phase,
badges => [qw(
travis
coveralls
Expand Down
28 changes: 28 additions & 0 deletions t/configure.t
Expand Up @@ -32,6 +32,8 @@ my %default_exp = (
do_metadata => 1, do_munging => 1, locate_comment => 0
},
PruneDevelCoverDatabase => { match => '^(cover_db/.+)' },
ReadmeAnyFromPod => { phase => 'release', location => 'root', type => 'markdown', },
'GitHubREADME::Badge' => { phase => 'release', badges => [qw( travis coveralls cpants )], },
CopyFilesFromRelease => { filename => ['LICENSE'] },
);

Expand Down Expand Up @@ -103,6 +105,32 @@ configure_ok
{ 'Test::Portability' => {options => 'test_one_dot=0'} },
'config-slice Test::Portability.options';

{
my $readmes = sub {
my $phase = shift;
return {
ReadmeAnyFromPod => { %{ $default_exp{ReadmeAnyFromPod} }, phase => $phase },
'GitHubREADME::Badge' => { %{ $default_exp{'GitHubREADME::Badge'} }, phase => $phase },
};
};

configure_ok
{},
$readmes->('release'),
'readme plugins default config';

configure_ok
{ readme_phase => 'build' },
$readmes->('build'),
'readme plugins changed with dist.ini';

local $ENV{DZIL_README_PHASE} = 'build';
configure_ok
{},
$readmes->('build'),
'readme plugins changed with env';
}

configure_ok
{ 'MetaProvides::Package.meta_noindex' => 0 },
{ 'MetaProvides::Package' => {meta_noindex => 0} },
Expand Down

0 comments on commit 6e979b5

Please sign in to comment.