File Coverage

blib/lib/Git/TagVersion/Cmd/Command/tag.pm
Criterion Covered Total %
statement 3 12 25.0
branch 0 4 0.0
condition n/a
subroutine 1 2 50.0
pod 1 1 100.0
total 5 19 26.3


line stmt bran cond sub pod time code
1             package Git::TagVersion::Cmd::Command::tag;
2              
3 1     1   1355 use Moose;
  1         2  
  1         59  
4              
5             extends 'Git::TagVersion::Cmd::Command';
6              
7             our $VERSION = '1.01'; # VERSION
8             # ABSTRACT: create a new version tag
9              
10             has 'push' => (
11             is => 'rw', isa => 'Bool', default => 0,
12             traits => [ 'Getopt' ],
13             cmd_aliases => 'p',
14             documentation => 'push new created tag to remote',
15             );
16              
17             has 'major' => (
18             is => 'ro', isa => 'IncrOption', default => 0,
19             traits => [ 'Getopt' ],
20             cmd_aliases => [ 'm' ],
21             documentation => 'do a (more) major release',
22             );
23              
24             has 'minor' => (
25             is => 'ro', isa => 'IncrOption', default => 0,
26             traits => [ 'Getopt' ],
27             documentation => 'add a new minor version level',
28             );
29              
30             sub execute {
31 0     0 1   my ( $self, $opt, $args ) = @_;
32              
33 0           $self->last_version->push( $self->push );
34 0 0         if( $self->major ) {
35 0           $self->tag_version->incr_level( $self->major );
36             }
37 0 0         if( $self->minor ) {
38 0           $self->tag_version->add_level( $self->minor );
39             }
40            
41 0           my $tag = $self->tag_next_version;
42 0           print "tagged $tag\n";
43              
44 0           return;
45             }
46              
47             1;
48              
49             __END__
50              
51             =pod
52              
53             =encoding UTF-8
54              
55             =head1 NAME
56              
57             Git::TagVersion::Cmd::Command::tag - create a new version tag
58              
59             =head1 VERSION
60              
61             version 1.01
62              
63             =head1 AUTHOR
64              
65             Markus Benning <ich@markusbenning.de>
66              
67             =head1 COPYRIGHT AND LICENSE
68              
69             This software is copyright (c) 2015 by Markus Benning <ich@markusbenning.de>.
70              
71             This is free software; you can redistribute it and/or modify it under
72             the same terms as the Perl 5 programming language system itself.
73              
74             =cut