| 1 | package Minilla::Release::Commit; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Minilla::Util qw(find_file cmd); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Minilla::Logger; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 0 | ▶ | sub run { | ||||||||
|
Subroutine
run: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 10 | 0 | my ($self, $project, $opts) = @_; | |||||||||
| 11 | |||||||||||
| 12 | 0 | my @modified_files = split /\0/, `git ls-files --deleted --modified -z`; | |||||||||
| 13 | 0 | ▶ | return if @modified_files == 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | |||||||||||
| 15 | 0 | $project->clear_metadata(); | |||||||||
| 16 | 0 | my $ver = $project->metadata->version; | |||||||||
| 17 | |||||||||||
| 18 | 0 | my $msg = "Checking in changes prior to tagging of version $ver."; | |||||||||
| 19 | 0 | ▶ | if ($project->manage_changes) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 0 | $msg .= "\n\nChangelog diff is:\n\n"; | |||||||||
| 21 | 0 | $msg .= `git diff Changes`; | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | if ($opts->{dry_run}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 0 | infof("DRY-RUN. Would have committed message of:\n----------------\n$msg\n-----------\n"); | |||||||||
| 26 | 0 | return; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 0 | cmd('git', 'commit', '-a', '-m', $msg, '--cleanup=verbatim'); | |||||||||
| 30 | |||||||||||
| 31 | 0 | $self->_push_to_origin(); | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | sub _push_to_origin { | ||||||||
|
Subroutine
_push_to_origin: not called CC=2 SCAR=17.9
| |||||||||||
| 35 | 0 | my ($self) = @_; | |||||||||
| 36 | |||||||||||
| 37 | # git v1.7.10 is required? | ||||||||||
| 38 | 0 | ▶ | my $branch = `git symbolic-ref --short HEAD` | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | or return; | ||||||||||
| 40 | 0 | $branch =~ s/\n//g; | |||||||||
| 41 | 0 | infof("Pushing to origin\n"); | |||||||||
| 42 | 0 | cmd('git', 'push', 'origin', $branch); | |||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | 1 | 1; | |||||||||