TagVersion/App.pm

filter: Statementstmt 52.0% 26 / 50 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 2 / 7 Podpod 0.0% 0 / 5 totaltotal 37.8% 28 / 74 CC 8 SCAR 26.1
CC
8
Cov
42%
run
30.0
print_next_version
6.0
print_last_version
6.0
CRAP 13.6
« TagVersion.pm ↑ Summary
1 package Git::TagVersion::App;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = '1.00'; # VERSION
7 # ABSTRACT: commandline wrapper for Git::TagVersion
8  
9 1 extends 'Git::TagVersion';
10 1 with 'MooseX::Getopt';
11  
12 1 has '+root' => ( traits => [ 'NoGetopt' ] );
13 1 has '+repo' => ( traits => [ 'NoGetopt' ] );
14 1 has '+last_version' => ( traits => [ 'NoGetopt' ] );
15 1 has '+version_regex' => ( traits => [ 'NoGetopt' ] );
16 1 has '+versions' => ( traits => [ 'NoGetopt' ] );
17 1 has '+next_version' => ( traits => [ 'NoGetopt' ] );
18  
19 1 has '+fetch' => (
20 traits => [ 'Getopt' ],
21 cmd_aliases => 'f',
22 documentation => 'fetch remote refs before finding last version',
23 );
24  
25 1 has '+push' => (
26 traits => [ 'Getopt' ],
27 cmd_aliases => 'p',
28 documentation => 'push new created tag to remote',
29 );
30  
31 1 has 'all' => (
32 is => 'ro', isa => 'Bool', default => 0,
33 traits => [ 'Getopt' ],
34 cmd_aliases => [ 'a', 'list-all' ],
35 documentation => 'list all existing versions',
36 );
37  
38 1 has 'last' => (
39 is => 'ro', isa => 'Bool', default => 0,
40 traits => [ 'Getopt' ],
41 cmd_aliases => [ 'l', 'last-version' ],
42 documentation => 'display last version',
43 );
44  
45 1 subtype 'IncrOption' => as 'Int';
46  
47 1 MooseX::Getopt::OptionTypeMap->add_option_type_to_map(
48 'IncrOption' => '+'
49 );
50  
51 1 has '+incr_level' => (
52 is => 'ro', isa => 'IncrOption', default => 0,
53 traits => [ 'Getopt' ],
54 cmd_aliases => [ 'major', 'm' ],
55 documentation => 'do a (more) major release',
56 );
57  
58 1 has '+add_level' => (
59 is => 'ro', isa => 'IncrOption', default => 0,
60 traits => [ 'Getopt' ],
61 cmd_aliases => [ 'minor' ],
62 documentation => 'add a new minor version level',
63 );
64  
65 1 has 'next' => (
66 is => 'ro', isa => 'Bool', default => 0,
67 traits => [ 'Getopt' ],
68 cmd_aliases => [ 'n', 'next-version' ],
69 documentation => 'display next version',
70 );
71  
72 1 has 'tag' => (
73 is => 'ro', isa => 'Bool', default => 0,
74 traits => [ 'Getopt' ],
75 cmd_aliases => [ 't', 'tag-next-version' ],
76 documentation => 'create tag for next version',
77 );
78  
79 sub run {
80 0 ▶ my $self = shift;
Subroutine run: not called CC=5 SCAR=34.0
Pod undocumented
81  
82 0 ▶ if( $self->all ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($self->all) { } 0 0 0
elsif ($self->last) { } 0 0 0
elsif ($self->next) { } 0 0 0
elsif ($self->tag) { } 0 0 0
83 0 $self->print_versions;
84 } elsif( $self->last ) {
85 0 $self->print_last_version
86 } elsif( $self->next ) {
87 0 $self->print_next_version
88 } elsif( $self->tag ) {
89 0 $self->print_tag_next_version
90 }
91  
92 0 return;
93 }
94  
95 sub print_tag_next_version {
96 0 ▶ my $self = shift;
Subroutine print_tag_next_version: not called CC=1 SCAR=6.9
Pod undocumented
97  
98 0 my $tag = $self->tag_next_version;
99 0 print "tagged $tag\n";
100  
101 0 return;
102 }
103  
104 sub print_next_version {
105 0 ▶ my $self = shift;
Subroutine print_next_version: not called CC=2 SCAR=17.9
Pod undocumented
106  
107 0 ▶ if( defined $self->next_version ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->next_version) 0 0 0
108 0 print $self->next_version->as_string."\n";
109 }
110  
111 0 return;
112 }
113  
114 sub print_last_version {
115 0 ▶ my $self = shift;
Subroutine print_last_version: not called CC=2 SCAR=17.9
Pod undocumented
116  
117 0 ▶ if( defined $self->last_version ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->last_version) 0 0 0
118 0 print $self->last_version->as_string."\n";
119 }
120  
121 0 return;
122 }
123  
124 sub print_versions {
125 0 ▶ my $self = shift;
Subroutine print_versions: not called CC=2 SCAR=17.9
Pod undocumented
126  
127 0 foreach my $v ( @{$self->versions} ) {
128 0 print $v->as_string."\n";
129 }
130  
131 0 return;
132 }
133  
134 1 1;
135  
136 __END__
137  
138 =pod
139  
140 =encoding UTF-8
141  
142 =head1 NAME
143  
144 Git::TagVersion::App - commandline wrapper for Git::TagVersion
145  
146 =head1 VERSION
147  
148 version 1.00
149  
150 =head1 AUTHOR
151  
152 Markus Benning <ich@markusbenning.de>
153  
154 =head1 COPYRIGHT AND LICENSE
155  
156 This software is copyright (c) 2015 by Markus Benning <me@w3r3wolf.de>.
157  
158 This is free software; you can redistribute it and/or modify it under
159 the same terms as the Perl 5 programming language system itself.
160  
161 =cut
« TagVersion.pm ↑ Summary