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