line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bundler::MultiGem::Utl::InitConfig { |
2
|
2
|
|
|
2
|
|
63118
|
use 5.006; |
|
2
|
|
|
|
|
15
|
|
3
|
2
|
|
|
2
|
|
9
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
31
|
|
4
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
54
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
15
|
use Exporter qw(import); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
84
|
|
7
|
|
|
|
|
|
|
our @EXPORT = qw(ruby_constantize merge_configuration); |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1050
|
use Storable qw(dclone dclone); |
|
2
|
|
|
|
|
5309
|
|
|
2
|
|
|
|
|
128
|
|
10
|
2
|
|
|
2
|
|
870
|
use Hash::Merge qw(merge); |
|
2
|
|
|
|
|
11213
|
|
|
2
|
|
|
|
|
105
|
|
11
|
2
|
|
|
2
|
|
438
|
use common::sense; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
12
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Bundler::MultiGem::Utl::InitConfig - The utility to install multiple versions of the same ruby gem |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Version 0.01 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
This module contains a default configuration for the package to work and the utility functions to manipulate it. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $DEFAULT_CONFIGURATION = { |
28
|
|
|
|
|
|
|
'gem' => { |
29
|
|
|
|
|
|
|
'source' => 'https://rubygems.org', |
30
|
|
|
|
|
|
|
'name' => undef, |
31
|
|
|
|
|
|
|
'main_module' => undef, |
32
|
|
|
|
|
|
|
'versions' => [()] |
33
|
|
|
|
|
|
|
}, |
34
|
|
|
|
|
|
|
'directories' => { |
35
|
|
|
|
|
|
|
'root' => undef, |
36
|
|
|
|
|
|
|
'pkg' => 'pkg', |
37
|
|
|
|
|
|
|
'target' => 'versions' |
38
|
|
|
|
|
|
|
}, |
39
|
|
|
|
|
|
|
'cache' => { |
40
|
|
|
|
|
|
|
'pkg' => 1, |
41
|
|
|
|
|
|
|
'target' => 0 |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 merge_configuration |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
sub merge_configuration { |
52
|
1
|
|
|
1
|
1
|
3468
|
my $custom_config = shift; |
53
|
1
|
|
|
|
|
67
|
my $result = merge($custom_config, dclone($DEFAULT_CONFIGURATION)); |
54
|
1
|
|
|
|
|
339
|
default_main_module($result); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 merge_configuration |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
sub default_main_module { |
61
|
3
|
|
|
3
|
0
|
1920
|
my $custom_config = shift; |
62
|
3
|
|
|
|
|
6
|
my $gem_config = $custom_config->{gem}; |
63
|
3
|
100
|
|
|
|
7
|
if ( !defined $gem_config->{main_module}) { |
64
|
2
|
|
|
|
|
5
|
$gem_config->{main_module} = ruby_constantize($gem_config->{name}); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
$custom_config |
67
|
3
|
|
|
|
|
14
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 ruby_constantize |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
sub ruby_constantize { |
73
|
9
|
|
|
9
|
1
|
484
|
my $name = shift; |
74
|
9
|
|
|
|
|
19
|
for ($name) { |
75
|
9
|
|
|
|
|
40
|
s/_(\w)/\U$1/g; |
76
|
9
|
|
|
|
|
51
|
s/-(\w)/::\U$1/g; |
77
|
|
|
|
|
|
|
} |
78
|
9
|
|
|
|
|
49
|
ucfirst $name; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
}; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |