jiraa 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/jiraa +19 -60
- data/jiraa.gemspec +1 -1
- data/lib/jiraa.rb +2 -3
- data/lib/jiraa/formatters/issue.rb +52 -0
- data/lib/jiraa/formatters/issue_list.rb +30 -0
- data/lib/jiraa/version.rb +1 -1
- metadata +6 -4
data/bin/jiraa
CHANGED
@@ -3,14 +3,7 @@ require 'gli'
|
|
3
3
|
require 'jira_client'
|
4
4
|
require 'yaml'
|
5
5
|
require 'colorize'
|
6
|
-
begin # XXX: Remove this begin/rescue before distributing your app
|
7
6
|
require 'jiraa'
|
8
|
-
rescue LoadError
|
9
|
-
STDERR.puts "In development, you need to use `bundle exec bin/jiraa` to run your app"
|
10
|
-
STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
|
11
|
-
STDERR.puts "Feel free to remove this message from bin/jiraa now"
|
12
|
-
exit 64
|
13
|
-
end
|
14
7
|
|
15
8
|
include GLI::App
|
16
9
|
|
@@ -19,7 +12,6 @@ program_desc 'Command line application for accessing the Jira 5 API'
|
|
19
12
|
desc 'Display version information'
|
20
13
|
version Jiraa::VERSION
|
21
14
|
|
22
|
-
|
23
15
|
desc 'The base URL of your Jira instance (e.g. https://jira.company.com)'
|
24
16
|
arg_name 'URL'
|
25
17
|
flag [:U,:url]
|
@@ -169,39 +161,13 @@ command :show do |c|
|
|
169
161
|
|
170
162
|
c.action do |global_options,options,args|
|
171
163
|
help_now! "Missing issue key" if args.length == 0
|
172
|
-
fields = [:summary, :status, :issuetype]
|
164
|
+
fields = [:summary, :status, :issuetype, :assignee]
|
173
165
|
fields << :description if options[:description]
|
174
166
|
fields << :subtasks if options[:subtasks]
|
175
167
|
fields << :comment if options[:comments]
|
176
168
|
issue = JiraClient.find_issue_by_key(args[0], :fields => fields)
|
177
|
-
|
178
|
-
|
179
|
-
puts "#{header} [#{issue.status.name.upcase}]"
|
180
|
-
if options[:subtasks]
|
181
|
-
puts
|
182
|
-
puts "SUBTASKS"
|
183
|
-
puts
|
184
|
-
issue.subtasks.each do |subtask|
|
185
|
-
puts " #{subtask.key}\t#{subtask.summary} [#{subtask.status.name.upcase}]"
|
186
|
-
end
|
187
|
-
puts
|
188
|
-
end
|
189
|
-
if options[:description]
|
190
|
-
puts
|
191
|
-
puts "DESCRIPTION"
|
192
|
-
puts
|
193
|
-
puts " #{issue.description}".gsub("\n", "\n ") if options[:description]
|
194
|
-
end
|
195
|
-
if options[:comments]
|
196
|
-
puts
|
197
|
-
puts "COMMENTS"
|
198
|
-
puts
|
199
|
-
issue.comments.each do |comment|
|
200
|
-
puts " #{comment.author}: #{comment.created.strftime("%e-%b-%Y (%H:%M)")}"
|
201
|
-
puts " #{comment.body}"
|
202
|
-
puts
|
203
|
-
end
|
204
|
-
end
|
169
|
+
formatter = Jiraa::Formatters::Issue.new(issue, options)
|
170
|
+
formatter.format
|
205
171
|
end
|
206
172
|
end
|
207
173
|
|
@@ -210,23 +176,28 @@ arg_name 'JQL'
|
|
210
176
|
command :search do |c|
|
211
177
|
c.action do |global_options,options,args|
|
212
178
|
help_now! "Missing JQL statement" if args.length == 0
|
213
|
-
issues = JiraClient.find_issues(:jql => args[0], :fields => [:summary, :status, :issuetype])
|
214
|
-
|
215
|
-
|
216
|
-
puts "#{issue.key}\t#{issue.summary}".colorize(color)
|
217
|
-
end
|
218
|
-
puts "No issues found" if issues.empty?
|
179
|
+
issues = JiraClient.find_issues(:jql => args[0], :fields => [:summary, :status, :issuetype, :assignee])
|
180
|
+
formatter = Jiraa::Formatters::IssueList.new(issues)
|
181
|
+
formatter.format
|
219
182
|
end
|
220
183
|
end
|
221
184
|
|
222
185
|
desc 'Display issues currently in progress and assigned to you'
|
223
186
|
command :current do |c|
|
224
187
|
c.action do |global_options,options,args|
|
225
|
-
issues = JiraClient.find_issues(:jql => "assignee = currentUser() AND status = 'In Progress'", :fields => [:summary, :status])
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
188
|
+
issues = JiraClient.find_issues(:jql => "assignee = currentUser() AND status = 'In Progress'", :fields => [:summary, :status, :issuetype, :assignee])
|
189
|
+
formatter = Jiraa::Formatters::IssueList.new(issues)
|
190
|
+
formatter.format
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
desc 'Comment on an issue'
|
195
|
+
arg_name 'ISSUE COMMENT'
|
196
|
+
command :comment do |c|
|
197
|
+
c.action do |global_options, options, args|
|
198
|
+
help_now! unless args.length == 2
|
199
|
+
JiraClient.comment_on_issue(args[0], args[1])
|
200
|
+
puts "Commented on #{args[0]}"
|
230
201
|
end
|
231
202
|
end
|
232
203
|
|
@@ -294,16 +265,4 @@ def configure_client(config)
|
|
294
265
|
end
|
295
266
|
end
|
296
267
|
|
297
|
-
def issue_color(issue)
|
298
|
-
color = case issue.issuetype.name
|
299
|
-
when "Bug"
|
300
|
-
:red
|
301
|
-
when "Task"
|
302
|
-
:blue
|
303
|
-
when "Story"
|
304
|
-
:green
|
305
|
-
end
|
306
|
-
color
|
307
|
-
end
|
308
|
-
|
309
268
|
exit run(ARGV)
|
data/jiraa.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "aruba"
|
24
24
|
spec.add_development_dependency "cucumber"
|
25
25
|
|
26
|
-
spec.add_runtime_dependency "jira_client", ">= 1.0.
|
26
|
+
spec.add_runtime_dependency "jira_client", ">= 1.0.2"
|
27
27
|
spec.add_runtime_dependency "gli", "2.5.6"
|
28
28
|
spec.add_runtime_dependency "colorize", "0.5.8"
|
29
29
|
end
|
data/lib/jiraa.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
module Jiraa
|
2
|
+
module Formatters
|
3
|
+
class Issue
|
4
|
+
def initialize(issue, opts)
|
5
|
+
@issue = issue
|
6
|
+
@options = opts
|
7
|
+
end
|
8
|
+
|
9
|
+
def format
|
10
|
+
color = issue_color(@issue.issuetype)
|
11
|
+
puts "#{@issue.key}\t#{@issue.summary} [#{@issue.status.name.upcase}] (#{@issue.assignee})".colorize(color)
|
12
|
+
if @options[:subtasks]
|
13
|
+
puts
|
14
|
+
puts "SUBTASKS"
|
15
|
+
puts
|
16
|
+
@issue.subtasks.each do |subtask|
|
17
|
+
puts " #{subtask.key}\t#{subtask.summary} [#{subtask.status.name.upcase}]"
|
18
|
+
end
|
19
|
+
puts
|
20
|
+
end
|
21
|
+
if @options[:description]
|
22
|
+
puts
|
23
|
+
puts "DESCRIPTION"
|
24
|
+
puts
|
25
|
+
puts " #{@issue.description}".gsub("\n", "\n ") if @options[:description]
|
26
|
+
end
|
27
|
+
if @options[:comments]
|
28
|
+
puts
|
29
|
+
puts "COMMENTS"
|
30
|
+
puts
|
31
|
+
@issue.comments.each do |comment|
|
32
|
+
puts " #{comment.author}: #{comment.created.strftime("%e-%b-%Y (%H:%M)")}"
|
33
|
+
puts " #{comment.body}".gsub("\n", "\n ")
|
34
|
+
puts
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def issue_color(type)
|
40
|
+
color = case type.name
|
41
|
+
when "Bug"
|
42
|
+
:red
|
43
|
+
when "Task"
|
44
|
+
:blue
|
45
|
+
when "Story"
|
46
|
+
:green
|
47
|
+
end
|
48
|
+
color
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Jiraa
|
2
|
+
module Formatters
|
3
|
+
class IssueList
|
4
|
+
def initialize(issues)
|
5
|
+
@issues = issues
|
6
|
+
end
|
7
|
+
|
8
|
+
def format
|
9
|
+
@issues.each do |issue|
|
10
|
+
color = issue_color(issue.issuetype)
|
11
|
+
puts "#{issue.key}\t#{issue.summary} [#{issue.status.name.upcase}] (#{issue.assignee})".colorize(color)
|
12
|
+
end
|
13
|
+
puts "No issues found" if @issues.empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
def issue_color(type)
|
17
|
+
color = case type.name
|
18
|
+
when "Bug"
|
19
|
+
:red
|
20
|
+
when "Task"
|
21
|
+
:blue
|
22
|
+
when "Story"
|
23
|
+
:green
|
24
|
+
end
|
25
|
+
color
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/jiraa/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jiraa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ! '>='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 1.0.
|
85
|
+
version: 1.0.2
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.0.
|
93
|
+
version: 1.0.2
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: gli
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,6 +143,8 @@ files:
|
|
143
143
|
- jiraa.gemspec
|
144
144
|
- jiraa.rdoc
|
145
145
|
- lib/jiraa.rb
|
146
|
+
- lib/jiraa/formatters/issue.rb
|
147
|
+
- lib/jiraa/formatters/issue_list.rb
|
146
148
|
- lib/jiraa/version.rb
|
147
149
|
- test/default_test.rb
|
148
150
|
- test/test_helper.rb
|