jira-cli 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 049479b74d7e3b923ec62c844e16bc5962540075
4
- data.tar.gz: 1033a9b5c1a5f36439e448ea8b7013f7a187c1f6
3
+ metadata.gz: e2036d8670e831787e5b06238d5989db70d5d28e
4
+ data.tar.gz: 04a472335c54b49ca44dd7af30fe670a61f2863b
5
5
  SHA512:
6
- metadata.gz: a7001f018aea98d4a5ef97c71fbaaf2771653ccc82ad47e03c58115252fde08b03c4ec66c7266875ff6a32be242e5cfd508253fbee99f98c1316d6a3a7173444
7
- data.tar.gz: fd6b4edf8688c04a67d7bf782b7273f0ee97063a753ecf66e2e863c254813df77b8440f7731728c08ff3b13b2364b8a2f6d69205dd2d8bbc27be0fcaadc0c30a
6
+ metadata.gz: 51286f2fa3d9a52b79ad227ae62a646834881226204e66c828ba50c2e6c37bdc60bf494c16d69cdee8ce65b827e2e2355a5d0700ca5ed74f72c091cc6d1e4c5d
7
+ data.tar.gz: 623822ac5a21589ee525683829f69c41bc407ba14261b8122d647c28f0de9155894188dd363b49b43760d27d87dd1e61cc35dc921c4ed836406265c9e5d4bc2e
@@ -3,7 +3,7 @@ module Jira
3
3
 
4
4
  desc "describe", "Describes the input ticket"
5
5
  def describe(ticket=Jira::Core.ticket)
6
- puts description(ticket.strip)
6
+ puts description(ticket.strip, false, true)
7
7
  end
8
8
 
9
9
  desc "all", "Describes all local branches that match JIRA ticketing syntax"
@@ -30,17 +30,20 @@ module Jira
30
30
  # asynchronously fetch and describe tickets
31
31
  output = ""
32
32
  threads = []
33
- threads << Thread.new{ puts description(tickets[:current], true) }
33
+ if Jira::Core.ticket?(tickets[:current])
34
+ threads << Thread.new{ puts description(tickets[:current], true) }
35
+ end
34
36
  mutex = Mutex.new
35
37
  tickets[:others].each do |ticket|
36
38
  threads << Thread.new do
37
39
  out = description(ticket) + "\n"
38
- mutex.synchronize{ output << out }
40
+ if !out.strip.empty?
41
+ mutex.synchronize{ output << out }
42
+ end
39
43
  end
40
44
  end
41
45
  threads.each{ |thread| thread.join }
42
-
43
- puts output
46
+ puts output if !output.empty?
44
47
  end
45
48
 
46
49
  protected
@@ -53,16 +56,22 @@ module Jira
53
56
  #
54
57
  # @return [String] formatted summary string
55
58
  #
56
- def description(ticket, star=false)
59
+ def description(ticket, star=false, verbose=false)
57
60
  json = @api.get("issue/#{ticket}")
58
- summary = json['fields']['summary']
59
- status = json['fields']['status']['name']
60
- assignee = json['fields']['assignee']['name']
61
- return Jira::Format.ticket(ticket) +
62
- (star ? Jira::Format.star : " ") + " " +
63
- ("(" + Jira::Format.user(assignee) + ")").ljust(20) +
64
- Jira::Format.status(status).ljust(26) +
65
- Jira::Format.summary(summary)
61
+ if json['errorMessages'].nil?
62
+ summary = json['fields']['summary']
63
+ status = json['fields']['status']['name']
64
+ assignee = json['fields']['assignee']['name']
65
+ return Jira::Format.ticket(ticket) +
66
+ (star ? Jira::Format.star : " ") + " " +
67
+ ("(" + Jira::Format.user(assignee) + ")").ljust(20) +
68
+ Jira::Format.status(status).ljust(26) +
69
+ Jira::Format.summary(summary)
70
+ elsif verbose
71
+ return json['errorMessages'].join('. ')
72
+ else
73
+ return ""
74
+ end
66
75
  end
67
76
 
68
77
  end
@@ -1,5 +1,5 @@
1
1
  module Jira
2
2
 
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
 
5
5
  end
data/lib/jira/core.rb CHANGED
@@ -49,7 +49,7 @@ module Jira
49
49
  # @return [Boolean] whether input string matches JIRA ticket syntax
50
50
  #
51
51
  def ticket?(ticket)
52
- !!ticket[/^[a-zA-Z]+-[0-9]+$/]
52
+ !!ticket.to_s[/^[a-zA-Z]+-[0-9]+$/]
53
53
  end
54
54
 
55
55
  ### Relevant Paths
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jira-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Lin Cheng