Revision 492,
583 bytes
checked in by iwaim, 15 years ago
(diff) |
vine-spec-skeleton: YAML形式の設定ファイルからパッケージャの情報を追加する機能を実装
|
Line | |
---|
1 | package VineLinux::VSS::ConfigLoader; |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | |
---|
6 | use YAML; |
---|
7 | |
---|
8 | sub new { |
---|
9 | my $class = shift; |
---|
10 | bless {}, $class; |
---|
11 | } |
---|
12 | |
---|
13 | sub load { |
---|
14 | my ($class, $file, $vss) = @_; |
---|
15 | |
---|
16 | my $config; |
---|
17 | if ((!ref($file)) || (-e $file && -r $file)) { |
---|
18 | $config = YAML::LoadFile($file); |
---|
19 | } |
---|
20 | |
---|
21 | if ($config->{packager_name}) { |
---|
22 | $vss->packager_name($config->{packager_name}); |
---|
23 | } |
---|
24 | if ($config->{packager_fullname}) { |
---|
25 | $vss->packager_fullname($config->{packager_fullname}); |
---|
26 | } |
---|
27 | if ($config->{packager_email}) { |
---|
28 | $vss->packager_email($config->{packager_email}); |
---|
29 | } |
---|
30 | } |
---|
31 | |
---|
32 | |
---|
33 | |
---|
34 | 1; |
---|
Note: See
TracBrowser
for help on using the repository browser.