jira-cli 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/jira +1 -0
- data/lib/jira.rb +2 -10
- data/lib/jira/api.rb +15 -2
- data/lib/jira/commands/sprint.rb +27 -0
- data/lib/jira/commands/transition.rb +5 -2
- data/lib/jira/constants.rb +1 -1
- data/lib/jira/core.rb +3 -3
- data/lib/jira/mixins.rb +10 -2
- metadata +53 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c33b97d4e0ef4210a4bd86b72ac364aecc5a312
|
4
|
+
data.tar.gz: 4792aa28bfcc52b02ba37cf5924d981153accacc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad94d97ffe50d2e80a7af426a5f951f2bdba509d46269dfb15128669ac9e099f9bed27e9a6690c874d6e3b1f37cfdef10166a286c84f7c8ebd4fb2f422bb407d
|
7
|
+
data.tar.gz: 7620cc2000d9bb6efaf2459850ad19cec6490d41b99e8b32ed83bf54b76b2f5c84ae8df7c53fdef1c937811c0a1d32e087a4020c7c3b14d00247664abec3803d
|
data/bin/jira
CHANGED
data/lib/jira.rb
CHANGED
@@ -1,16 +1,8 @@
|
|
1
1
|
# dependencies
|
2
2
|
require 'thor'
|
3
|
-
# core logic
|
4
|
-
require 'jira/constants'
|
5
|
-
require 'jira/core'
|
6
|
-
require 'jira/api'
|
7
|
-
require 'jira/io'
|
8
|
-
require 'jira/format'
|
9
|
-
require 'jira/mixins'
|
10
|
-
require 'jira/exceptions'
|
11
|
-
# include jira/commands/*
|
3
|
+
# core logic and commands
|
12
4
|
Dir.glob(
|
13
|
-
File.dirname(File.absolute_path(__FILE__)) + '/jira
|
5
|
+
File.dirname(File.absolute_path(__FILE__)) + '/jira/**/*.rb',
|
14
6
|
&method(:require)
|
15
7
|
)
|
16
8
|
|
data/lib/jira/api.rb
CHANGED
@@ -1,10 +1,23 @@
|
|
1
1
|
module Jira
|
2
2
|
class API
|
3
3
|
|
4
|
+
TYPES = [
|
5
|
+
:rest,
|
6
|
+
:agile
|
7
|
+
].freeze
|
8
|
+
|
9
|
+
ENDPOINTS = {
|
10
|
+
rest: 'rest/api/2',
|
11
|
+
agile: 'rest/greenhopper/latest'
|
12
|
+
}.freeze
|
13
|
+
|
4
14
|
#
|
5
15
|
# Initialize Jira::API
|
6
16
|
#
|
7
|
-
|
17
|
+
# @param type [Symbol]
|
18
|
+
#
|
19
|
+
def initialize(type)
|
20
|
+
@type = type
|
8
21
|
@client = Faraday.new
|
9
22
|
@client.basic_auth(Jira::Core.username, Jira::Core.password)
|
10
23
|
|
@@ -71,7 +84,7 @@ module Jira
|
|
71
84
|
# @return [String] API endpoint
|
72
85
|
#
|
73
86
|
def endpoint(path)
|
74
|
-
"#{Jira::Core.url}
|
87
|
+
"#{Jira::Core.url}/#{ENDPOINTS[@type]}/#{path}"
|
75
88
|
end
|
76
89
|
|
77
90
|
#
|
data/lib/jira/commands/sprint.rb
CHANGED
@@ -4,6 +4,33 @@ module Jira
|
|
4
4
|
desc "sprint", "Lists all tickets in active sprint"
|
5
5
|
def sprint
|
6
6
|
# TODO
|
7
|
+
self.api(:agile).get(
|
8
|
+
'rapid/charts/sprintreport?rapidViewId=17&sprintId=41'
|
9
|
+
) do |response|
|
10
|
+
groups = {}
|
11
|
+
|
12
|
+
parser = ->(issue){
|
13
|
+
assignee = issue['assignee']
|
14
|
+
status = issue['statusName']
|
15
|
+
groups[assignee] ||= {}
|
16
|
+
groups[assignee][status] ||= []
|
17
|
+
groups[assignee][status] << {
|
18
|
+
ticket: issue['key'],
|
19
|
+
summary: issue['summary']
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
response['contents']['completedIssues'].each{|issue| parser.call(issue)}
|
24
|
+
response['contents']['incompletedIssues'].each{|issue| parser.call(issue)}
|
25
|
+
|
26
|
+
groups.each do |user, status_groups|
|
27
|
+
puts user
|
28
|
+
status_groups.each do |status, tickets|
|
29
|
+
puts " " + status
|
30
|
+
puts " " + tickets.map{|info| info[:ticket] }.join(' ')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
7
34
|
end
|
8
35
|
|
9
36
|
end
|
@@ -10,11 +10,14 @@ module Jira
|
|
10
10
|
end
|
11
11
|
options['Cancel'] = nil
|
12
12
|
|
13
|
-
choice = self.io.choose(
|
13
|
+
choice = self.io.choose(
|
14
|
+
"Transition #{Jira::Format.ticket(ticket)} to",
|
15
|
+
options.keys
|
16
|
+
)
|
14
17
|
if options[choice].nil?
|
15
18
|
puts "No transition was performed on #{ticket}."
|
16
19
|
else
|
17
|
-
self.api_transition(ticket,
|
20
|
+
self.api_transition(ticket, options[choice], choice)
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|
data/lib/jira/constants.rb
CHANGED
data/lib/jira/core.rb
CHANGED
@@ -16,21 +16,21 @@ module Jira
|
|
16
16
|
# @return [String] JIRA project endpoint
|
17
17
|
#
|
18
18
|
def url
|
19
|
-
@url ||= self.read(self.url_path)
|
19
|
+
@url ||= ENV['JIRA_URL'] || self.read(self.url_path)
|
20
20
|
end
|
21
21
|
|
22
22
|
#
|
23
23
|
# @return [String] JIRA username
|
24
24
|
#
|
25
25
|
def username
|
26
|
-
@username ||= self.auth.first
|
26
|
+
@username ||= ENV['JIRA_USERNAME'] || self.auth.first
|
27
27
|
end
|
28
28
|
|
29
29
|
#
|
30
30
|
# @return [String] JIRA password
|
31
31
|
#
|
32
32
|
def password
|
33
|
-
@password ||= self.auth.last
|
33
|
+
@password ||= ENV['JIRA_PASSWORD'] || self.auth.last
|
34
34
|
end
|
35
35
|
|
36
36
|
#
|
data/lib/jira/mixins.rb
CHANGED
@@ -16,11 +16,19 @@ module Jira
|
|
16
16
|
@io ||= Jira::IO.new
|
17
17
|
end
|
18
18
|
|
19
|
+
#
|
20
|
+
# @param [Symbol]
|
19
21
|
#
|
20
22
|
# @return [Jira::API] Jira API class
|
21
23
|
#
|
22
|
-
def api
|
23
|
-
|
24
|
+
def api(type=:rest)
|
25
|
+
key = "@api_#{type}"
|
26
|
+
klass = self.instance_variable_get(key)
|
27
|
+
if klass.nil?
|
28
|
+
klass = Jira::API.new(type)
|
29
|
+
self.instance_variable_set(key, klass)
|
30
|
+
end
|
31
|
+
return klass
|
24
32
|
end
|
25
33
|
|
26
34
|
end
|
metadata
CHANGED
@@ -1,133 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jira-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Lin Cheng
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
20
|
-
- -
|
19
|
+
version: 0.19.1
|
20
|
+
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.19.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - ~>
|
27
|
+
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
30
|
-
- -
|
29
|
+
version: 0.19.1
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.19.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: faraday
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: 0.9.0
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 0.9.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ~>
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: 0.9.0
|
50
|
-
- -
|
50
|
+
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 0.9.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: inquirer
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - ~>
|
57
|
+
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 0.2.0
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: 0.2.0
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - ~>
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: 0.2.0
|
70
|
-
- -
|
70
|
+
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: 0.2.0
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: pry-remote
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- - ~>
|
77
|
+
- - "~>"
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: 0.1.7
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.1.7
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 0.1.7
|
90
|
-
- -
|
90
|
+
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 0.1.7
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: rspec-expectations
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 2.14.0
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 2.14.0
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.14.0
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: 2.14.0
|
93
113
|
- !ruby/object:Gem::Dependency
|
94
114
|
name: rspec
|
95
115
|
requirement: !ruby/object:Gem::Requirement
|
96
116
|
requirements:
|
97
|
-
- - ~>
|
117
|
+
- - "~>"
|
98
118
|
- !ruby/object:Gem::Version
|
99
119
|
version: 2.14.1
|
100
|
-
- -
|
120
|
+
- - ">="
|
101
121
|
- !ruby/object:Gem::Version
|
102
122
|
version: 2.14.1
|
103
123
|
type: :development
|
104
124
|
prerelease: false
|
105
125
|
version_requirements: !ruby/object:Gem::Requirement
|
106
126
|
requirements:
|
107
|
-
- - ~>
|
127
|
+
- - "~>"
|
108
128
|
- !ruby/object:Gem::Version
|
109
129
|
version: 2.14.1
|
110
|
-
- -
|
130
|
+
- - ">="
|
111
131
|
- !ruby/object:Gem::Version
|
112
132
|
version: 2.14.1
|
113
133
|
- !ruby/object:Gem::Dependency
|
114
134
|
name: coveralls
|
115
135
|
requirement: !ruby/object:Gem::Requirement
|
116
136
|
requirements:
|
117
|
-
- - ~>
|
137
|
+
- - "~>"
|
118
138
|
- !ruby/object:Gem::Version
|
119
139
|
version: 0.7.0
|
120
|
-
- -
|
140
|
+
- - ">="
|
121
141
|
- !ruby/object:Gem::Version
|
122
142
|
version: 0.7.0
|
123
143
|
type: :development
|
124
144
|
prerelease: false
|
125
145
|
version_requirements: !ruby/object:Gem::Requirement
|
126
146
|
requirements:
|
127
|
-
- - ~>
|
147
|
+
- - "~>"
|
128
148
|
- !ruby/object:Gem::Version
|
129
149
|
version: 0.7.0
|
130
|
-
- -
|
150
|
+
- - ">="
|
131
151
|
- !ruby/object:Gem::Version
|
132
152
|
version: 0.7.0
|
133
153
|
description: CLI used to manage JIRA workflows leveraging git
|
@@ -169,19 +189,18 @@ require_paths:
|
|
169
189
|
- lib
|
170
190
|
required_ruby_version: !ruby/object:Gem::Requirement
|
171
191
|
requirements:
|
172
|
-
- -
|
192
|
+
- - ">="
|
173
193
|
- !ruby/object:Gem::Version
|
174
194
|
version: '0'
|
175
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
196
|
requirements:
|
177
|
-
- -
|
197
|
+
- - ">="
|
178
198
|
- !ruby/object:Gem::Version
|
179
199
|
version: '0'
|
180
200
|
requirements: []
|
181
201
|
rubyforge_project:
|
182
|
-
rubygems_version: 2.2.
|
202
|
+
rubygems_version: 2.2.2
|
183
203
|
signing_key:
|
184
204
|
specification_version: 4
|
185
205
|
summary: JIRA CLI
|
186
206
|
test_files: []
|
187
|
-
has_rdoc:
|