| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#=============================================================================== |
|
2
|
|
|
|
|
|
|
# FILE: Dist::Zilla::Plugin::VersionFromScript |
|
3
|
|
|
|
|
|
|
# ABSTRACT: run command line script to provide version number |
|
4
|
|
|
|
|
|
|
# DERIVED FROM: Dist::Zilla::Plugin::AutoVersion by Ricardo SIGNES <rjbs@cpan.org> |
|
5
|
|
|
|
|
|
|
# AUTHOR: Reid Augustin (REID), <reid@lucidport.com> |
|
6
|
|
|
|
|
|
|
our $VERSION = '0.017'; # VERSION: 1.0 |
|
7
|
|
|
|
|
|
|
# CREATED: 12/02/2010 08:51:22 AM PST |
|
8
|
|
|
|
|
|
|
#=============================================================================== |
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
19748
|
use 5.002; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
31
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
27
|
|
|
12
|
1
|
|
|
1
|
|
10
|
use warnings; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
48
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
package Dist::Zilla::Plugin::VersionFromScript; |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
553
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
with( |
|
18
|
|
|
|
|
|
|
'Dist::Zilla::Role::VersionProvider', |
|
19
|
|
|
|
|
|
|
'Dist::Zilla::Role::TextTemplate', |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.017'; # VERSION |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has script => ( |
|
25
|
|
|
|
|
|
|
is => 'ro', |
|
26
|
|
|
|
|
|
|
isa => 'Str', |
|
27
|
|
|
|
|
|
|
required => 1, |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub provide_version { |
|
31
|
|
|
|
|
|
|
my ($self) = @_; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $script = $self->script; |
|
34
|
|
|
|
|
|
|
my $version = `$script`; |
|
35
|
|
|
|
|
|
|
chomp $version; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$self->log_debug([ 'providing version %s', $version ]); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
return $version; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
43
|
|
|
|
|
|
|
no Moose; |
|
44
|
|
|
|
|
|
|
1; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=pod |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 NAME |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Dist::Zilla::Plugin::VersionFromScript - run command line script to provide version number |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 VERSION |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
version 0.017 |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This plugin performs the Dist::Zilla::Role::VersionProvider role. It |
|
61
|
|
|
|
|
|
|
runs a user-provided shell script and uses the output as Dist::Zilla's |
|
62
|
|
|
|
|
|
|
version. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This module installs a couple of small perl scripts by way of example. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
svnversion.pl gets the current Subversion version of your project and |
|
67
|
|
|
|
|
|
|
adjusts it to be a useful version number. To use it, add this to your |
|
68
|
|
|
|
|
|
|
dist.ini file: |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
[VersionFromScript] |
|
71
|
|
|
|
|
|
|
script = svnversion.pl |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
git-logs2version.pl counts the number of git log entries (commits) to |
|
74
|
|
|
|
|
|
|
find the version number. This versioning scheme can work in certain |
|
75
|
|
|
|
|
|
|
limited workflows. Add this to dist.ini: |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
[VersionFromScript] |
|
78
|
|
|
|
|
|
|
script = git-logs2version.pl |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Both svnversion.pl and git-logs2version.pl can take arguments of: |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
--major number # add a major revision number |
|
83
|
|
|
|
|
|
|
--offset number # add offset to the minor revision |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
So for example, if you are at revision 50, calling |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
[VersionFromScript] |
|
88
|
|
|
|
|
|
|
script = svnversion.pl --major 3 --offset 22 |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
produces 3.072 as the version number. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Reid Augustin <reid@hellosix.com> |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This software is copyright (c) 2011 by Reid Augustin. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
101
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|