App/Command/codeberg.pm

filter: Statementstmt 96.8% 31 / 32 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 100% 5 / 5 totaltotal 92.5% 50 / 54 CC 7 SCAR 10.3
CC
7
Cov
92%
execute
5.0
_find_plug
3.0
description
2.0
CRAP 2.8
« Plugin/Codeberg/Update.pm ↑ Summary PluginBundle/Codeberg.pm »
1 package Dist::Zilla::App::Command::codeberg 2.0102;
2 2 ▶use Modern::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use Cwd qw(cwd);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use Dist::Zilla::App -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 our $AUTHORITY = 'cpan:GEEKRUTH'; # AUTHORITY
6  
7 ## no critic qw(ProhibitAmbiguousNames)
8 1 ▶sub abstract {'use the Codeberg plugins from the command-line'}
Subroutine abstract: called CC=1 SCAR=0.0
Pod documented
9 0 ▶sub description {'Use the Codeberg plugins from the command-line'}
Subroutine description: not called CC=1 SCAR=6.9
Pod documented
10 3 ▶sub usage_desc {'%c %o [ update | create [<repository>] ]'}
Subroutine usage_desc: called CC=1 SCAR=0.0
Pod documented
11  
12 ## no critic qw(ProhibitCommaSeparatedStatements)
13 3 ▶sub opt_spec {
Subroutine opt_spec: called CC=1 SCAR=0.0
Pod documented
14 [
15 3 'profile|p=s', 'name of the profile to use',
16 { default => 'default' }
17 ],
18  
19 [
20 'provider|P=s', 'name of the profile provider to use',
21 { default => 'Default' }
22 ],
23 ;
24 }
25 ## use critic
26 2 ▶sub execute {
Subroutine execute: called CC=5 SCAR=16.2
Pod documented
27 2 my ( $self, $opt, $arg ) = @_;
28  
29 2 my $zilla = $self->zilla;
30  
31 $_->gather_files
32 2 ▶ for eval { Dist::Zilla::App->VERSION('7.000') }
Branch: 1 branch
BranchTrueFalseTotal
eval { do { 'Dist::Zilla::App'->VERSION('7.000') } } ? : 0 2 2
33 ? $zilla->plugins_with( -FileGatherer )
34 2 : @{ $zilla->plugins_with( -FileGatherer ) };
35  
36 2 ▶ if ( $arg->[0] eq 'create' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($arg->[0] eq 'create') { } 1 1 2
elsif ($arg->[0] eq 'update') { } 1 0 1
37 1 require Dist::Zilla::Dist::Minter;
38  
39 1 my $minter = Dist::Zilla::Dist::Minter->_new_from_profile(
40 [ $opt->provider, $opt->profile ], {
41 chrome => $self->app->chrome,
42 name => $zilla->name,
43 },
44 );
45  
46 1 my $create = _find_plug( $minter, 'Codeberg::Create' );
47 1 my $root = cwd();
48 1 my $repo = $arg->[1];
49 1 $create->after_mint(
50 {
51 mint_root => $root,
52 repo => $repo,
53 description => $zilla->abstract
54 }
55 );
56 }
57 elsif ( $arg->[0] eq 'update' ) {
58 1 _find_plug( $zilla, 'Codeberg::Update' )->after_release;
59 }
60 }
61  
62 2 ▶sub _find_plug {
Subroutine _find_plug: called CC=3 SCAR=11.0
63 2 my ( $self, $name ) = @_;
64  
65 2 foreach ( @{ $self->plugins } ) {
66 3 ▶ return $_ if $_->plugin_name =~ /$name/;
Branch: 1 branch
BranchTrueFalseTotal
if $_->plugin_name =~ /$name/u 2 1 3
67 }
68 }
69  
70 2 1;
71  
72 =pod
73  
74 =encoding UTF-8
75  
76 =head1 NAME
77  
78 Dist::Zilla::App::Command::codeberg - Use the Codeberg plugins from the command-line
79  
80 =head1 VERSION
81  
82 version 2.0102
83  
84 =head1 SYNOPSIS
85  
86 # create a new Codeberg repository for your dist
87 $ dzil codeberg create [<repository>]
88  
89 # update Codeberg repo information
90 $ dzil codeberg update
91  
92 =head1 AUTHOR
93  
94 D Ruth Holloway <ruth@hiruthie.me>
95  
96 =head1 COPYRIGHT AND LICENSE
97  
98 This software is copyright (c) 2026 by D Ruth Holloway.
99  
100 This is free software; you can redistribute it and/or modify it under
101 the same terms as the Perl 5 programming language system itself.
102  
103 =cut
104  
105 __END__
« Plugin/Codeberg/Update.pm ↑ Summary PluginBundle/Codeberg.pm »