line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# vim: set ts=2 sts=2 sw=2 expandtab smarttab: |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This file is part of Dist-Zilla-Plugin-Git-DescribeVersion |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# This software is copyright (c) 2010 by Randy Stauner. |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# This is free software; you can redistribute it and/or modify it under |
8
|
|
|
|
|
|
|
# the same terms as the Perl 5 programming language system itself. |
9
|
|
|
|
|
|
|
# |
10
|
1
|
|
|
1
|
|
1040
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
11
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
67
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::Git::DescribeVersion; |
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
$Dist::Zilla::Plugin::Git::DescribeVersion::VERSION = '1.004'; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
# git description: v1.003-5-gff644eb |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
BEGIN { |
20
|
1
|
|
|
1
|
|
20
|
$Dist::Zilla::Plugin::Git::DescribeVersion::AUTHORITY = 'cpan:RWSTAUNER'; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
# ABSTRACT: Provide version using git-describe |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
11629
|
use Dist::Zilla 4 (); |
|
1
|
|
|
|
|
2152219
|
|
|
1
|
|
|
|
|
45
|
|
25
|
1
|
|
|
1
|
|
21
|
use Git::DescribeVersion (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
26
|
1
|
|
|
1
|
|
6
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
with 'Dist::Zilla::Role::VersionProvider'; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
while( my ($name, $default) = each %Git::DescribeVersion::Defaults ){ |
31
|
|
|
|
|
|
|
has $name => ( is => 'ro', isa=>'Str', default => $default ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub provide_version { |
35
|
7
|
|
|
7
|
0
|
6364
|
my ($self) = @_; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# override (or maybe needed to initialize) |
38
|
7
|
100
|
|
|
|
30
|
return $ENV{V} if exists $ENV{V}; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# less overhead to use %Defaults than MOP meta API |
41
|
6
|
|
|
|
|
16
|
my $opts = { map { $_ => $self->$_() } |
|
12
|
|
|
|
|
519
|
|
42
|
|
|
|
|
|
|
keys %Git::DescribeVersion::Defaults }; |
43
|
|
|
|
|
|
|
|
44
|
6
|
|
|
|
|
199
|
my $new_ver = eval { |
45
|
6
|
|
|
|
|
25
|
Git::DescribeVersion->new($opts)->version; |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
|
48
|
6
|
100
|
|
|
|
424
|
$self->log_fatal("Could not determine version from tags: $@") |
49
|
|
|
|
|
|
|
unless defined $new_ver; |
50
|
|
|
|
|
|
|
|
51
|
5
|
|
|
|
|
21
|
$self->log("Git described version as $new_ver"); |
52
|
|
|
|
|
|
|
|
53
|
5
|
|
|
|
|
315
|
$self->zilla->version("$new_ver"); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
1
|
|
7325
|
no Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
57
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |
62
|
|
|
|
|
|
|
=pod |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=encoding utf-8 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=for :stopwords Randy Stauner ACKNOWLEDGEMENTS repo cpan testmatrix url annocpan anno |
67
|
|
|
|
|
|
|
bugtracker rt cpants kwalitee diff irc mailto metadata placeholders |
68
|
|
|
|
|
|
|
metacpan |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 NAME |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Dist::Zilla::Plugin::Git::DescribeVersion - Provide version using git-describe |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 VERSION |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
version 1.004 |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SYNOPSIS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
In your F<dist.ini>: |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
[Git::DescribeVersion] |
83
|
|
|
|
|
|
|
match_pattern = v[0-9]* ; this is the default |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 DESCRIPTION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This performs the L<Dist::Zilla::Role::VersionProvider> role. |
88
|
|
|
|
|
|
|
It uses L<Git::DescribeVersion> to count the number of commits |
89
|
|
|
|
|
|
|
since the last tag (matching I<match_pattern>) or since the initial commit, |
90
|
|
|
|
|
|
|
and uses the result as the I<version> parameter for your distribution. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
The plugin accepts the same options as |
93
|
|
|
|
|
|
|
L<Git::DescribeVersion/new>. |
94
|
|
|
|
|
|
|
See L<Git::DescribeVersion/OPTIONS>. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
You can also set the C<V> environment variable to override the new version. |
97
|
|
|
|
|
|
|
This is useful if you need to bump to a specific version. For example, if |
98
|
|
|
|
|
|
|
the last tag is 0.005 and you want to jump to 1.000 you can set V = 1.000. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
$ V=1.000 dzil release |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 USAGE |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
B<Note>: Since L<Git::DescribeVersion> |
105
|
|
|
|
|
|
|
appends the third part to a two-part version tag |
106
|
|
|
|
|
|
|
(for example, a tag of C<v1.2> becomes C<v1.2.35>) |
107
|
|
|
|
|
|
|
This plugin is not designed to be combined with |
108
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::Git::Tag> |
109
|
|
|
|
|
|
|
(which will tag the repo with the generated version). |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
Instead it works better with manual tags. |
112
|
|
|
|
|
|
|
For example, you might manually increase the minor version |
113
|
|
|
|
|
|
|
(from C<v1.2> to C<v1.3>) when a big feature is added or the API changes. |
114
|
|
|
|
|
|
|
Then each build will append the number of commits as the revision number |
115
|
|
|
|
|
|
|
(C<v1.3> becomes C<v1.3.28>). |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This is probably more useful for projects without formal releases. |
118
|
|
|
|
|
|
|
This is in fact the only way that the author still uses the module: |
119
|
|
|
|
|
|
|
For C<$work> projects where builds are deployed often |
120
|
|
|
|
|
|
|
to a variety of internal environments. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
For projects released to the world I suggest using the simple and logical |
123
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::Git::NextVersion> |
124
|
|
|
|
|
|
|
which does work nicely with |
125
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::Git::Tag>. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=for Pod::Coverage provide_version |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 SEE ALSO |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=over 4 |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
L<Git::DescribeVersion> |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item * |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
L<Dist::Zilla> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=item * |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
L<Dist::Zilla::Plugin::Git::NextVersion> |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=back |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 SUPPORT |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 Perldoc |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
perldoc Dist::Zilla::Plugin::Git::DescribeVersion |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head2 Websites |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
The following websites have more information about this module, and may be of help to you. As always, |
158
|
|
|
|
|
|
|
in addition to those websites please use your favorite search engine to discover more resources. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=over 4 |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item * |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Search CPAN |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
The default CPAN search engine, useful to view POD in HTML format. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
L<http://search.cpan.org/dist/Dist-Zilla-Plugin-Git-DescribeVersion> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item * |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
RT: CPAN's Bug Tracker |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
The RT ( Request Tracker ) website is the default bug/issue tracking system for CPAN. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Dist-Zilla-Plugin-Git-DescribeVersion> |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item * |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
CPAN Ratings |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
The CPAN Ratings is a website that allows community ratings and reviews of Perl modules. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
L<http://cpanratings.perl.org/d/Dist-Zilla-Plugin-Git-DescribeVersion> |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item * |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
CPAN Testers |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
L<http://www.cpantesters.org/distro/D/Dist-Zilla-Plugin-Git-DescribeVersion> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item * |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
CPAN Testers Matrix |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
L<http://matrix.cpantesters.org/?dist=Dist-Zilla-Plugin-Git-DescribeVersion> |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item * |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
CPAN Testers Dependencies |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
The CPAN Testers Dependencies is a website that shows a chart of the test results of all dependencies for a distribution. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
L<http://deps.cpantesters.org/?module=Dist::Zilla::Plugin::Git::DescribeVersion> |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=back |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Please report any bugs or feature requests by email to C<bug-dist-zilla-plugin-git-describeversion at rt.cpan.org>, or through |
215
|
|
|
|
|
|
|
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dist-Zilla-Plugin-Git-DescribeVersion>. You will be automatically notified of any |
216
|
|
|
|
|
|
|
progress on the request by the system. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head2 Source Code |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
L<https://github.com/rwstauner/Dist-Zilla-Plugin-Git-DescribeVersion> |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
git clone https://github.com/rwstauner/Dist-Zilla-Plugin-Git-DescribeVersion.git |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head1 AUTHOR |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Randy Stauner <rwstauner@cpan.org> |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
This software is copyright (c) 2010 by Randy Stauner. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
234
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=cut |
237
|
|
|
|
|
|
|
|