blib/lib/Dist/Zilla/Plugin/Author/Plicease/Init2.pm

filter: Statementstmt 82.3% 177 / 215 Branchbran 78.7% 63 / 80 Conditioncond 45.0% 9 / 20 MC/DCmcdc 23.0% 3 / 13 Subroutinesub 82.8% 29 / 35 Podpod 0.0% 0 / 8 totaltotal 75.7% 281 / 371 CC 54 SCAR 24.9
CC
54
Cov
79%
after_mint
57.6
__ANON__
12.0
make_module
8.0
CRAP 12.1
« blib/lib/Dist/Zilla/Plugin/Author/Plicease/SpecialPrereqs.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Author/Plicease/ReadmeAnyFromPod.pm »
1 2 ▶use 5.022;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 2 ▶use stable qw( postderef );
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use experimental qw( signatures );
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use true;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 package Dist::Zilla::Plugin::Author::Plicease::Init2 2.81 {
7  
8 2 ▶ use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶ use Dist::Zilla::File::InMemory;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶ use Dist::Zilla::File::FromCode;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶ use Sub::Exporter::ForMethods qw( method_installer );
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶ use Data::Section { installer => method_installer }, -setup => { header_re => qr/^@@ (.*?)$/ };
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶ use Dist::Zilla::MintingProfile::Author::Plicease;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 2 ▶ use JSON::PP qw( encode_json );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 2 ▶ use Encode qw( encode_utf8 );
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 # ABSTRACT: Dist::Zilla initialization tasks for Plicease
18  
19  
20 2 with 'Dist::Zilla::Role::AfterMint';
21 2 with 'Dist::Zilla::Role::ModuleMaker';
22 2 with 'Dist::Zilla::Role::FileGatherer';
23 2 with 'Dist::Zilla::Role::TextTemplate';
24  
25 2 our $chrome;
26  
27 sub chrome
28 207 ▶ {
Subroutine chrome: called CC=2 SCAR=7.2
Pod undocumented
29 207 ▶ return $chrome if defined $chrome;
Branch: 1 branch
BranchTrueFalseTotal
if defined $Dist::Zilla::Plugin::Author::Plicease::Init2::chrome 0 207 207
30 207 shift->zilla->chrome;
31 }
32  
33 has abstract => (
34 is => 'ro',
35 isa => 'Str',
36 lazy => 1,
37 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
38 0 my($self) = @_;
39 0 $self->chrome->prompt_str("abstract");
40 },
41 2 );
42  
43 has include_tests => (
44 is => 'ro',
45 isa => 'Int',
46 lazy => 1,
47 23 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
48 23 1,
49 },
50 2 );
51  
52 has type_dzil => (
53 is => 'ro',
54 lazy => 1,
55 24 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
56 24 my $name = shift->zilla->name;
57 24 ▶ $name =~ /^Dist-Zilla/ ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$name =~ /^Dist-Zilla/u ? : 1 23 24
58 },
59 2 );
60  
61 has type_alien => (
62 is => 'ro',
63 lazy => 1,
64 24 ▶ default => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
65 24 my $name = shift->zilla->name;
66 24 ▶ my $alien = $name =~ /^Alien-[A-Za-z0-9]+$/ ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$name =~ /^Alien-[A-Za-z0-9]+$/u ? : 1 23 24
67 24 ▶ $alien = 0 if $name =~ /^Alien-(Build|Base|Role)-/;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ /^Alien-(Build|Base|Role)-/u 3 21 24
68 24 $alien;
69 },
70 2 );
71  
72 has type_app => (
73 is => 'ro',
74 lazy => 1,
75 24 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
76 24 my $name = shift->zilla->name;
77 24 ▶ if($name =~ /^App-([a-z0-9]+)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($name =~ /^App-([a-z0-9]+)$/u) { } 1 23 24
78 1 return $1;
79 } else {
80 23 return undef;
81 }
82 },
83 2 );
84  
85 has workflow => (
86 is => 'ro',
87 isa => 'ArrayRef[Str]',
88 lazy => 1,
89 24 ▶ default => sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
90 24 my $self = shift;
91 24 my @workflow;
92  
93 24 foreach my $workflow (qw( static linux ))
94 {
95 48 ▶ push @workflow, $workflow if $self->chrome->prompt_yn("workflow $workflow?", { default => 1 });
Branch: 1 branch
BranchTrueFalseTotal
if $self->chrome->prompt_yn("workflow $workflow?", {"default", 1}) 47 1 48
96 }
97  
98 24 foreach my $workflow (qw( windows macos cygwin msys2-mingw ))
99 {
100 96 ▶ push @workflow, $workflow if $self->chrome->prompt_yn("workflow $workflow?", { default => 0 });
Branch: 1 branch
BranchTrueFalseTotal
if $self->chrome->prompt_yn("workflow $workflow?", {"default", 0}) 2 94 96
101 }
102  
103 24 \@workflow;
104 },
105 2 );
106  
107 has irc => (
108 is => 'ro',
109 isa => 'Maybe[Str]',
110 lazy => 1,
111 24 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
112 24 my $self = shift;
113 24 ▶ return undef unless $self->chrome->prompt_yn("irc?", { default => 0 });
Branch: 1 branch
BranchTrueFalseTotal
unless $self->chrome->prompt_yn("irc?", {"default", 0}) 23 1 24
114 1 $self->chrome->prompt_str("irc url", { default => 'irc://irc.perl.org/#native' });
115 },
116 2 );
117  
118 has perl_version => (
119 is => 'ro',
120 lazy => 1,
121 16 ▶ default => sub {
Subroutine __ANON__: called CC=12 SCAR=24.9
122 16 my($self) = @_;
123 16 ▶ if(defined $ENV{V} && $ENV{V} =~ /^5\.([0-9]+)$/)
Branch: 2 branches
BranchTrueFalseTotal
if (defined $ENV{'V'} and $ENV{'V'} =~ /^5\.([0-9]+)$/u) { } 1 15 16
elsif (defined $ENV{'V'} and $ENV{'V'} =~ /^5\.([0-9]+)\.([0-9]+)$/u) { } 1 14 15
Condition100%3/3
defined $ENV{"V"} and $ENV{"V"} =~ /^5\.([0-9]+)$/u
!ll&&!rl&&r
1411
MC/DC100%2/2
defined $ENV{"V"} and $ENV{"V"} =~ /^5\.([0-9]+)$/u
defined $ENV{"V"} $ENV{"V"} =~ /^5\.([0-9]+)$/u
Truth table100%3/3
A and B
A= defined $ENV{"V"}B= $ENV{"V"} =~ /^5\.([0-9]+)$/u
ABresult
0X0
100
111
124 {
125 1 return sprintf '5.%03d', $1;
126 }
127 ▶ elsif(defined $ENV{V} && $ENV{V} =~ /^5\.([0-9]+)\.([0-9]+)$/)
Condition66%2/3
defined $ENV{"V"} and $ENV{"V"} =~ /^5\.([0-9]+)\.([0-9]+)$/u
!ll&&!rl&&r
1401
MC/DC50%1/2
defined $ENV{"V"} and $ENV{"V"} =~ /^5\.([0-9]+)\.([0-9]+)$/u
defined $ENV{"V"} $ENV{"V"} =~ /^5\.([0-9]+)\.([0-9]+)$/u
Truth table66%2/3
A and B
A= defined $ENV{"V"}B= $ENV{"V"} =~ /^5\.([0-9]+)\.([0-9]+)$/u
ABresult
0X0
100
111
128 {
129 1 return sprintf '5.%03d%03d', $1, $2;
130 }
131 else
132 {
133 14 ▶ if($self->type_dzil)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->type_dzil) { } 1 13 14
134 {
135 1 return '5.022';
136 }
137 else
138 {
139 13 for(1..100)
140 {
141 14 my $answer = $self->chrome->prompt_str("Minimum required Perl (min: 5.016, old: 5.022, def: 5.042 (default), or an explicit Perl version)",
142 { default => "def" },
143 );
144 14 ▶ return $answer if $answer =~ /^5\.[0-9]{3,6}$/;
Branch: 1 branch
BranchTrueFalseTotal
if $answer =~ /^5\.[0-9]{3,6}$/u 1 13 14
145 13 ▶ return '5.016' if $answer eq 'min';
Branch: 1 branch
BranchTrueFalseTotal
if $answer eq "min" 1 12 13
146 12 ▶ return '5.022' if $answer eq 'old';
Branch: 1 branch
BranchTrueFalseTotal
if $answer eq "old" 1 11 12
147 11 ▶ return '5.042' if $answer eq 'def';
Branch: 1 branch
BranchTrueFalseTotal
if $answer eq "def" 9 2 11
148 2 ▶ if($answer =~ /^5\.([0-9]+)\.([0-9]+)$/)
Branch: 1 branch
BranchTrueFalseTotal
if ($answer =~ /^5\.([0-9]+)\.([0-9]+)$/u) 1 1 2
149 {
150 1 return sprintf "5.%03d%03d", $1, $2;
151 }
152 }
153 0 die "I give up";
154 }
155 }
156 },
157 2 );
158  
159 24 ▶ sub make_module ( $self, $arg )
Subroutine make_module: called CC=8 SCAR=20.8
Pod undocumented
160 {
161 24 my $template_name;
162  
163 24 ▶ if($self->type_dzil)
Branch: 6 branches
BranchTrueFalseTotal
if ($self->type_dzil) { } 1 23 24
elsif ($self->type_alien) { } 1 22 23
elsif ($self->type_app) { } 1 21 22
elsif ($self->perl_version >= 5.042) { } 8 13 21
elsif ($self->perl_version >= 5.02) { } 10 3 13
elsif ($self->perl_version >= 5.014) { } 2 1 3
164 {
165 1 $template_name = 'Dzil.pm';
166 }
167 elsif($self->type_alien)
168 {
169 1 $template_name = 'Alien.pm';
170 }
171 elsif($self->type_app)
172 {
173 1 $template_name = 'App.pm';
174 }
175 elsif($self->perl_version >= 5.042)
176 {
177 8 $template_name = 'P5042.pm';
178 }
179 elsif($self->perl_version >= 5.020)
180 {
181 10 $template_name = 'P5020.pm';
182 }
183 elsif($self->perl_version >= 5.014)
184 {
185 2 $template_name = 'P5014.pm';
186 }
187 else
188 {
189 1 $template_name = 'Default.pm';
190 }
191  
192 24 (my $filename = $arg->{name}) =~ s{::}{/}g;
193 24 $self->gather_file_template($template_name => "lib/$filename.pm");
194  
195 24 ▶ if($template_name eq 'App.pm') {
Branch: 1 branch
BranchTrueFalseTotal
if ($template_name eq "App.pm") 1 23 24
196 1 $self->gather_file_template("bin.pl" => "bin/@{[ $self->type_app ]}");
197 1 $self->gather_file_template("AppCommand.pm" => "lib/$filename/Command.pm");
198 1 $self->gather_file_template("AppCommandImpl.pm" => "lib/$filename/Command/foo.pm");
199 }
200 }
201  
202 83 ▶ sub experimental ( $self )
Subroutine experimental: called CC=6 SCAR=17.9
Pod undocumented
203 {
204 83 my %x;
205  
206 83 ▶ if($self->perl_version >= 5.020)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->perl_version >= "5.02") 72 11 83
207 {
208 72 $x{signatures} = 1;
209 72 $x{postderef} = 1;
210 }
211 83 ▶ if($self->perl_version >= 5.024)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->perl_version >= "5.024") 62 21 83
212 {
213 62 delete $x{postderef};
214 }
215 83 ▶ if($self->perl_version >= 5.032)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->perl_version >= "5.032") 49 34 83
216 {
217 49 $x{isa} = 1;
218 }
219 83 ▶ if($self->perl_version >= 5.034)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->perl_version >= "5.034") 45 38 83
220 {
221 45 $x{try} = 1;
222 }
223 83 ▶ if($self->perl_version >= 5.036)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->perl_version >= "5.036") 41 42 83
224 {
225 41 $x{defer} = 1;
226 41 delete $x{signatures};
227 41 delete $x{isa};
228 }
229  
230 83 return join(' ', sort keys %x);
231 }
232  
233 24 ▶ sub gather_files ( $self, $arg = undef )
Subroutine gather_files: called CC=4 SCAR=13.9
Pod undocumented
234 24 {
235 24 $self->gather_file_dist_ini($arg);
236  
237 24 $self->gather_file_simple ('.gitattributes');
238 24 $self->gather_file_simple ('.vscode/settings.json');
239 24 $self->gather_file_template('.gitignore');
240 24 ▶ $self->gather_file_simple ('alienfile') if $self->type_alien;
Branch: 1 branch
BranchTrueFalseTotal
if $self->type_alien 1 23 24
241 24 $self->gather_file_simple ('author.yml');
242 24 $self->gather_file_simple ('Changes');
243 24 $self->gather_file_simple ('perlcriticrc');
244 24 $self->gather_file_template('t/main_class.t' => 't/' . lc($self->zilla->name =~ s/-/_/gr) . ".t" );
245 24 $self->gather_file_simple ('xt/author/critic.t');
246  
247 24 foreach my $workflow ($self->workflow->@*)
248 {
249 49 $self->gather_file_simple(".github/workflows/$workflow.yml");
250 }
251 }
252  
253 194 ▶ sub gather_file_simple ( $self, $filename )
Subroutine gather_file_simple: called CC=2 SCAR=7.0
Pod undocumented
254 {
255 194 my $content = $self->section_data("dist/$filename")->$*;
256 194 $content =~ s/\s*\z/"\n"/e;
257 194 ▶ $self->log_fatal("no bundled file dist/$filename") unless $content;
Branch: 1 branch
BranchTrueFalseTotal
unless $content 0 194 194
258 194 my $file = Dist::Zilla::File::InMemory->new({
259 name => $filename,
260 content => $content,
261 });
262 194 $self->add_file($file);
263 }
264  
265 75 ▶ sub gather_file_template ( $self, $template_name, $filename = undef )
Subroutine gather_file_template: called CC=4 SCAR=14.0
Pod undocumented
266 75 {
267 75 ▶ $filename //= $template_name;
Condition66%2/3
$filename //= $template_name
l!l&&r!l&&!r
51240
MC/DC0%0/2
$filename //= $template_name
$filename $template_name
Truth table66%2/3
A //= B
A= $filenameB= $template_name
ABresult
1X1
011
000
268 75 my $template = $self->section_data("template/$template_name")->$*;
269 75 $template =~ s/\s*\z/"\n"/e;
270 75 ▶ $self->log_fatal("no bundled template: template/$template_name") unless $template;
Branch: 1 branch
BranchTrueFalseTotal
unless $template 0 75 75
271 75 my $content = $self->fill_in_string($template, {
272 name => $self->zilla->name,
273 abstract => $self->abstract,
274 perl_version => $self->perl_version,
275 experimental => $self->experimental,
276 }, {});
277 75 my $file = Dist::Zilla::File::InMemory->new({
278 name => $filename,
279 content => $content,
280 });
281 75 $self->add_file($file);
282 }
283  
284 24 ▶ sub gather_file_dist_ini ( $self, $arg )
Subroutine gather_file_dist_ini: called CC=2 SCAR=7.0
Pod undocumented
285 {
286 24 my $zilla = $self->zilla;
287  
288 24 my $template = $self->section_data("template/dist.ini");
289  
290 24 ▶ my $stash = {
Condition50%1/2
__PACKAGE__->VERSION // "2.41"
l!l
240
MC/DC0%0/1
__PACKAGE__->VERSION // "2.41"
__PACKAGE__->VERSION
Truth table50%1/2
A
A= __PACKAGE__->VERSION
Aresult
11
00
291 name => $zilla->name,
292 copyright_year => (localtime)[5]+1900,
293 version => __PACKAGE__->VERSION // '2.41',
294 release_tests => $self->include_tests,
295 github_user => $self->github_user,
296 version_plugin => 0,
297 workflow => $self->workflow,
298 irc => $self->irc,
299 default_branch => 'main',
300 is_app => !!$self->type_app,
301 };
302  
303 24 ▶ my $code = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
304 24 $self->fill_in_string($$template, $stash, {});
305 24 };
306  
307 24 my $file = Dist::Zilla::File::FromCode->new({
308 name => 'dist.ini',
309 code => $code,
310 });
311  
312 24 $self->add_file($file);
313 }
314  
315 has github => (
316 is => 'ro',
317 isa => 'Str',
318 lazy => 1,
319 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
320 0 my($self) = @_;
321 0 $self->chrome->prompt_yn("create github repo", { default => 1 });
322 },
323 2 );
324  
325 has github_login => (
326 is => 'ro',
327 isa => 'Str',
328 lazy => 1,
329 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
330 0 my($self) = @_;
331 0 $self->chrome->prompt_str("github login", { default => 'plicease' });
332 },
333 2 );
334  
335 has github_user => (
336 is => 'ro',
337 isa => 'Str',
338 lazy => 1,
339 24 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
340 24 my($self) = @_;
341 24 $self->chrome->prompt_str("github user/org", { default => 'uperl' });
342 },
343 2 );
344  
345 has github_private => (
346 is => 'ro',
347 isa => 'Str',
348 lazy => 1,
349 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
350 0 my($self) = @_;
351 0 $self->chrome->prompt_yn("github private", { default => 0 });
352 },
353 2 );
354  
355 has github_pass => (
356 is => 'ro',
357 isa => 'Str',
358 lazy => 1,
359 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
360 0 my($self) = @_;
361 0 $self->chrome->prompt_str("github pass", { noecho => 1 });
362 },
363 2 );
364  
365 has github_auth_token => (
366 is => 'ro',
367 isa => 'Str',
368 lazy => 1,
369 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
370 0 ▶ $ENV{DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_GITHUB_OAUTH_TOKEN} // $ENV{GITHUB_OAUTH_TOKEN};
Condition0%0/3
$ENV{"DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_GITHUB_OAUTH_TOKEN"} // $ENV{"GITHUB_OAUTH_TOKEN"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$ENV{"DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_GITHUB_OAUTH_TOKEN"} // $ENV{"GITHUB_OAUTH_TOKEN"}
$ENV{"DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_GITHUB_OAUTH_TOKEN"} $ENV{"GITHUB_OAUTH_TOKEN"}
Truth table0%0/3
A // B
A= $ENV{"DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_GITHUB_OAUTH_TOKEN"}B= $ENV{"GITHUB_OAUTH_TOKEN"}
ABresult
1X1
011
000
371 },
372 2 );
373  
374 24 ▶ sub after_mint ( $self, $opts )
Subroutine after_mint: called CC=12 SCAR=40.5
Pod undocumented
375 {
376 24 ▶ unless(eval { require Git::Wrapper })
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { require Git::Wrapper } }) 0 24 24
377 {
378 0 $self->zilla->log("no Git::Wrapper, can't create repository");
379 0 return;
380 }
381  
382 24 my $git = Git::Wrapper->new($opts->{mint_root});
383 24 $git->init;
384 24 $git->checkout( '-b' => 'main' );
385 24 $git->commit({ 'allow-empty' => 1, message => "Start with a blank" });
386 24 $git->add($opts->{mint_root});
387 24 $git->commit({ message => "Initial structure" });
388  
389 24 ▶ unless(eval { require LWP::UserAgent; require HTTP::Request })
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { require LWP::UserAgent; require HTTP::Request } }) 0 24 24
390 {
391 0 $self->zilla->log("no LWP, can't create github repo");
392 }
393  
394 24 my $no_github = 1;
395  
396 24 ▶ if($self->github && !$ENV{DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_NO_GITHUB})
Branch: 1 branch
BranchTrueFalseTotal
if ($self->github and not $ENV{"DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_NO_GITHUB"}) 0 24 24
Condition33%1/3
$self->github and not $ENV{"DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_NO_GITHUB"}
!ll&&!rl&&r
2400
MC/DC0%0/2
$self->github and not $ENV{"DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_NO_GITHUB"}
$self->github not $ENV{"DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_NO_GITHUB"}
Truth table33%1/3
A and not(B)
A= $self->githubB= not $ENV{"DIST_ZILLA_PLUGIN_AUTHOR_PLICEASE_INIT2_NO_GITHUB"}
ABresult
0X0
100
111
397 {
398 0 my $ua = LWP::UserAgent->new;
399 0 ▶ my $org = $self->github_user ne $self->github_login
Branch: 1 branch
BranchTrueFalseTotal
$self->github_user ne $self->github_login ? : 0 0 0
400 ? $self->github_user
401 : undef;
402 0 ▶ my $url = $org ? "https://api.github.com/orgs/$org/repos" : 'https://api.github.com/user/repos';
Branch: 1 branch
BranchTrueFalseTotal
$org ? : 0 0 0
403 0 my $request = HTTP::Request->new(
404 POST => $url,
405 );
406  
407 0 ▶ my $data = encode_json({
Branch: 1 branch
BranchTrueFalseTotal
!$org && $self->github_private ? : 0 0 0
Condition0%0/3
not $org and $self->github_private
!ll&&!rl&&r
000
MC/DC0%0/2
not $org and $self->github_private
not $org $self->github_private
Truth table0%0/3
not(A) and B
A= not $orgB= $self->github_private
ABresult
0X0
100
111
408 name => $self->zilla->name,
409 description => $self->abstract,
410 private => (!$org && $self->github_private) ? JSON::PP::true : JSON::PP::false,
411 has_projects => JSON::PP::false,
412 has_wiki => JSON::PP::false,
413 allow_squash_merge => JSON::PP::false,
414 });
415 0 $request->content($data);
416 0 $request->header( 'Content-Length' => length encode_utf8 $data );
417 0 ▶ if($self->github_auth_token)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->github_auth_token) { } 0 0 0
418 {
419 0 $request->header( 'Authorization' => "token @{[ $self->github_auth_token ]}" );
420 }
421 else
422 {
423 0 $request->authorization_basic($self->github_login, $self->github_pass);
424 }
425 0 my $response = $ua->request($request);
426 0 ▶ if($response->is_success)
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
427 {
428 0 $self->zilla->log("created repo at https://github.com/@{[ $self->github_user ]}/@{[ $self->zilla->name ]}");
429 0 $no_github = 0;
430 }
431 else
432 {
433 0 $self->zilla->log("$url");
434 0 $self->zilla->log("$data");
435 0 $self->zilla->log("@{[ $response->code ]} @{[ $response->status_line ]}");
436 0 $self->zilla->log("could not create a github repo!");
437 }
438 }
439  
440 24 $git->remote('add', 'origin', "git\@github.com:" . $self->github_user . '/' . $self->zilla->name . '.git');
441 24 ▶ $git->push('--set-upstream', 'origin', 'main') unless $no_github;
Branch: 1 branch
BranchTrueFalseTotal
unless $no_github 0 24 24
442  
443 24 return;
444 }
445  
446 2 __PACKAGE__->meta->make_immutable;
447 }
448  
449 package Dist::Zilla::Plugin::Author::Plicease::Init2;
450  
451 =pod
452  
453 =encoding UTF-8
454  
455 =head1 NAME
456  
457 Dist::Zilla::Plugin::Author::Plicease::Init2 - Dist::Zilla initialization tasks for Plicease
458  
459 =head1 VERSION
460  
461 version 2.81
462  
463 =head1 DESCRIPTION
464  
465 Create a dist in plicease style.
466  
467 =head1 AUTHOR
468  
469 Graham Ollis <plicease@cpan.org>
470  
471 =head1 COPYRIGHT AND LICENSE
472  
473 This software is copyright (c) 2012-2024 by Graham Ollis.
474  
475 This is free software; you can redistribute it and/or modify it under
476 the same terms as the Perl 5 programming language system itself.
477  
478 =cut
479  
480 __DATA__
« blib/lib/Dist/Zilla/Plugin/Author/Plicease/SpecialPrereqs.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Author/Plicease/ReadmeAnyFromPod.pm »