-
Notifications
You must be signed in to change notification settings - Fork 6
/
RJBS.pm
200 lines (168 loc) · 4.29 KB
/
RJBS.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
package Dist::Zilla::PluginBundle::RJBS;
# ABSTRACT: BeLike::RJBS when you build your dists
use Moose;
use Moose::Autobox;
use Dist::Zilla 2.100922; # TestRelease
with 'Dist::Zilla::Role::PluginBundle::Easy';
=head1 DESCRIPTION
This is the plugin bundle that RJBS uses. It is more or less equivalent to:
[Git::GatherDir]
[@Basic]
; ...but without GatherDir and ExtraTests
[AutoPrereqs]
[Git::NextVersion]
[PkgVersion]
die_on_existing_version = 1
die_on_line_insertion = 1
[MetaConfig]
[MetaJSON]
[NextRelease]
[Test::ChangesHasContent]
[PodSyntaxTests]
[ReportVersions::Tiny]
[PodWeaver]
config_plugin = @RJBS
[GithubMeta]
remote = github
remote = origin
[@Git]
tag_format = %v
If the C<task> argument is given to the bundle, PodWeaver is replaced with
TaskWeaver and Git::NextVersion is replaced with AutoVersion. If the
C<manual_version> argument is given, AutoVersion is omitted.
If the C<github_issues> argument is given, and true, the F<META.*> files will
point to GitHub issues for the dist's bugtracker.
=cut
use Dist::Zilla::PluginBundle::Basic;
use Dist::Zilla::PluginBundle::Filter;
use Dist::Zilla::PluginBundle::Git;
has manual_version => (
is => 'ro',
isa => 'Bool',
lazy => 1,
default => sub { $_[0]->payload->{manual_version} },
);
has major_version => (
is => 'ro',
isa => 'Int',
lazy => 1,
default => sub { $_[0]->payload->{version} || 0 },
);
has is_task => (
is => 'ro',
isa => 'Bool',
lazy => 1,
default => sub { $_[0]->payload->{task} },
);
has github_issues => (
is => 'ro',
isa => 'Bool',
lazy => 1,
default => sub { $_[0]->payload->{github_issues} // 1 },
);
has weaver_config => (
is => 'ro',
isa => 'Str',
lazy => 1,
default => sub { $_[0]->payload->{weaver_config} || '@RJBS' },
);
sub mvp_multivalue_args { qw(dont_compile) }
has dont_compile => (
is => 'ro',
isa => 'ArrayRef[Str]',
lazy => 1,
default => sub { $_[0]->payload->{dont_compile} || [] },
);
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 '@RJBS';
$self->add_plugins('Git::GatherDir');
$self->add_plugins('CheckPrereqsIndexed');
$self->add_plugins('CheckExtraTests');
$self->add_plugins(
[ PromptIfStale => 'RJBS-Outdated' => {
phase => 'build',
module => 'Dist::Zilla::PluginBundle::RJBS',
} ],
[ PromptIfStale => 'CPAN-Outdated' => {
phase => 'release',
check_all_plugins => 1,
# check_all_prereqs => 1, # <-- not sure yet -- rjbs, 2013-09-23
} ],
);
$self->add_bundle('@Filter', {
'-bundle' => '@Basic',
'-remove' => [ 'GatherDir', 'ExtraTests' ],
});
$self->add_plugins('AutoPrereqs');
unless ($self->manual_version) {
if ($self->is_task) {
my $v_format = q<{{cldr('yyyyMMdd')}}>
. sprintf('.%03u', ($ENV{N} || 0));
$self->add_plugins([
AutoVersion => {
major => $self->major_version,
format => $v_format,
time_zone => 'America/New_York',
}
]);
} else {
$self->add_plugins([
'Git::NextVersion' => {
version_regexp => '^([0-9]+\.[0-9]+)$',
}
]);
}
}
$self->add_plugins(
[
PkgVersion => {
die_on_existing_version => 1,
die_on_line_insertion => 1,
},
],
qw(
MetaConfig
MetaJSON
NextRelease
Test::ChangesHasContent
PodSyntaxTests
ReportVersions::Tiny
),
);
$self->add_plugins(
[ Prereqs => 'TestMoreWithSubtests' => {
-phase => 'test',
-type => 'requires',
'Test::More' => '0.96'
} ],
);
if ($self->is_task) {
$self->add_plugins('TaskWeaver');
} else {
$self->add_plugins([
PodWeaver => {
config_plugin => $self->weaver_config,
replacer => 'replace_with_comment',
}
]);
}
$self->add_plugins(
[ GithubMeta => {
remote => [ qw(github origin) ],
issues => $self->github_issues,
} ],
);
$self->add_bundle('@Git' => {
tag_format => '%v',
remotes_must_exist => 0,
push_to => [
'origin :',
'github :',
],
});
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;