summaryrefslogtreecommitdiffstats
path: root/tools/Jobs.pm
blob: 4fe00268b1a943ab8a14cc2a0253e6462332ddb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package Jobs;
use File::Basename;
use Tiny;

sub get {
	my $inifile = shift;
	my $jobname = shift;

    # Strip the prefix from job name when using ${bamboo.buildPlanName}
	my $prefix = "Digia Qt Enterprise - Chart component - ";
	$jobname =~ s/$prefix//;

	# read ini file
	my $cfg = Config::Tiny->read( $inifile );
	
	# get section from ini by jobname
	my %job = %{$cfg->{$jobname}};
	if (!%job) {
		die ("Unknown jobname! Check $inifile and bamboo job name.");
	}

	# print out the ini settings
	print "\n\nini file: $inifile\n";
	print "[$jobname]\n";
	foreach (keys %job) {
		print $_ . "=" . $job{$_} . "\n";
	}
	print "\n";
	
	return %job;
}

1;