forked from pdurbin/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathredmine
executable file
·46 lines (38 loc) · 1.05 KB
/
redmine
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
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
use JSON;
use Data::Dumper;
my $pdurbin = 4;
my $leonid = 11;
my $user;
$user = $pdurbin;
#$user = $leonid;
my $base_url = 'https://redmine.hmdc.harvard.edu';
my $issues_json = "$base_url/issues.json?assigned_to_id=$user";
my $content = get($issues_json);
die "Couldn't download $issues_json " unless defined $content;
my $data = from_json($content);
for my $i ( sort by_priority @{ $$data{issues} } ) {
printf(
@ARGV && $ARGV[0] eq '-v'
? "%s %s (%s)\n - %s %s, %s %s, %s\n - %s\n\n"
: "%s %s (%s)\n",
"#$i->{id}",
$i->{subject},
$i->{fixed_version}{name} || '?.?',
"$i->{priority}{name} priority",
lc( $i->{tracker}{name} || '?' ),
lc("$i->{status}{name} for"),
$i->{fixed_version}{name} || '?.?',
"$i->{done_ratio}% done",
"$base_url/issues/$i->{id}",
);
}
sub by_release {
$$a{fixed_version}{name} <=> $$b{fixed_version}{name};
}
sub by_priority {
$$b{priority}{id} <=> $$a{priority}{id};
}