PluginBundle/GitLab.pm

filter: Statementstmt 67.7% 21 / 31 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 3 / 12 Podpod 0.0% 0 / 1 totaltotal 41.3% 24 / 58 CC 8 SCAR 15.7
CC
8
Cov
47%
__ANON__
6.0
__ANON__
6.0
__ANON__
6.0
CRAP 4.8
« Plugin/GitLab/Update.pm ↑ Summary
1 package Dist::Zilla::PluginBundle::GitLab 1.0002;
2  
3 1 ▶use Modern::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 extends 'Dist::Zilla::Plugin::GitLab';
7 1 with 'Dist::Zilla::Role::PluginBundle::Easy';
8  
9 has '+repo' => (
10 lazy => 1,
11 0 ▶ default => sub { $_[0]->payload->{repo} },
Subroutine __ANON__: not called CC=1 SCAR=6.9
12 1 );
13  
14 # GitLab::Meta
15  
16 has bugs => (
17 is => 'ro',
18 isa => 'Bool',
19 lazy => 1,
20 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
21 0 ▶ defined $_[0]->payload->{bugs} ? $_[0]->payload->{bugs} : 1;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]->payload->{'bugs'} ? : 0 0 0
22 },
23 1 );
24  
25 has fork => (
26 is => 'ro',
27 isa => 'Bool',
28 lazy => 1,
29 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
30 0 ▶ defined $_[0]->payload->{fork} ? $_[0]->payload->{fork} : 1;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]->payload->{'fork'} ? : 0 0 0
31 },
32 1 );
33  
34 has p3rl => (
35 is => 'ro',
36 isa => 'Bool',
37 lazy => 1,
38 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
39 0 ▶ defined $_[0]->payload->{p3rl} ? $_[0]->payload->{p3rl} : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]->payload->{'p3rl'} ? : 0 0 0
40 },
41 1 );
42  
43 has metacpan => (
44 is => 'ro',
45 isa => 'Bool',
46 lazy => 1,
47 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
48 0 ▶ defined $_[0]->payload->{metacpan} ? $_[0]->payload->{metacpan} : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]->payload->{'metacpan'} ? : 0 0 0
49 },
50 1 );
51  
52 has meta_home => (
53 is => 'ro',
54 isa => 'Bool',
55 lazy => 1,
56 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
57 0 ▶ defined $_[0]->payload->{meta_home} ? $_[0]->payload->{meta_home} : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]->payload->{'meta_home'} ? : 0 0 0
58 },
59 1 );
60  
61 has remote => (
62 is => 'ro',
63 isa => 'Maybe[Str]',
64 lazy => 1,
65 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
66 0 ▶ defined $_[0]->payload->{remote} ? $_[0]->payload->{remote} : 'origin';
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]->payload->{'remote'} ? : 0 0 0
67 },
68 1 );
69  
70 has wiki => (
71 is => 'ro',
72 isa => 'Bool',
73 lazy => 1,
74 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
75 0 ▶ defined $_[0]->payload->{wiki} ? $_[0]->payload->{wiki} : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]->payload->{'wiki'} ? : 0 0 0
76 },
77 1 );
78  
79 0 ▶sub configure {
Subroutine configure: not called CC=1 SCAR=6.9
Pod undocumented
80 0 my $self = shift;
81  
82 0 $self->add_plugins(
83 [
84 'GitLab::Meta' => {
85 bugs => $self->bugs,
86 fork => $self->fork,
87 metacpan => $self->metacpan,
88 meta_home => $self->meta_home,
89 p3rl => $self->p3rl,
90 remote => $self->remote,
91 repo => $self->repo,
92 wiki => $self->wiki,
93 }
94 ],
95  
96 [
97 'GitLab::Update' => {
98 repo => $self->repo,
99 }
100 ]
101 );
102 }
103  
104 1 __PACKAGE__->meta->make_immutable;
105  
106 1 1;
107  
108 =pod
109  
110 =encoding UTF-8
111  
112 =head1 NAME
113  
114 Dist::Zilla::PluginBundle::GitLab - Access GitLab functionality to maintain distros from Dist::Zilla
115  
116 =head1 VERSION
117  
118 version 1.0002
119  
120 =head1 SYNOPSIS
121  
122 Configure git with your GitLab credentials:
123  
124 $ git config --global gitlab.user LoginName
125 $ git config --global gitlab.token AccessToken
126  
127 Alternatively you can install L<Config::Identity> and write your credentials
128 in the (optionally GPG-encrypted) C<~/.gitlab> file as follows:
129  
130 login LoginName
131 token AccessToken
132  
133 Set up an access token on GitLab, in your profile under "Personal Access Tokens." You
134 must grant the token the C<api> scope!
135  
136 then, in your F<dist.ini>:
137  
138 [@GitLab]
139 repo = SomeRepo
140  
141 =head1 DESCRIPTION
142  
143 This bundle automatically adds the plugins
144 L<GitLab::Meta|Dist::Zilla::Plugin::GitLab::Meta>
145 and L<GitLab::Update|Dist::Zilla::Plugin::GitLab::Update>.
146  
147 =head1 ATTRIBUTES
148  
149 =over
150  
151 =item C<bugs>
152  
153 The META bugtracker web field will be set to the issue's page of the repository
154 on GitLab, if this options is set to true (default) and if the GitLab Issues happen to
155 be activated (see the GitLab repository's C<Admin> panel).
156  
157 =item C<fork>
158  
159 If the repository is a GitLab fork of another repository this option will make
160 all the information be taken from the original repository instead of the forked
161 one, if it's set to true (default).
162  
163 =item C<metacpan>
164  
165 The GitLab homepage field will be set to the metacpan.org distribution URL
166 (e.g. C<https://metacpan.org/release/Dist-Zilla-Plugin-GitLab>) if this option is set to true
167 (default is false).
168  
169 This takes precedence over the C<p3rl> options (if both are
170 true, metacpan will be used).
171  
172 =item C<meta_home>
173  
174 The GitLab homepage field will be set to the value present in the dist meta
175 (e.g. the one set by other plugins) if this option is set to true (default is
176 false). If no value is present in the dist meta, this option is ignored.
177  
178 This takes precedence over the C<metacpan> and C<p3rl> options (if all
179 three are true, meta_home will be used).
180  
181 =item C<p3rl>
182  
183 The GitLab homepage field will be set to the p3rl.org shortened URL
184 (e.g. C<https://p3rl.org/Dist::Zilla::PluginBundle::GitLab>) if this option is set to true (default is
185 false).
186  
187 =item C<remote>
188  
189 Specifies the git remote name to be used when guessing the repo name (default C<origin>).
190  
191 =item C<repo>
192  
193 The name of the GitLab repository. By default the name will be extracted from
194 the URL of the remote specified in the C<remote> option, and if that fails the
195 dist name (from dist.ini) is used. It can also be in the form C<user/repo>
196 when it belongs to another GitLab user/organization.
197  
198 =item C<wiki>
199  
200 The META homepage field will be set to the URL of the wiki of the GitLab
201 repository, if this option is set to true (default is false) and if the GitLab
202 Wiki happens to be activated (see the GitLab repository's C<Admin> panel).
203  
204 =back
205  
206 =head1 SEE ALSO
207  
208 L<Dist::Zilla::Plugin::GitLab::Meta>, L<Dist::Zilla::Plugin::GitLab::Update>
209  
210 =head1 ACKNOWLEDGEMENTS
211  
212 Alessandro Ghedini <alexbio@cpan.org> made L<Dist::Zilla::PluginBundle::GitLab> from
213 which this module is created. Much of the underlying code is from that module.
214  
215 =head1 AUTHOR
216  
217 D Ruth Holloway <ruth@hiruthie.me>
218  
219 =head1 COPYRIGHT AND LICENSE
220  
221 This software is copyright (c) 2022 by D Ruth Holloway.
222  
223 This is free software; you can redistribute it and/or modify it under
224 the same terms as the Perl 5 programming language system itself.
225  
226 =cut
227  
228 __END__
« Plugin/GitLab/Update.pm ↑ Summary