File Coverage

blib/lib/Minilla/Release/CheckReleaseBranch.pm
Criterion Covered Total %
statement 12 19 63.1
branch 0 4 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 29 55.1


line stmt bran cond sub pod time code
1             package Minilla::Release::CheckReleaseBranch;
2 1     1   1114 use strict;
  1         2  
  1         27  
3 1     1   5 use warnings;
  1         2  
  1         28  
4 1     1   5 use utf8;
  1         2  
  1         11  
5 1     1   21 use Minilla::Logger;
  1         2  
  1         175  
6              
7             sub run {
8 0     0 0   my ($self, $project, $opts) = @_;
9              
10             # The checking only performs when the config explicitly sets the release branch.
11             # That's why we don't use "$project->release_branch".
12 0           my $release_branch = $project->config->{release}->{branch};
13 0 0         return unless $release_branch;
14              
15 0           my $current_branch = `git rev-parse --abbrev-ref HEAD`;
16 0           chomp $current_branch;
17 0 0         unless ($current_branch eq $release_branch) {
18 0           errorf("Release branch must be $release_branch.\n");
19             }
20             }
21              
22             1;
23