line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExtUtils::MakeMaker::META_MERGE::GitHub; |
2
|
2
|
|
|
2
|
|
157040
|
use strict; |
|
2
|
|
|
|
|
15
|
|
|
2
|
|
|
|
|
65
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1575
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
6
|
|
|
|
|
|
|
our $PACKAGE = __PACKAGE__; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
ExtUtils::MakeMaker::META_MERGE::GitHub - Perl package to generate ExtUtils::MakeMaker META_MERGE for GitHub repositories |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Run the included script then copy and paste into your Makefile.PL |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
perl-ExtUtils-MakeMaker-META_MERGE-GitHub.pl |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
or |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
perl-ExtUtils-MakeMaker-META_MERGE-GitHub.pl owner repository_name |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Generate the META_MERGE then copy and paste into your Makefile.PL |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use ExtUtils::MakeMaker::META_MERGE::GitHub; |
25
|
|
|
|
|
|
|
use Data::Dumper qw{Dumper}; |
26
|
|
|
|
|
|
|
my $mm = ExtUtils::MakeMaker::META_MERGE::GitHub->new(owner=>"myowner", repo=>"myrepo"); |
27
|
|
|
|
|
|
|
my %META_MERGE = $mm->META_MERGE; |
28
|
|
|
|
|
|
|
print Dumper(\%META_MERGE); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Plugin to your Makefile.PL |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use ExtUtils::MakeMaker; |
33
|
|
|
|
|
|
|
use ExtUtils::MakeMaker::META_MERGE::GitHub; |
34
|
|
|
|
|
|
|
my $mm = ExtUtils::MakeMaker::META_MERGE::GitHub->new(owner=>"myowner", repo=>"myrepo"); |
35
|
|
|
|
|
|
|
WriteMakefile( |
36
|
|
|
|
|
|
|
CONFIGURE_REQUIRES => {'ExtUtils::MakeMaker::META_MERGE::GitHub' => 0}, |
37
|
|
|
|
|
|
|
$mm->META_MERGE, |
38
|
|
|
|
|
|
|
... |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Generates the META_MERGE key and hash value for a normal GitHub repository. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $mm = ExtUtils::MakeMaker::META_MERGE::GitHub->new( |
48
|
|
|
|
|
|
|
owner => "myowner", |
49
|
|
|
|
|
|
|
repo => "myrepo" |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 new |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub new { |
57
|
2
|
|
|
2
|
1
|
195
|
my $this = shift; |
58
|
2
|
50
|
|
|
|
10
|
my $class = ref($this) ? ref($this) : $this; |
59
|
2
|
|
|
|
|
12
|
my $self = {@_}; |
60
|
2
|
|
|
|
|
6
|
bless $self, $class; |
61
|
2
|
|
|
|
|
6
|
return $self; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 METHODS |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 META_MERGE |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Returns then META_MERGE key and a hash reference value for a normal git hub repository. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub META_MERGE { |
73
|
2
|
|
|
2
|
1
|
7261
|
my $self = shift; |
74
|
|
|
|
|
|
|
return ( |
75
|
2
|
|
|
|
|
10
|
META_MERGE => { |
76
|
|
|
|
|
|
|
'meta-spec' => {version => $self->version}, |
77
|
|
|
|
|
|
|
'resources' => { |
78
|
|
|
|
|
|
|
homepage => join('/', $self->base_url, $self->owner, $self->repo), |
79
|
|
|
|
|
|
|
bugtracker => { |
80
|
|
|
|
|
|
|
web => join('/', $self->base_url, $self->owner, $self->repo, 'issues'), |
81
|
|
|
|
|
|
|
}, |
82
|
|
|
|
|
|
|
repository => { |
83
|
|
|
|
|
|
|
type => $self->type, |
84
|
|
|
|
|
|
|
url => join('/', join(':', $self->base_ssh, $self->owner), $self->repo . '.git'), |
85
|
|
|
|
|
|
|
web => join('/', $self->base_url, $self->owner, $self->repo . '.git'), |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
}, |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 PROPERTIES |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 login |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub login { |
99
|
4
|
|
|
4
|
1
|
11
|
my $self = shift; |
100
|
4
|
100
|
|
|
|
13
|
$self->{'login'} = shift if @_; |
101
|
4
|
100
|
|
|
|
19
|
$self->{'login'} = 'git' unless defined $self->{'login'}; |
102
|
4
|
|
|
|
|
18
|
return $self->{'login'}; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 host |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub host { |
110
|
6
|
|
|
6
|
1
|
12
|
my $self = shift; |
111
|
6
|
100
|
|
|
|
20
|
$self->{'host'} = shift if @_; |
112
|
6
|
100
|
|
|
|
19
|
$self->{'host'} = 'github.com' unless defined $self->{'host'}; |
113
|
6
|
|
|
|
|
57
|
return $self->{'host'}; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 owner |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Sets and returns the GitHub account owner login. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub owner { |
123
|
12
|
|
|
12
|
1
|
758
|
my $self = shift; |
124
|
12
|
100
|
|
|
|
32
|
$self->{'owner'} = shift if @_; |
125
|
12
|
50
|
|
|
|
48
|
die("Error: $PACKAGE property owner is required") unless $self->{'owner'}; |
126
|
12
|
|
|
|
|
49
|
return $self->{'owner'}; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 repo |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Sets and returns the GitHub repository name. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub repo { |
136
|
12
|
|
|
12
|
1
|
28
|
my $self = shift; |
137
|
12
|
100
|
|
|
|
52
|
$self->{'repo'} = shift if @_; |
138
|
12
|
50
|
|
|
|
31
|
die("Error: $PACKAGE property repo is required") unless $self->{'repo'}; |
139
|
12
|
|
|
|
|
87
|
return $self->{'repo'}; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head2 protocol |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub protocol { |
147
|
4
|
|
|
4
|
1
|
10
|
my $self = shift; |
148
|
4
|
100
|
|
|
|
12
|
$self->{'protocol'} = shift if @_; |
149
|
4
|
100
|
|
|
|
24
|
$self->{'protocol'} = 'https' unless defined $self->{'protocol'}; |
150
|
4
|
|
|
|
|
17
|
return $self->{'protocol'}; |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head2 version |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Meta-Spec Version |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Default: 2 |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub version { |
163
|
4
|
|
|
4
|
1
|
11
|
my $self = shift; |
164
|
4
|
50
|
|
|
|
14
|
$self->{'version'} = shift if @_; |
165
|
4
|
100
|
|
|
|
21
|
$self->{'version'} = 2 unless $self->{'version'}; |
166
|
4
|
|
|
|
|
20
|
return $self->{'version'}; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head2 type |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Resource Repository Type |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Default: git |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=cut |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
sub type { |
179
|
2
|
|
|
2
|
1
|
16
|
my $self = shift; |
180
|
2
|
50
|
|
|
|
8
|
$self->{'type'} = shift if @_; |
181
|
2
|
50
|
|
|
|
9
|
$self->{'type'} = 'git' unless $self->{'type'}; |
182
|
2
|
|
|
|
|
11
|
return $self->{'type'}; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head2 base_url |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
Base URL for web client requests |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Default: https://github.com |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub base_url { |
194
|
8
|
|
|
8
|
1
|
17
|
my $self = shift; |
195
|
8
|
50
|
|
|
|
22
|
$self->{'base_url'} = shift if @_; |
196
|
8
|
100
|
|
|
|
23
|
$self->{'base_url'} = sprintf('%s://%s', $self->protocol, $self->host) unless $self->{'base_url'}; |
197
|
8
|
|
|
|
|
32
|
return $self->{'base_url'}; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=head2 base_ssh |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Base URL for ssh client requests |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Default: git@github.com |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
sub base_ssh { |
209
|
4
|
|
|
4
|
1
|
8
|
my $self = shift; |
210
|
4
|
50
|
|
|
|
22
|
$self->{'base_ssh'} = shift if @_; |
211
|
4
|
100
|
|
|
|
36
|
$self->{'base_ssh'} = sprintf('%s@%s', $self->login, $self->host) unless $self->{'base_ssh'}; |
212
|
4
|
|
|
|
|
15
|
return $self->{'base_ssh'}; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head1 SEE ALSO |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
L |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
L |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 AUTHOR |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Michael R. Davis |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
Copyright (C) 2022 by Michael R. Davis |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
MIT LICENSE |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=cut |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
1; |