| 1 | package Minilla::Release::CheckChanges; | ||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 4 | 2 | ▶ | use utf8; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 5 | 2 | ▶ | use ExtUtils::MakeMaker qw(prompt); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 6 | |||||||||||||||||||
| 7 | 2 | ▶ | use Minilla::Changes; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 8 | 2 | ▶ | use Minilla::Util qw(edit_file slurp is_interactive); | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 9 | 2 | ▶ | use Minilla::Logger; | ||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||
| 10 | |||||||||||||||||||
| 11 | 7 | ▶ | sub run { | ||||||||||||||||
|
Subroutine
run: called CC=9 SCAR=22.2
Pod
undocumented
| |||||||||||||||||||
| 12 | 7 | my ($self, $project, $opts) = @_; | |||||||||||||||||
| 13 | |||||||||||||||||||
| 14 | 7 | my $version = $project->version; | |||||||||||||||||
| 15 | |||||||||||||||||||
| 16 | 7 | ▶ | if ($ENV{PERL_MINILLA_SKIP_CHECK_CHANGE_LOG}) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 17 | 0 | infof("Okay, you are debugging now.\n"); | |||||||||||||||||
| 18 | 0 | return; | |||||||||||||||||
| 19 | } | ||||||||||||||||||
| 20 | |||||||||||||||||||
| 21 | 7 | while (1) { | |||||||||||||||||
| 22 | 8 | my $changes = slurp('Changes'); | |||||||||||||||||
| 23 | 8 | ▶ | last if Minilla::Changes::is_prepared($changes, $version); | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 24 | 7 | ▶ | last if $changes =~ /^\{\{\$NEXT\}\}\h*\R+\h+\S/m; | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 25 | |||||||||||||||||||
| 26 | # Tell the user what the problem is | ||||||||||||||||||
| 27 | 5 | ▶ | if ($changes !~ /\{\{\$NEXT\}\}/m) { | ||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||
| 28 | 1 | infof("No mention of {{\$NEXT}} in changelog file 'Changes'\n"); | |||||||||||||||||
| 29 | } elsif ($changes !~ /^\{\{\$NEXT\}\}/m) { | ||||||||||||||||||
| 30 | 1 | infof("{{\$NEXT}} must be at the beginning of a line in changelog file 'Changes'\n"); | |||||||||||||||||
| 31 | } elsif ($changes !~ /^\{\{\$NEXT\}\}\h*\R/m) { | ||||||||||||||||||
| 32 | 1 | infof("{{\$NEXT}} in changelog file 'Changes' must be the only non-whitespace on its line\n"); | |||||||||||||||||
| 33 | } else { | ||||||||||||||||||
| 34 | 2 | infof("{{\$NEXT}} in changelog file 'Changes' must be followed by at least one indented line describing a change\n"); | |||||||||||||||||
| 35 | } | ||||||||||||||||||
| 36 | |||||||||||||||||||
| 37 | 5 | ▶ | unless (is_interactive()) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 38 | 4 | warnf("Skipping Changes editing because standard input is not a terminal.\n"); | |||||||||||||||||
| 39 | 4 | return; | |||||||||||||||||
| 40 | } | ||||||||||||||||||
| 41 | |||||||||||||||||||
| 42 | 1 | ▶ | if (prompt("Edit file?", 'y') =~ /y/i) { | ||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||
| 43 | 1 | edit_file('Changes'); | |||||||||||||||||
| 44 | } else { | ||||||||||||||||||
| 45 | 0 | errorf("Giving up!\n"); | |||||||||||||||||
| 46 | } | ||||||||||||||||||
| 47 | } | ||||||||||||||||||
| 48 | } | ||||||||||||||||||
| 49 | |||||||||||||||||||
| 50 | 2 | 1; | |||||||||||||||||