lib/Dist/Zilla/Plugin/VersionFromScript.pm

filter: Statementstmt 76.9% 20 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 75.7% 25 / 33 CC 1 SCAR 1.5
CC
1
Cov
77%
provide_version
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« script/svnversion.pl ↑ Summary
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 1 our $VERSION = '0.017'; # VERSION: 1.0
7 # CREATED: 12/02/2010 08:51:22 AM PST
8 #===============================================================================
9  
10 1 ▶use 5.002;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 package Dist::Zilla::Plugin::VersionFromScript;
15  
16 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 with(
18 'Dist::Zilla::Role::VersionProvider',
19 'Dist::Zilla::Role::TextTemplate',
20 );
21  
22 1 our $VERSION = '0.017'; # VERSION
23  
24 1 has script => (
25 is => 'ro',
26 isa => 'Str',
27 required => 1,
28 );
29  
30 0 ▶sub provide_version {
Subroutine provide_version: not called CC=1 SCAR=6.9
Pod undocumented
31 0 my ($self) = @_;
32  
33 0 my $script = $self->script;
34 0 my $version = `$script`;
35 0 chomp $version;
36  
37 0 $self->log_debug([ 'providing version %s', $version ]);
38  
39 0 return $version;
40 }
41  
42 1 __PACKAGE__->meta->make_immutable;
43 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 1 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__
« script/svnversion.pl ↑ Summary