-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdebug.pm
52 lines (42 loc) · 1.1 KB
/
debug.pm
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/perl
package debug;
use File::Basename qw/dirname/;
use lib dirname(__FILE__);
use jira;
require "config.pl";
use Data::Dumper;
use Getopt::Long;
use IPC::Run qw( run );
use Date::Format;
use Encode;
my ($deleteAll);
Getopt::Long::Configure('bundling');
GetOptions(
"delete-all|d" => \$deleteAll
);
if($deleteAll) {
my $jira = jira->new( Url => $JiraUrl,
Login => $JiraLogin,
Password => $JiraPassword
);
unless ($jira) {
die "Could not login to $JiraUrl\n";
}
$allIssues = $jira->getAllIssues(Project => "WEB", Max => 100);
while (@{$allIssues->{issues}}) {
foreach my $issue (@{$allIssues->{issues}}) {
my $key = $issue->{key};
$key =~ /^[A-Z]+-(\d+)$/;
$jira->deleteIssue(Key => $key);
}
$allIssues = $jira->getAllIssues(Project => "WEB", Max => 100);
}
print "\nAll issues deleted from Jira.";
}
our sub logToFile {
my $content = shift;
open my $fh, ">", "debug.log";
print $fh Dumper $content;
close $fh;
}
1;