| 1 | 1 | ▶ | use strict; use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | package Zilla::Dist; | ||||||||||||||||||||||||||||
| 3 | 1 | our $VERSION = '0.1.24'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use version; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use File::Share; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use Hash::Merge 'merge'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use IO::All; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use YAML::PP; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 1 | Hash::Merge::set_behavior('RIGHT_PRECEDENT'); | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 14 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 15 | 0 | bless {@_}, $class; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 20 | 0 | ▶ | @args = ('help') unless @args; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | @args = ('version') if "@args" =~ /^(-v|--version)$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 0 | my $cmd = lc(shift @args); | |||||||||||||||||||||||||||
| 23 | 0 | ▶ | if ($cmd =~ /^(?: | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | test|install|release|update|prereqs|clean| | ||||||||||||||||||||||||||||
| 25 | dist|distdir|distshell|disttest| | ||||||||||||||||||||||||||||
| 26 | cpan|cpanshell | ||||||||||||||||||||||||||||
| 27 | )$/x) { | ||||||||||||||||||||||||||||
| 28 | 0 | unshift @args, $cmd; | |||||||||||||||||||||||||||
| 29 | 0 | $cmd = 'make'; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | 0 | my $method = "do_$cmd"; | |||||||||||||||||||||||||||
| 32 | 0 | ▶ | $self->usage, return unless $self->can($method); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 0 | $self->{meta} = $self->get_meta; | |||||||||||||||||||||||||||
| 34 | 0 | $self->$method(@args); | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub get_meta { | ||||||||||||||||||||||||||
|
Subroutine
get_meta: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 38 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 39 | my $meta = -f 'Meta' | ||||||||||||||||||||||||||||
| 40 | 0 | ▶ | ? eval { YAML::PP::LoadFile('Meta') } || {} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
eval {
do {
YAML::PP::LoadFile("Meta")
}
} or {}
MC/DC0%0/1
eval {
do {
YAML::PP::LoadFile("Meta")
}
} or {}
eval {
do {
YAML::PP::LoadFile("Meta")
}
}
Truth table0%0/2
A
A= eval {
do {
YAML::PP::LoadFile("Meta")
}
}
| |||||||||||||||||||||||||||||
| 41 | : {}; | ||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if (my $base_file = delete($meta->{base})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 0 | my $base = YAML::PP::LoadFile($base_file); | |||||||||||||||||||||||||||
| 44 | 0 | $meta = merge($base, $meta); | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | 0 | return $meta; | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub do_make { | ||||||||||||||||||||||||||
|
Subroutine
do_make: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 50 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 51 | 0 | my @cmd = ('make', '-f', $self->find_sharefile('Makefile'), @args); | |||||||||||||||||||||||||||
| 52 | 0 | ▶ | system(@cmd) == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | or die "'@cmd' failed: $!\n"; | ||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub do_makefile { | ||||||||||||||||||||||||||
|
Subroutine
do_makefile: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 57 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 58 | 0 | print $self->find_sharefile('Makefile'), "\n"; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | sub do_copy { | ||||||||||||||||||||||||||
|
Subroutine
do_copy: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | 0 | my ($self, $file, $target) = @_; | |||||||||||||||||||||||||||
| 63 | 0 | ▶ | $target ||= $file; | ||||||||||||||||||||||||||
|
Condition0%0/3
$target ||= $file
MC/DC0%0/2
$target ||= $file
$target
$file
Truth table0%0/3
A ||= B
A= $targetB= $file
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | my $file_content = io->file($self->find_sharefile($file))->all; | |||||||||||||||||||||||||||
| 66 | 0 | io->file($target)->print($file_content); | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | print "Zilla::Dist copied shared '$file' to '$target'\n"; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 0 | ▶ | sub do_version { | ||||||||||||||||||||||||||
|
Subroutine
do_version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 72 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 73 | 0 | print "$VERSION\n"; | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub update_makefile { | ||||||||||||||||||||||||||
|
Subroutine
update_makefile: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 77 | 0 | my ($self, $makefile_path) = @_; | |||||||||||||||||||||||||||
| 78 | 0 | my $makefile_content = io->file($self->find_sharefile('Makefile'))->all; | |||||||||||||||||||||||||||
| 79 | 0 | io->file($makefile_path)->print($makefile_content); | |||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub do_sharedir { | ||||||||||||||||||||||||||
|
Subroutine
do_sharedir: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 83 | 0 | my ($self, @args) = @_; | |||||||||||||||||||||||||||
| 84 | 0 | print $self->find_sharedir . "\n"; | |||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 1 | my $default = { | |||||||||||||||||||||||||||
| 88 | branch => 'master', | ||||||||||||||||||||||||||||
| 89 | }; | ||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub do_meta { | ||||||||||||||||||||||||||
|
Subroutine
do_meta: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 91 | 0 | my ($self, $key) = @_; | |||||||||||||||||||||||||||
| 92 | 0 | my $keys = [ split '/', $key ]; | |||||||||||||||||||||||||||
| 93 | 0 | my $meta = $self->{meta}; | |||||||||||||||||||||||||||
| 94 | 0 | my $value = $meta; | |||||||||||||||||||||||||||
| 95 | 0 | for my $k (@$keys) { | |||||||||||||||||||||||||||
| 96 | 0 | ▶ | return unless ref($value) eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | 0 | ▶ | $value = $value->{$k} || $default->{$k}; | ||||||||||||||||||||||||||
|
Condition0%0/3
$value->{$k} || $default->{$k}
MC/DC0%0/2
$value->{$k} || $default->{$k}
$value->{$k}
$default->{$k}
Truth table0%0/3
A || B
A= $value->{$k}B= $default->{$k}
| |||||||||||||||||||||||||||||
| 98 | 0 | ▶ | last unless defined $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | 0 | ▶ | if (defined $value) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if (not ref $value) { | ||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||
| 102 | 0 | print "$value\n"; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | elsif (ref($value) eq 'ARRAY') { | ||||||||||||||||||||||||||||
| 105 | 0 | print "$_\n" for @$value; | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | elsif (ref($value) eq 'HASH') { | ||||||||||||||||||||||||||||
| 108 | 0 | for my $kk (sort keys %$value) { | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | print "$kk\n" unless $kk =~ /^(?:perl)$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | else { | ||||||||||||||||||||||||||||
| 113 | 0 | print "$value\n"; | |||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | ▶ | sub do_changes { | ||||||||||||||||||||||||||
|
Subroutine
do_changes: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 119 | 0 | my ($self, $key, $value) = @_; | |||||||||||||||||||||||||||
| 120 | 0 | ▶ | return if $self->{meta}{'=zild'}{no_changes_yaml}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | 0 | my @changes = YAML::PP::LoadFile('Changes'); | |||||||||||||||||||||||||||
| 122 | 0 | $self->validate_changes(\@changes); | |||||||||||||||||||||||||||
| 123 | 0 | ▶ | return unless @changes; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if ($value) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | 0 | chomp $value; | |||||||||||||||||||||||||||
| 126 | 0 | ▶ | die unless length $value; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | 0 | ▶ | my $text = io->file('Changes')->all or die; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 128 | 0 | my $line = sprintf "%-8s %s", "$key:", $value; | |||||||||||||||||||||||||||
| 129 | 0 | ▶ | $text =~ s/^$key:.*/$line/m or die; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 0 | io->file('Changes')->print($text); | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | else { | ||||||||||||||||||||||||||||
| 133 | 0 | ▶ | $value = $changes[0]{$key} or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 134 | 0 | print "$value\n"; | |||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 0 | ▶ | sub error { | ||||||||||||||||||||||||||
|
Subroutine
error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 139 | 0 | die "Error: $_[0]\n"; | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub validate_changes { | ||||||||||||||||||||||||||
|
Subroutine
validate_changes: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 143 | 0 | my ($self, $changes) = @_; | |||||||||||||||||||||||||||
| 144 | 0 | ▶ | return if $self->{meta}{'=zild'}{no_changes_yaml}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | 0 | ▶ | scalar(@$changes) or error "Changes file is empty"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | 0 | ▶ | for (my $i = 1; $i <= @$changes; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 0 | my $entry = $changes->[$i - 1]; | |||||||||||||||||||||||||||
| 150 | 0 | ▶ | ref($entry) eq 'HASH' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 151 | or error "Changes entry #$i is not a hash"; | ||||||||||||||||||||||||||||
| 152 | 0 | my @keys = keys %$entry; | |||||||||||||||||||||||||||
| 153 | 0 | ▶ | @keys == 3 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | or error "Changes entry #$i doesn't have 3 keys"; | ||||||||||||||||||||||||||||
| 155 | 0 | for my $key (qw(version date changes)) { | |||||||||||||||||||||||||||
| 156 | error "Changes entry #$i is missing field '$key'" | ||||||||||||||||||||||||||||
| 157 | 0 | ▶ | unless exists $entry->{$key}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 158 | error "Changes entry #$i has undefined field '$key'" | ||||||||||||||||||||||||||||
| 159 | 0 | ▶ | unless defined $entry->{$key} or $key eq 'date'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $entry->{$key} or $key eq "date"
MC/DC0%0/2
defined $entry->{$key} or $key eq "date"
defined $entry->{$key}
$key eq "date"
Truth table0%0/3
A or B
A= defined $entry->{$key}B= $key eq "date"
| |||||||||||||||||||||||||||||
| 160 | 0 | ▶ | if (defined $entry->{$key}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if ($key eq 'changes') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | error "Changes entry #$i field '$key' should be an array" | ||||||||||||||||||||||||||||
| 163 | 0 | ▶ | unless ref($entry->{$key}) eq 'ARRAY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 164 | 0 | my $change_list = $entry->{changes}; | |||||||||||||||||||||||||||
| 165 | 0 | for my $change_entry (@$change_list) { | |||||||||||||||||||||||||||
| 166 | 0 | ▶ | error "Changes entry #$i has non-scalar 'changes' entry" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 167 | if ref $change_entry; | ||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | else { | ||||||||||||||||||||||||||||
| 171 | error "Changes entry #$i field '$key' should be a scalar" | ||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if ref($entry->{$key}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | 0 | ▶ | if (@$changes >= 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 178 | 0 | my $changes1 = join '%^&*', @{$changes->[0]{changes}}; | |||||||||||||||||||||||||||
| 179 | 0 | my $changes2 = join '%^&*', @{$changes->[1]{changes}}; | |||||||||||||||||||||||||||
| 180 | 0 | ▶ | error "2 most recent Changes messages cannot be the same!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 181 | if $changes1 eq $changes2; | ||||||||||||||||||||||||||||
| 182 | 0 | my $v0 = $changes->[0]{version}; | |||||||||||||||||||||||||||
| 183 | 0 | my $v1 = $changes->[1]{version}; | |||||||||||||||||||||||||||
| 184 | 0 | ▶ | error "latest Changes version ($v0) is not greater than previous ($v1)" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 185 | unless version->parse($v0) > version->parse($v1); | ||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | 0 | ▶ | sub find_sharefile { | ||||||||||||||||||||||||||
|
Subroutine
find_sharefile: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 190 | 0 | my ($self, $file) = @_; | |||||||||||||||||||||||||||
| 191 | 0 | my $path = $self->find_sharedir . '/' . $file; | |||||||||||||||||||||||||||
| 192 | 0 | ▶ | -e $path or die "Can't find shared Zilla::Dist file '$file'"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 193 | 0 | return $path; | |||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub find_sharedir { | ||||||||||||||||||||||||||
|
Subroutine
find_sharedir: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 197 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 198 | 0 | my $sharedir = File::Share::dist_dir('Zilla-Dist'); | |||||||||||||||||||||||||||
| 199 | 0 | ▶ | -d $sharedir or die "Can't find Zilla::Dist share dir"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | 0 | return $sharedir; | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub do_webhooks { | ||||||||||||||||||||||||||
|
Subroutine
do_webhooks: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 204 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 205 | 0 | ▶ | return unless $ENV{PERL_ZILLA_DIST_GIT_HUB_WEBHOOKS}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | 0 | ▶ | return unless -d '.git'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | 0 | my $path = '.git/zilla-dist/webhooks'; | |||||||||||||||||||||||||||
| 208 | 0 | my $travis = io->file("$path/travis"); | |||||||||||||||||||||||||||
| 209 | 0 | my $irc = io->file("$path/irc"); | |||||||||||||||||||||||||||
| 210 | 0 | for my $hook (qw(travis irc)) { | |||||||||||||||||||||||||||
| 211 | 0 | my $file = io->file("$path/$hook"); | |||||||||||||||||||||||||||
| 212 | 0 | ▶ | if ($file->exists) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | 0 | my $hook_version = $file->chomp->getline; | |||||||||||||||||||||||||||
| 214 | 0 | my $api_version = '0.0.95'; | |||||||||||||||||||||||||||
| 215 | next if | ||||||||||||||||||||||||||||
| 216 | 0 | ▶ | version->parse($hook_version) >= | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | version->parse($api_version); | ||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | 0 | my $method = "webhook_command_$hook"; | |||||||||||||||||||||||||||
| 220 | 0 | ▶ | my $command = $self->$method or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 221 | 0 | print "Running: '$command'\n"; | |||||||||||||||||||||||||||
| 222 | 0 | ▶ | system($command) == 0 | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | or die "Error: command failed '$command': $!"; | ||||||||||||||||||||||||||||
| 224 | 0 | io->file("$path/$hook")->assert->print($VERSION); | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | 0 | ▶ | sub webhook_command_travis { | ||||||||||||||||||||||||||
|
Subroutine
webhook_command_travis: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 229 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 230 | 0 | return "git hub travis-enable"; | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 0 | ▶ | sub webhook_command_irc { | ||||||||||||||||||||||||||
|
Subroutine
webhook_command_irc: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 234 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 235 | 0 | my $irc; | |||||||||||||||||||||||||||
| 236 | 0 | ▶ | return unless $irc = $self->{meta}{devel}{irc}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 237 | 0 | ▶ | return unless $irc =~ /^(\w\S*)#(\w\S*)$/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 238 | 0 | return "git hub irc-enable $2 $1"; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | ▶ | sub do_years { | ||||||||||||||||||||||||||
|
Subroutine
do_years: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 242 | 0 | my ($self, $key, $value) = @_; | |||||||||||||||||||||||||||
| 243 | 0 | my %hash = eval { | |||||||||||||||||||||||||||
| 244 | 0 | map {($_ => 1)} grep {$_} map { | |||||||||||||||||||||||||||
| 245 | 0 | $_->{date} =~ /(\d{4})/; | |||||||||||||||||||||||||||
| 246 | 0 | $1; | |||||||||||||||||||||||||||
| 247 | } (YAML::PP::LoadFile('Changes')); | ||||||||||||||||||||||||||||
| 248 | }; | ||||||||||||||||||||||||||||
| 249 | 0 | ▶ | return if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 250 | 0 | print join(' ', sort keys %hash) . "\n"; | |||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 0 | ▶ | sub usage { | ||||||||||||||||||||||||||
|
Subroutine
usage: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 254 | 0 | print <<'...'; | |||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||
| 256 | Usage: | ||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||
| 258 | zild make <rule> # Run `make <rule>` with Zilla::Dist Makefile | ||||||||||||||||||||||||||||
| 259 | zild meta <key> # Print Meta value for a key | ||||||||||||||||||||||||||||
| 260 | zild copy <file> <dest> # Copy a shared file | ||||||||||||||||||||||||||||
| 261 | zild version # Print Zilla::Dist version | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | The following commands are aliases for `zild make <cmd>` | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | zild test zild dist zild cpan | ||||||||||||||||||||||||||||
| 266 | zild install zild distdir zild cpanshell | ||||||||||||||||||||||||||||
| 267 | zild release zild distshell | ||||||||||||||||||||||||||||
| 268 | zild update zild disttest | ||||||||||||||||||||||||||||
| 269 | zild clean | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | Internal commands issued by the Makefile: | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | zild sharedir # Print the location of the Zilla::Dist share dir | ||||||||||||||||||||||||||||
| 274 | zild makefile # Print the location of the Zilla::Dist 'Makefile' | ||||||||||||||||||||||||||||
| 275 | zild changes <key> [<value>] | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | ... | ||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | 1 | 1; | |||||||||||||||||||||||||||