| 1 | package App::ModuleBuildTiny; | ||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.014; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | our $VERSION = '0.051'; | |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Exporter 5.57 'import'; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | our @EXPORT = qw/modulebuildtiny/; | |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Config; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use CPAN::Meta; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use Data::Section::Simple 'get_data_section'; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Encode qw/encode_utf8 decode_utf8/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use ExtUtils::Manifest 1.75 qw/manifind maniskip maniread/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use File::Basename qw/dirname/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use File::Path qw/mkpath/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use File::Slurper qw/write_text write_binary read_binary/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use File::Spec::Functions qw/catfile rel2abs/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use Getopt::Long 2.36 'GetOptionsFromArray'; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use JSON::MaybeXS qw/decode_json/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Module::Runtime 'require_module'; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Text::Template; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use App::ModuleBuildTiny::Dist; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use Env qw/$AUTHOR_TESTING $RELEASE_TESTING $AUTOMATED_TESTING $EXTENDED_TESTING $NONINTERACTIVE_TESTING $SHELL $HOME $USERPROFILE/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | Getopt::Long::Configure(qw/require_order gnu_compat bundling/); | |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub prompt { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prompt: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my($mess, $def) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my $dispdef = defined $def ? " [$def]" : ""; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | local $|=1; | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | local $\; | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | print "$mess$dispdef "; | |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | my $ans = <STDIN> // ''; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
readline STDIN // ""
MC/DC0%0/1
readline STDIN // ""
readline STDIN
Truth table0%0/2
A
A= readline STDIN
| |||||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | chomp $ans; | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | return $ans ne '' ? decode_utf8($ans) : $def // ''; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$def // ""
MC/DC0%0/1
$def // ""
$def
Truth table0%0/2
A
A= $def
| |||||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub prompt_yn { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prompt_yn: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | my ($description, $default) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | my $result; | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | do { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
length $result and not $result =~ /^(y|n|-)/iu
MC/DC0%0/2
length $result and not $result =~ /^(y|n|-)/iu
length $result
not $result =~ /^(y|n|-)/iu
Truth table0%0/3
A and not(B)
A= length $resultB= not $result =~ /^(y|n|-)/iu
| |||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | $result = prompt("$description [y/n]", $default ? 'y' : 'n'); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 49 | } while (length $result and $result !~ /^(y|n|-)/i); | ||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | return lc(substr $result, 0 , 1) eq 'y'; | |||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub create_license_for { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_license_for: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my ($license_name, $author) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | my $module = "Software::License::$license_name"; | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | require_module($module); | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | return $module->new({ holder => $author }); | |||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub fill_in { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fill_in: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | my ($template, $hash) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | return Text::Template->new(TYPE => 'STRING', SOURCE => $template)->fill_in(HASH => $hash); | |||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub write_module { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_module: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | my %opts = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my $template = get_data_section('Module.pm') =~ s/ ^ % (\w+) /=$1/gxmsr; | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my $filename = catfile('lib', split /::/, $opts{module_name}) . '.pm'; | |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my $content = fill_in($template, \%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | mkpath(dirname($filename)); | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | write_text($filename, $content); | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | return $filename; | |||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub write_changes { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_changes: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | my %opts = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my $template = get_data_section('Changes'); | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my $content = fill_in($template, \%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | write_text('Changes', $content); | |||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub write_maniskip { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_maniskip: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my $distname = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | write_text('MANIFEST.SKIP', "#!include_default\n$distname-.*\nREADME.pod\n"); | |||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub write_readme { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_readme: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | my %opts = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | my $template = get_data_section('README'); | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | write_text('README', fill_in($template, \%opts)); | |||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sub read_json { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read_json: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my $filename = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | -f $filename or return; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | return decode_json(read_binary($filename)); | |||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | sub write_json { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write_json: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my ($filename, $content) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $dirname = dirname($filename); | |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | mkdir $dirname if not -d $dirname; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $json = JSON::MaybeXS->new->utf8->pretty->canonical->encode($content); | |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | return write_binary($filename, $json); | |||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | sub bump_versions { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bump_versions: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my (%opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | require App::RewriteVersion; | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | my $app = App::RewriteVersion->new(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my $trial = delete $opts{trial}; | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | my $new_version = defined $opts{version} ? delete $opts{version} : $app->bump_version($app->current_version); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $app->rewrite_versions($new_version, is_trial => $trial); | |||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | sub insert_options { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert_options: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my ($opts, $config) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $opts->{add_repository} = !!$config->{auto_repo}; | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $opts->{add_bugtracker} = !!$config->{auto_tracker}; | |||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | ▶ | sub regenerate { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
regenerate: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my ($files, $config, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my %files = map { $_ => 1 } @{$files}; | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my @dirty = @{$files}; | |||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ($opts{bump}) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | bump_versions(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $files{'Changes'}++; | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | push @dirty, 'Changes'; | |||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | insert_options(\%opts, $config); | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $dist = App::ModuleBuildTiny::Dist->new(%opts, regenerate => \%files); | |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | my @generated = grep { $files{$_} } $dist->files; | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | for my $filename (@generated) { | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | ▶ | say "Updating $filename" if $opts{verbose}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | write_binary($filename, $dist->get_file($filename)) if !$opts{dry_run}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | if ($opts{commit}) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | require Git::Wrapper; | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $git = Git::Wrapper->new('.'); | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | if ($opts{bump}) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | push @dirty, 'lib'; | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | push @dirty, 'script' if -d 'script'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $allowed = join '|', map qr{^\Q$_\E$}, @dirty; | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my @modified = grep /$allowed/, $git->ls_files({ modified => 1 }); | |||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | if (@modified) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my @changes = $dist->get_changes; | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | my $version = 'v' . $dist->version; | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | my $message = $opts{message} || ($opts{bump} ? join '', $version, "\n\n", @changes : 'Regenerate'); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$opts{'message'} || ($opts{'bump'} ? join('', $version, "\n\n", @changes) : 'Regenerate')
MC/DC0%0/2
$opts{'message'} || ($opts{'bump'} ? join('', $version, "\n\n", @changes) : 'Regenerate')
$opts{'message'}
($opts{'bump'} ? join('', $version, "\n\n", @changes) : 'Regenerate')
Truth table0%0/3
A || B
A= $opts{'message'}B= ($opts{'bump'} ? join('', $version, "\n\n", @changes) : 'Regenerate')
| |||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $git->commit({ m => $message }, @dirty); | |||||||||||||||||||||||||||||||||||||||||||
| 156 | } else { | ||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | say "No modifications to commit"; | |||||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | my %prompt_for = ( | |||||||||||||||||||||||||||||||||||||||||||
| 163 | open => \&prompt, | ||||||||||||||||||||||||||||||||||||||||||||
| 164 | yn => \&prompt_yn, | ||||||||||||||||||||||||||||||||||||||||||||
| 165 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||
| 167 | 1 | my @config_items = ( | |||||||||||||||||||||||||||||||||||||||||||
| 168 | [ 'author' , 'What is the author\'s name?', 'open' ], | ||||||||||||||||||||||||||||||||||||||||||||
| 169 | [ 'email' , 'What is the author\'s email?', 'open', ], | ||||||||||||||||||||||||||||||||||||||||||||
| 170 | [ 'license' , 'What license do you want to use?', 'open', 'Perl_5' ], | ||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | [ 'write_buildpl' , 'Do you want to write your Build.PL file to your filesystem?', 'yn', !!1], | ||||||||||||||||||||||||||||||||||||||||||||
| 173 | [ 'write_meta' , 'Do you want to write your meta files to your filesystem?', 'yn', !!1], | ||||||||||||||||||||||||||||||||||||||||||||
| 174 | [ 'write_manifest', 'Do you want to write your manifest files to your filesystem?', 'yn', !!1], | ||||||||||||||||||||||||||||||||||||||||||||
| 175 | [ 'write_license' , 'Do you want to write your LICENSE file to your filesystem?', 'yn', !!1], | ||||||||||||||||||||||||||||||||||||||||||||
| 176 | [ 'write_readme' , 'Do you want to write your README file to your filesystem?', 'yn', !!1], | ||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||
| 178 | [ 'auto_git' , 'Do you want mbtiny to automatically handle git for you?', 'yn', !!1 ], | ||||||||||||||||||||||||||||||||||||||||||||
| 179 | [ 'auto_bump' , 'Do you want mbtiny to automatically bump on regenerate for you?', 'yn', !!1 ], | ||||||||||||||||||||||||||||||||||||||||||||
| 180 | [ 'auto_scan' , 'Do you want mbtiny to automatically scan dependencies for you?', 'yn', !!1 ], | ||||||||||||||||||||||||||||||||||||||||||||
| 181 | [ 'auto_repo' , 'Do you want mbtiny to automatically add a repository link to the metadata', 'yn', !!1 ], | ||||||||||||||||||||||||||||||||||||||||||||
| 182 | [ 'auto_tracker' , 'Do you want mbtiny to automatically add a bugtracker link to the metadata', 'yn', !!1 ], | ||||||||||||||||||||||||||||||||||||||||||||
| 183 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | my %fallback_config = ( | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 'write_buildpl' => 'write_build', | ||||||||||||||||||||||||||||||||||||||||||||
| 187 | 'write_meta' => 'write_build', | ||||||||||||||||||||||||||||||||||||||||||||
| 188 | 'write_manifest' => 'write_build', | ||||||||||||||||||||||||||||||||||||||||||||
| 189 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | my @delete_config = qw/write_build/; | |||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | sub ask { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ask: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | my ($config, $item, $local_default) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my ($key, $description, $type, $global_default) = @{$item}; | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | my $value = $prompt_for{$type}->($description, $local_default // $global_default); | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$local_default // $global_default
MC/DC0%0/2
$local_default // $global_default
$local_default
$global_default
Truth table0%0/3
A // B
A= $local_defaultB= $global_default
| |||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ($value ne '-') { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | $config->{$key} = $type eq 'open' ? $value : $value ? JSON::MaybeXS::true : JSON::MaybeXS::false; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 201 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | delete $config->{$key}; | |||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | sub show_item { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
show_item: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my ($config, $key, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | return defined $config->{$key} ? $type eq 'open' ? $config->{$key} : $config->{$key} ? 'true' : 'false' : '(undefined)'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | sub get_settings_file { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_settings_file: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | ▶ | local $HOME = $USERPROFILE if $^O eq 'MSWin32'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | return catfile(glob('~'), qw/.mbtiny conf/); | |||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | 1 | my %default_settings = ( | |||||||||||||||||||||||||||||||||||||||||||
| 217 | auto_bump => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 218 | auto_git => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 219 | auto_scan => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||
| 221 | write_build => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 222 | write_license => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 223 | write_readme => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 224 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | sub get_settings { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_settings: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | my $default = shift // {}; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() // {}
MC/DC0%0/1
shift() // {}
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my $settings_file = get_settings_file; | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | my $settings = -f $settings_file ? read_json($settings_file) : $default; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | for my $item (@config_items) { | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my ($key, $description, $type, $default) = @{$item}; | |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | next unless exists $settings->{$key}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | ▶ | next unless $type eq 'yn'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | $settings->{$key} = !!$settings->{$key}; | |||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | return $settings; | |||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | my $config_file = 'dist.json'; | |||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | sub get_config { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_config: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | my $config = -f $config_file ? read_json($config_file) : {}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | for my $item (@config_items) { | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my ($key, $description, $type, $default) = @{$item}; | |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | next unless exists $config->{$key}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | next unless $type eq 'yn'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | $config->{$key} = !!$config->{$key}; | |||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | return $config; | |||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | ▶ | sub extra_tests { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extra_tests: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | my @dirs; | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | if ($AUTHOR_TESTING) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | push @dirs, 'xt/author'; | |||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | push @dirs, glob 'xt/*.t'; | |||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | push @dirs, 'xt/release' if $RELEASE_TESTING; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | push @dirs, 'xt/extended' if $EXTENDED_TESTING; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | return grep -e, @dirs; | |||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||
| 263 | 1 | my @meta_files = qw/META.json META.yml/; | |||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | sub regenerate_files { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
regenerate_files: not called CC=14 SCAR=53.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | my $config = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my @result; | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | ▶ | push @result, 'Build.PL' if $config->{write_buildpl} // $config->{write_build} // 1; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
($config->{"write_buildpl"} // $config->{"write_build"}) // 1
$config->{"write_buildpl"} // $config->{"write_build"}
MC/DC0%0/2
($config->{"write_buildpl"} // $config->{"write_build"}) // 1
$config->{"write_buildpl"}
$config->{"write_build"}
Truth table0%0/3
A // B
A= $config->{"write_buildpl"}B= $config->{"write_build"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | ▶ | push @result, @meta_files if $config->{write_meta} // $config->{write_build} // 1; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
($config->{"write_meta"} // $config->{"write_build"}) // 1
$config->{"write_meta"} // $config->{"write_build"}
MC/DC0%0/2
($config->{"write_meta"} // $config->{"write_build"}) // 1
$config->{"write_meta"}
$config->{"write_build"}
Truth table0%0/3
A // B
A= $config->{"write_meta"}B= $config->{"write_build"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | push @result, 'MANIFEST' if $config->{write_manifest} // $config->{write_build} // 1; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
($config->{"write_manifest"} // $config->{"write_build"}) // 1
$config->{"write_manifest"} // $config->{"write_build"}
MC/DC0%0/2
($config->{"write_manifest"} // $config->{"write_build"}) // 1
$config->{"write_manifest"}
$config->{"write_build"}
Truth table0%0/3
A // B
A= $config->{"write_manifest"}B= $config->{"write_build"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | ▶ | push @result, 'LICENSE' if $config->{write_license} // 1; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$config->{"write_license"} // 1
MC/DC0%0/1
$config->{"write_license"} // 1
$config->{"write_license"}
Truth table0%0/2
A
A= $config->{"write_license"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | push @result, 'README' if $config->{write_readme} // 1; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$config->{"write_readme"} // 1
MC/DC0%0/1
$config->{"write_readme"} // 1
$config->{"write_readme"}
Truth table0%0/2
A
A= $config->{"write_readme"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | return @result; | |||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | 1 | my %boolean = ( | |||||||||||||||||||||||||||||||||||||||||||
| 277 | true => !!1, | ||||||||||||||||||||||||||||||||||||||||||||
| 278 | false => !!0, | ||||||||||||||||||||||||||||||||||||||||||||
| 279 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||
| 281 | my %actions = ( | ||||||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | dist => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 283 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | GetOptionsFromArray(\@arguments, \my %opts, qw/trial verbose!/) or return 2; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my $dist = App::ModuleBuildTiny::Dist->new(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | insert_options(\%opts, get_config); | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | ▶ | die "Trial mismatch" if $opts{trial} && $dist->release_status ne 'testing'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$opts{"trial"} and $dist->release_status ne "testing"
MC/DC0%0/2
$opts{"trial"} and $dist->release_status ne "testing"
$opts{"trial"}
$dist->release_status ne "testing"
Truth table0%0/3
A and B
A= $opts{"trial"}B= $dist->release_status ne "testing"
| |||||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $dist->preflight_check(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my $filename = $dist->archivename; | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | printf "tar czf %s %s\n", $filename, join ' ', $dist->files if $opts{verbose}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | $dist->write_tarball($filename); | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 293 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | distdir => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | ▶ | GetOptionsFromArray(\@arguments, \my %opts, qw/trial verbose!/) or return 2; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | insert_options(\%opts, get_config); | |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my $dist = App::ModuleBuildTiny::Dist->new(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 299 | 0 | $dist->write_dir($dist->fullname, $opts{verbose}); | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 301 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | test => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | $AUTHOR_TESTING = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | GetOptionsFromArray(\@arguments, 'release!' => \$RELEASE_TESTING, 'author!' => \$AUTHOR_TESTING, 'automated!' => \$AUTOMATED_TESTING, | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 306 | 'extended!' => \$EXTENDED_TESTING, 'non-interactive!' => \$NONINTERACTIVE_TESTING, 'jobs|j=i' => \my $jobs, 'inc|I=s@' => \my @inc) | ||||||||||||||||||||||||||||||||||||||||||||
| 307 | or return 2; | ||||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | insert_options(\my %opts, get_config); | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | my $dist = App::ModuleBuildTiny::Dist->new(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | my @args; | |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | ▶ | push @args, '-j', $jobs if defined $jobs; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | push @args, map {; '-I', rel2abs($_) } @inc; | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | push @args, 't' if -e 't'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | push @args, extra_tests(); | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | return $dist->run(commands => [ [ 'prove', '-br', @args ] ], build => 1, verbose => 1); | |||||||||||||||||||||||||||||||||||||||||||
| 316 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | upload => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | my $config = get_config; | |||||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | ▶ | my %opts = $config->{auto_git} ? (tag => 1, push => '') : (); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | GetOptionsFromArray(\@arguments, \%opts, qw/trial config=s silent tag! push:s nopush|no-push/) or return 2; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | insert_options(\%opts, get_config); | |||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | my $dist = App::ModuleBuildTiny::Dist->new; | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | $dist->preflight_check(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | local ($AUTHOR_TESTING, $RELEASE_TESTING) = (1, 1); | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | my @commands = ([ './Build', 'test' ]); | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | my @extra_tests = extra_tests; | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | push @commands, [ 'prove', '-br', @extra_tests ] if @extra_tests; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | $dist->run(commands => \@commands, build => 1, verbose => !$opts{silent}) or return 1; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $sure = prompt_yn('Do you want to continue the release process?', !!0); | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | if ($sure) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | my $file = $dist->write_tarball($dist->archivename); | |||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | require CPAN::Upload::Tiny; | |||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | CPAN::Upload::Tiny->VERSION('0.009'); | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | my $uploader = CPAN::Upload::Tiny->new_from_config_or_stdin($opts{config}); | |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | $uploader->upload_file($file); | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | print "Successfully uploaded $file\n" if not $opts{silent}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if ($opts{tag}) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | require Git::Wrapper; | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | my $git = Git::Wrapper->new('.'); | |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my $version = 'v' . $dist->version; | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $git->tag('-m' => $version, $version); | |||||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | if (defined $opts{push} and not $opts{nopush}) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $opts{"push"} and not $opts{"nopush"}
MC/DC0%0/2
defined $opts{"push"} and not $opts{"nopush"}
defined $opts{"push"}
not $opts{"nopush"}
Truth table0%0/3
A and not(B)
A= defined $opts{"push"}B= not $opts{"nopush"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | require Git::Wrapper; | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $git = Git::Wrapper->new('.'); | |||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | ▶ | my @remote = length $opts{push} ? $opts{push} : (); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | $git->push(@remote); | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | $git->push({ tags => 1 }, @remote) if $opts{tag}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 358 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | run => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | die "No arguments given to run\n" if not @arguments; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | GetOptionsFromArray(\@arguments, 'build!' => \(my $build = 1), 'allow_failure|allow-failure!' => \my $allow_failure) or return 2; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | insert_options(\my %opts, get_config); | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | my $dist = App::ModuleBuildTiny::Dist->new(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | return $dist->run(commands => [ [ $SHELL ] ], build => $build, verbose => 0, allow_failure => $allow_failure); | |||||||||||||||||||||||||||||||||||||||||||
| 366 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | ▶ | shell => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | ▶ | GetOptionsFromArray(\@arguments, 'build!' => \my $build, 'allow_failure|allow-failure!' => \my $allow_failure) or return 2; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | insert_options(\my %opts, get_config); | |||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | my $dist = App::ModuleBuildTiny::Dist->new(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | return $dist->run(commands => [ [ $SHELL ] ], build => $build, verbose => 0, allow_failure => $allow_failure); | |||||||||||||||||||||||||||||||||||||||||||
| 373 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | ▶ | listdeps => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | GetOptionsFromArray(\@arguments, \my %opts, qw/json only_missing|only-missing|missing omit_core|omit-core=s author versions/) or return 2; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | insert_options(\%opts, get_config); | |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my $dist = App::ModuleBuildTiny::Dist->new(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | require CPAN::Meta::Prereqs::Filter; | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | my $prereqs = CPAN::Meta::Prereqs::Filter::filter_prereqs($dist->meta->effective_prereqs, %opts); | |||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | if (!$opts{json}) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | my @phases = qw/build test configure runtime/; | |||||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | push @phases, 'develop' if $opts{author}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my $reqs = $prereqs->merged_requirements(\@phases); | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | $reqs->clear_requirement('perl'); | |||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | my @modules = sort { lc $a cmp lc $b } $reqs->required_modules; | |||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | ▶ | if ($opts{versions}) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | say "$_ = ", $reqs->requirements_for_module($_) for @modules; | |||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 394 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | say for @modules; | |||||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 398 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | print JSON::MaybeXS->new->ascii->canonical->pretty->encode($prereqs->as_string_hash); | |||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 402 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | ▶ | regenerate => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | my $config = get_config; | |||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | my %opts; | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | ▶ | GetOptionsFromArray(\@arguments, \%opts, qw/trial bump! version=s verbose dry_run|dry-run commit! scan! message=s/) or return 2; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | ▶ | my @files = @arguments ? @arguments : regenerate_files($config); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | ▶ | if (!@arguments) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | $opts{bump} //= $config->{auto_bump}; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$opts{"bump"} //= $config->{"auto_bump"}
MC/DC0%0/2
$opts{"bump"} //= $config->{"auto_bump"}
$opts{"bump"}
$config->{"auto_bump"}
Truth table0%0/3
A //= B
A= $opts{"bump"}B= $config->{"auto_bump"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | $opts{commit} //= $config->{auto_git}; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$opts{"commit"} //= $config->{"auto_git"}
MC/DC0%0/2
$opts{"commit"} //= $config->{"auto_git"}
$opts{"commit"}
$config->{"auto_git"}
Truth table0%0/3
A //= B
A= $opts{"commit"}B= $config->{"auto_git"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | $opts{scan} //= $config->{auto_scan}; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$opts{"scan"} //= $config->{"auto_scan"}
MC/DC0%0/2
$opts{"scan"} //= $config->{"auto_scan"}
$opts{"scan"}
$config->{"auto_scan"}
Truth table0%0/3
A //= B
A= $opts{"scan"}B= $config->{"auto_scan"}
| |||||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | regenerate(\@files, $config, %opts); | |||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 418 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | scan => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | my %opts = (sanitize => 1); | |||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | ▶ | GetOptionsFromArray(\@arguments, \%opts, qw/omit_core|omit-core=s sanitize! omit=s@/) or return 2; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | insert_options(\%opts, get_config); | |||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | my $dist = App::ModuleBuildTiny::Dist->new(%opts, regenerate => { 'META.json' => 1 }); | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | my $prereqs = $dist->scan_prereqs(%opts); | |||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | write_json('prereqs.json', $prereqs->as_string_hash); | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 428 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | ▶ | setup => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=26 SCAR=65.5
| |||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $config_file = get_settings_file(); | |||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | my $config = -f $config_file ? read_json($config_file) : {}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | my $mode = @arguments ? shift @arguments : 'upgrade'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | if ($mode eq 'upgrade') { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | for my $item (@config_items) { | |||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | next if defined $config->{ $item->[0] }; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | ▶ | my $default = $config->{ $fallback_config{ $item->[0] } // '' }; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$fallback_config{$item->[0]} // ""
MC/DC0%0/1
$fallback_config{$item->[0]} // ""
$fallback_config{$item->[0]}
Truth table0%0/2
A
A= $fallback_config{$item->[0]}
| |||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ask($config, $item, $default); | |||||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 442 | # delete $config->{$_} for @delete_config; | ||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | write_json($config_file, $config); | |||||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 445 | elsif ($mode eq 'minimal') { | ||||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | for my $item (@config_items) { | |||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | next if defined $config->{ $item->[0] }; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | if (defined $item->[3]) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | $config->{ $item->[0] } = $item->[3]; | |||||||||||||||||||||||||||||||||||||||||||
| 450 | } else { | ||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | ask($config, $item); | |||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | delete $config->{$_} for @delete_config; | |||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | write_json($config_file, $config); | |||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 457 | elsif ($mode eq 'all') { | ||||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | for my $item (@config_items) { | |||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | ▶ | my $default = $config->{ $item->[0] } // $config->{ $fallback_config{ $item->[0] } // '' }; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
$$config{$item->[0]} // $$config{$fallback_config{$item->[0]} // ""}
$fallback_config{$item->[0]} // ""
MC/DC0%0/2
$$config{$item->[0]} // $$config{$fallback_config{$item->[0]} // ""}
$$config{$item->[0]}
$$config{$fallback_config{$item->[0]} // ""}
MC/DC0%0/1
$fallback_config{$item->[0]} // ""
$fallback_config{$item->[0]}
Truth table0%0/3
A // B
A= $$config{$item->[0]}B= $$config{$fallback_config{$item->[0]} // ""}
Truth table0%0/2
A
A= $fallback_config{$item->[0]}
| |||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | ask($config, $item, $default); | |||||||||||||||||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | delete $config->{$_} for @delete_config; | |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | write_json($config_file, $config); | |||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 465 | elsif ($mode eq 'get') { | ||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | my ($key, $value) = @arguments; | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | my ($item) = grep { $_->[0] eq $key } @config_items; | |||||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | ▶ | die "No such known key $key" if not $item; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my (undef, $description, $type, $default) = @{$item}; | |||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | say show_item($config, $key, $type); | |||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 472 | elsif ($mode eq 'set') { | ||||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | my ($key, $value) = @arguments; | |||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | my $item = grep { $_->[0] eq lc $key } @config_items; | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | die "No such known key $key" if not $item; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | ▶ | if ($item->[2] eq 'yn') { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | $config->{$key} = $boolean{$value} // die "Unknown boolean value '$value'\n"; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$boolean{$value} // die("Unknown boolean value '${value}'\n")
MC/DC0%0/1
$boolean{$value} // die("Unknown boolean value '${value}'\n")
$boolean{$value}
Truth table0%0/2
A
A= $boolean{$value}
| |||||||||||||||||||||||||||||||||||||||||||||
| 478 | } else { | ||||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | $config->{$key} = $value; | |||||||||||||||||||||||||||||||||||||||||||
| 480 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | write_json($config_file, $config); | |||||||||||||||||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 483 | elsif ($mode eq 'list') { | ||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | for my $item (@config_items) { | |||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | my ($key, $description, $type, $default) = @{$item}; | |||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | say "$key: " . show_item($config, $key, $type); | |||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 489 | elsif ($mode eq 'reset') { | ||||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | return not unlink $config_file; | |||||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 493 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | config => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=24 SCAR=64.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | my $settings = get_settings; | |||||||||||||||||||||||||||||||||||||||||||
| 497 | 0 | my $config = get_config; | |||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | my $mode = @arguments ? shift @arguments : 'upgrade'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | my @items = grep { $_->[2] ne 'open' } @config_items; | |||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | ▶ | if ($mode eq 'upgrade') { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | for my $item (@items) { | |||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | ▶ | next if defined $config->{ $item->[0] }; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | ▶ | my $default = $config->{ $fallback_config{ $item->[0] } // '' }; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$fallback_config{$item->[0]} // ""
MC/DC0%0/1
$fallback_config{$item->[0]} // ""
$fallback_config{$item->[0]}
Truth table0%0/2
A
A= $fallback_config{$item->[0]}
| |||||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | ask($config, $item, $default); | |||||||||||||||||||||||||||||||||||||||||||
| 507 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | delete $config->{$_} for @delete_config; | |||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | write_json($config_file, $config); | |||||||||||||||||||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 511 | elsif ($mode eq 'all') { | ||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | for my $item (@items) { | |||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | my $default = $config->{ $item->[0] } // $config->{ $fallback_config{ $item->[0] } // '' } // $settings->{ $item->[0] }; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/8
($$config{$item->[0]} // $$config{$fallback_config{$item->[0]} // ""}) // $$settings{$item->[0]}
$$config{$item->[0]} // $$config{$fallback_config{$item->[0]} // ""}
$fallback_config{$item->[0]} // ""
MC/DC0%0/3
($$config{$item->[0]} // $$config{$fallback_config{$item->[0]} // ""}) // $$settings{$item->[0]}
$$config{$item->[0]}
$$config{$fallback_config{$item->[0]} // ""}
$$settings{$item->[0]}
MC/DC0%0/1
$fallback_config{$item->[0]} // ""
$fallback_config{$item->[0]}
Truth table0%0/4
A // B // C
A= $$config{$item->[0]}B= $$config{$fallback_config{$item->[0]} // ""}C= $$settings{$item->[0]}
Truth table0%0/2
A
A= $fallback_config{$item->[0]}
| |||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ask($config, $item, $default); | |||||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | delete $config->{$_} for @delete_config; | |||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | write_json($config_file, $config); | |||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 519 | elsif ($mode eq 'copy') { | ||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | for my $item (@items) { | |||||||||||||||||||||||||||||||||||||||||||
| 521 | 0 | my ($key) = @{$item}; | |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | $config->{$key} = $settings->{$key} if exists $settings->{$key}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | write_json($config_file, $config); | |||||||||||||||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 526 | elsif ($mode eq 'get') { | ||||||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | my ($key, $value) = @arguments; | |||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | my ($item) = grep { $_->[0] eq $key } @config_items; | |||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | ▶ | die "No such known key $key" if not $item; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | my (undef, $description, $type, $default) = @{$item}; | |||||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | say show_item($config, $key, $type); | |||||||||||||||||||||||||||||||||||||||||||
| 532 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 533 | elsif ($mode eq 'set') { | ||||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | my ($key, $value) = @arguments; | |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my $item = grep { $_->[0] eq lc $key } @config_items; | |||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | die "No such known key $key" if not $item; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | ▶ | $config->{$key} = $boolean{$value} // die "Unknown boolean value '$value'\n"; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$boolean{$value} // die("Unknown boolean value '${value}'\n")
MC/DC0%0/1
$boolean{$value} // die("Unknown boolean value '${value}'\n")
$boolean{$value}
Truth table0%0/2
A
A= $boolean{$value}
| |||||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | write_json($config_file, $config); | |||||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 540 | elsif ($mode eq 'list') { | ||||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | for my $item (@items) { | |||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | my ($key, $description, $type, $default) = @{$item}; | |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | say "$key: " . show_item($config, $key, $type); | |||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 546 | elsif ($mode eq 'reset') { | ||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | return not unlink $config_file; | |||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 550 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | ▶ | mint => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=13 SCAR=52.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | my @arguments = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||
| 554 | 0 | my $settings = get_settings(\%default_settings); | |||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||||
| 556 | 0 | ▶ | my $distname = decode_utf8(shift @arguments // die "No distribution name given\n") =~ s/::/-/gr; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift @arguments // die("No distribution name given\n")
MC/DC0%0/1
shift @arguments // die("No distribution name given\n")
shift @arguments
Truth table0%0/2
A
A= shift @arguments
| |||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||
| 558 | my %args = ( | ||||||||||||||||||||||||||||||||||||||||||||
| 559 | author => $settings->{author}, | ||||||||||||||||||||||||||||||||||||||||||||
| 560 | email => $settings->{email}, | ||||||||||||||||||||||||||||||||||||||||||||
| 561 | license => $settings->{license}, | ||||||||||||||||||||||||||||||||||||||||||||
| 562 | version => '0.000', | ||||||||||||||||||||||||||||||||||||||||||||
| 563 | dirname => $distname, | ||||||||||||||||||||||||||||||||||||||||||||
| 564 | abstract => 'INSERT YOUR ABSTRACT HERE', | ||||||||||||||||||||||||||||||||||||||||||||
| 565 | init_git => $settings->{auto_git}, | ||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | my %config; | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | my @options = qw/version=s abstract=s dirname=s init_git|init-git/; | |||||||||||||||||||||||||||||||||||||||||||
| 569 | 0 | for my $config_item (@config_items) { | |||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | my $entry = $config_item->[0] =~ s{^(\w+_\w+)\K$}{ '|' . $1 =~ tr/_/-/r }er; | |||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | push @options, $entry . ($config_item->[2] eq 'yn' ? '!' : '=s'); | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | ▶ | GetOptionsFromArray(\@arguments, \%args, @options) or return 2; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | for my $item (@config_items) { | |||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | my ($key, $description, $type, $default) = @{$item}; | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | ▶ | if ($type eq 'open') { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | ▶ | $args{$key} //= prompt($description, $default); | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{$key} //= prompt($description, $default)
MC/DC0%0/2
$args{$key} //= prompt($description, $default)
$args{$key}
prompt($description, $default)
Truth table0%0/3
A //= B
A= $args{$key}B= prompt($description, $default)
| |||||||||||||||||||||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 579 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | ▶ | $config{$key} = $args{$key} // $settings->{$key} // prompt_yn($description, $default); | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
($args{$key} // $settings->{$key}) // prompt_yn($description, $default)
$args{$key} // $settings->{$key}
MC/DC0%0/3
($args{$key} // $settings->{$key}) // prompt_yn($description, $default)
$args{$key}
$settings->{$key}
prompt_yn($description, $default)
Truth table0%0/4
A // B // C
A= $args{$key}B= $settings->{$key}C= prompt_yn($description, $default)
| |||||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | my $license = create_license_for(delete $args{license}, $args{author}); | |||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||
| 586 | 0 | ▶ | die "Directory $args{dirname} already exists\n" if -e $args{dirname}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | mkdir $args{dirname}; | |||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | chdir $args{dirname}; | |||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | $args{module_name} = $distname =~ s/-/::/gr; | |||||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | my $module_file = write_module(%args, notice => $license->notice); | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | write_changes(%args, distname => $distname); | |||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | write_maniskip($distname); | |||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | write_json('dist.json', \%config); | |||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | mkdir 't'; | |||||||||||||||||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | write_json('metamerge.json', { name => $distname }) if $distname ne $args{dirname}; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | my @regenerate_files = regenerate_files(\%config); | |||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | regenerate(\@regenerate_files, \%args, scan => $config{auto_scan}); | |||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | ▶ | if ($args{init_git}) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | my $ignore = join "\n", qw/*.bak *.swp *.swo *.tdy *.tar.gz/, "$distname-*", ''; | |||||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | write_text('.gitignore', $ignore); | |||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | require Git::Wrapper; | |||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | my $git = Git::Wrapper->new('.'); | |||||||||||||||||||||||||||||||||||||||||||
| 608 | 0 | $git->init; | |||||||||||||||||||||||||||||||||||||||||||
| 609 | 0 | $git->add(@regenerate_files, 'Changes', 'MANIFEST.SKIP', 'dist.json', '.gitignore', $module_file, grep -e, 'metamerge.json'); | |||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | $git->commit({ message => 'Initial commit' }); | |||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||
| 614 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | ▶ | version => sub { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | say $VERSION; | |||||||||||||||||||||||||||||||||||||||||||
| 617 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 618 | 1 | ); | |||||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||||
| 620 | 0 | ▶ | sub modulebuildtiny { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modulebuildtiny: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | my ($action, @arguments) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 622 | 0 | ▶ | die "No action given\n" unless defined $action; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | my $call = $actions{$action}; | |||||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | ▶ | die "No such action '$action' known\n" if not $call; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | return $call->(@arguments); | |||||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||||
| 628 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||
| 630 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||||
| 632 | App::ModuleBuildTiny - A standalone authoring tool for Module::Build::Tiny and Dist::Build | ||||||||||||||||||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||||||||||||||||
| 634 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||
| 636 | App::ModuleBuildTiny contains the implementation of the L<mbtiny> tool. | ||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||
| 638 | =head1 FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||
| 640 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||
| 642 | =item * modulebuildtiny($action, @arguments) | ||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||
| 644 | This function runs a modulebuildtiny command. It expects at least one argument: the action. It may receive additional ARGV style options dependent on the command. | ||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||
| 646 | The actions are documented in the L<mbtiny> documentation. | ||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||
| 648 | =back | ||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||
| 650 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||
| 652 | =head2 Similar programs | ||||||||||||||||||||||||||||||||||||||||||||
| 653 | |||||||||||||||||||||||||||||||||||||||||||||
| 654 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||
| 656 | =item * L<Dist::Zilla|Dist::Zilla> | ||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||
| 658 | An extremely powerful but somewhat heavy authoring tool. | ||||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||||
| 660 | =item * L<Minilla|Minilla> | ||||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||||
| 662 | A more minimalistic than Dist::Zilla but still somewhat customizable authoring tool. | ||||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||||
| 664 | =back | ||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||
| 666 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||
| 668 | Leon Timmermans <leont@cpan.org> | ||||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||||
| 670 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||
| 672 | This software is copyright (c) 2011 by Leon Timmermans. | ||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||
| 674 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||||||||||||||||||
| 675 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||||
| 677 | =cut | ||||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||||
| 679 | __DATA__ | ||||||||||||||||||||||||||||||||||||||||||||