Jobs.pm
33 lines
| 639 B
| text/x-perl
|
PerlLexer
/ tools / Jobs.pm
Jani Honkonen
|
r1134 | package Jobs; | ||
use File::Basename; | ||||
Jani Honkonen
|
r1150 | use Tiny; | ||
Jani Honkonen
|
r1134 | |||
sub get { | ||||
my $inifile = shift; | ||||
my $jobname = shift; | ||||
# Strip the prefix from job name when using ${bamboo.buildPlanName} | ||||
Titta Heikkala
|
r2776 | my $prefix = "Qt Charts component"; | ||
Jani Honkonen
|
r1134 | $jobname =~ s/$prefix//; | ||
# read ini file | ||||
Jani Honkonen
|
r1149 | my $cfg = Config::Tiny->read( $inifile ); | ||
Jani Honkonen
|
r1134 | # get section from ini by jobname | ||
Jani Honkonen
|
r1149 | my %job = %{$cfg->{$jobname}}; | ||
Jani Honkonen
|
r1134 | if (!%job) { | ||
die ("Unknown jobname! Check $inifile and bamboo job name."); | ||||
} | ||||
# print out the ini settings | ||||
Jani Honkonen
|
r1138 | print "\n\nini file: $inifile\n"; | ||
print "[$jobname]\n"; | ||||
Jani Honkonen
|
r1134 | foreach (keys %job) { | ||
Jani Honkonen
|
r1138 | print $_ . "=" . $job{$_} . "\n"; | ||
Jani Honkonen
|
r1134 | } | ||
Jani Honkonen
|
r1138 | print "\n"; | ||
Jani Honkonen
|
r1134 | |||
return %job; | ||||
} | ||||
Titta Heikkala
|
r2776 | 1; | ||