lita-jira 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jirahelper/regex.rb +1 -0
- data/lib/lita/handlers/jira.rb +27 -0
- data/lita-jira.gemspec +1 -1
- data/locales/en.yml +7 -0
- data/spec/lita/handlers/jira_spec.rb +35 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bb3875a14b8411fc109e2f604e7620ba1b813a2
|
4
|
+
data.tar.gz: 945da5586a8a8bbd0c5b7437d52d30122cae27ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3126e1e246e59c9ee7d72a1764bbb25cb9284e50ac6d946725533f47846c8de99b59368884c963673daa9307ca3e6d3eb2b56f49d61521e3a9974a78c5db2cc3
|
7
|
+
data.tar.gz: 2736cceeb65eab4331ececb8622081c906ae086c433e2f65d975fe5695a9bc8749cc598fdbac675794b438b0f832b292292dc80c4ecc12d9ab4df6ed9a711197
|
data/lib/jirahelper/regex.rb
CHANGED
data/lib/lita/handlers/jira.rb
CHANGED
@@ -16,6 +16,7 @@ module Lita
|
|
16
16
|
config :ignore, required: false, type: Array, default: []
|
17
17
|
config :rooms, required: false, type: Array
|
18
18
|
config :use_ssl, required: false, types: [TrueClass, FalseClass], default: true
|
19
|
+
config :points_field, required: false, type: String
|
19
20
|
|
20
21
|
include ::JiraHelper::Issue
|
21
22
|
include ::JiraHelper::Misc
|
@@ -67,6 +68,15 @@ module Lita
|
|
67
68
|
}
|
68
69
|
)
|
69
70
|
|
71
|
+
route(
|
72
|
+
/^jira\spoint\s#{ISSUE_PATTERN}\sas\s#{POINTS_PATTERN}$/,
|
73
|
+
:point,
|
74
|
+
command: true,
|
75
|
+
help: {
|
76
|
+
t('help.point.syntax') => t('help.point.desc')
|
77
|
+
}
|
78
|
+
)
|
79
|
+
|
70
80
|
# Detect ambient JIRA issues in non-command messages
|
71
81
|
route AMBIENT_PATTERN, :ambient, command: false
|
72
82
|
|
@@ -99,6 +109,13 @@ module Lita
|
|
99
109
|
end
|
100
110
|
|
101
111
|
# rubocop:disable Metrics/AbcSize
|
112
|
+
def point(response)
|
113
|
+
return response.reply(t('error.field_undefined')) if config.points_field.blank?
|
114
|
+
issue = fetch_issue(response.match_data['issue'])
|
115
|
+
return response.reply(t('error.request')) unless issue
|
116
|
+
set_points_on_issue(issue, response)
|
117
|
+
end
|
118
|
+
|
102
119
|
def myissues(response)
|
103
120
|
return response.reply(t('error.not_identified')) unless user_stored?(response.user)
|
104
121
|
|
@@ -130,6 +147,16 @@ module Lita
|
|
130
147
|
def ignored?(user)
|
131
148
|
config.ignore.include?(user.id) || config.ignore.include?(user.mention_name) || config.ignore.include?(user.name)
|
132
149
|
end
|
150
|
+
|
151
|
+
def set_points_on_issue(issue, response)
|
152
|
+
points = response.match_data['points']
|
153
|
+
begin
|
154
|
+
issue.save!(fields: { config.points_field.to_sym => points.to_i })
|
155
|
+
rescue
|
156
|
+
return response.reply(t('error.unable_to_point'))
|
157
|
+
end
|
158
|
+
response.reply(t('point.added', issue: issue.key, points: points))
|
159
|
+
end
|
133
160
|
# rubocop:enable Metrics/AbcSize
|
134
161
|
end
|
135
162
|
# rubocop:enable Metrics/ClassLength
|
data/lita-jira.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'lita-jira'
|
3
|
-
spec.version = '0.8.
|
3
|
+
spec.version = '0.8.1'
|
4
4
|
spec.authors = ['Eric Sigler', 'Matt Critchlow', 'Tristan Chong', 'Lee Briggs']
|
5
5
|
spec.email = ['me@esigler.com', 'matt.critchlow@gmail.com', 'ong@tristaneuan.ch', 'lee@brig.gs']
|
6
6
|
spec.description = 'A JIRA plugin for Lita.'
|
data/locales/en.yml
CHANGED
@@ -6,6 +6,8 @@ en:
|
|
6
6
|
already_identified: "You are already identified as %{email}"
|
7
7
|
not_identified: You do not have an email address on record
|
8
8
|
request: Error fetching JIRA issue
|
9
|
+
field_undefined: You must define `points_field` in your lita_config
|
10
|
+
unable_to_point: Cannot set points on issue
|
9
11
|
help:
|
10
12
|
identify:
|
11
13
|
syntax: jira identify <email address>
|
@@ -19,6 +21,9 @@ en:
|
|
19
21
|
comment:
|
20
22
|
syntax: jira comment on <issue> <comment text>
|
21
23
|
desc: Adds <comment text> to <issue>
|
24
|
+
point:
|
25
|
+
syntax: jira point <issue> as <points>
|
26
|
+
desc: Adds <points> points to <issue>
|
22
27
|
details:
|
23
28
|
syntax: jira details <issue>
|
24
29
|
desc: Shows detailed information for <issue>
|
@@ -42,6 +47,8 @@ en:
|
|
42
47
|
summary: "%{key}: %{summary}"
|
43
48
|
comment:
|
44
49
|
added: "Comment added to %{issue}"
|
50
|
+
point:
|
51
|
+
added: "Added a point estimation of %{points} to %{issue}"
|
45
52
|
myissues:
|
46
53
|
empty: "You do not have any assigned issues. Great job!"
|
47
54
|
info: "Here are issues currently assigned to you:"
|
@@ -13,6 +13,7 @@ describe Lita::Handlers::Jira, lita_handler: true do
|
|
13
13
|
fixVersions: [{ 'name' => 'Sprint 2' }],
|
14
14
|
key: 'XYZ-987')
|
15
15
|
allow(result).to receive('save') { true }
|
16
|
+
allow(result).to receive('save!') { true }
|
16
17
|
allow(result).to receive('fetch') { true }
|
17
18
|
result
|
18
19
|
end
|
@@ -96,6 +97,7 @@ describe Lita::Handlers::Jira, lita_handler: true do
|
|
96
97
|
is_expected.to route_command('jira ABC-123').to(:summary)
|
97
98
|
is_expected.to route_command('jira details ABC-123').to(:details)
|
98
99
|
is_expected.to route_command('jira comment on ABC-123 "You just need a cat"').to(:comment)
|
100
|
+
is_expected.to route_command('jira point ABC-123 as 2').to(:point)
|
99
101
|
is_expected.to route_command('todo ABC "summary text"').to(:todo)
|
100
102
|
is_expected.to route_command('todo ABC "summary text" "subject text"').to(:todo)
|
101
103
|
is_expected.to route_command('jira myissues').to(:myissues)
|
@@ -165,6 +167,39 @@ describe Lita::Handlers::Jira, lita_handler: true do
|
|
165
167
|
end
|
166
168
|
end
|
167
169
|
|
170
|
+
describe '#point' do
|
171
|
+
before(:each) do
|
172
|
+
registry.config.handlers.jira.points_field = 'some_custom_points_field'
|
173
|
+
end
|
174
|
+
|
175
|
+
it 'updates the issue with a story point value' do
|
176
|
+
expect(saved_issue).to receive(:save!).with(fields: { some_custom_points_field: 5 })
|
177
|
+
grab_request(valid_client)
|
178
|
+
send_command('jira point XYZ-987 as 5')
|
179
|
+
expect(replies.last).to eq('Added a point estimation of 5 to XYZ-987')
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'warns the user when the issue is not valid' do
|
183
|
+
grab_request(failed_find_issue)
|
184
|
+
send_command('jira point XYZ-987 as 5')
|
185
|
+
expect(replies.last).to eq('Error fetching JIRA issue')
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'warns the user when the config points_field is not defined' do
|
189
|
+
registry.config.handlers.jira.points_field = ''
|
190
|
+
grab_request(valid_client)
|
191
|
+
send_command('jira point XYZ-987 as 5')
|
192
|
+
expect(replies.last).to eq('You must define `points_field` in your lita_config')
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'warns the user when settings points fails' do
|
196
|
+
allow(saved_issue).to receive(:save!).and_throw(JIRA::HTTPError)
|
197
|
+
grab_request(valid_client)
|
198
|
+
send_command('jira point XYZ-987 as 5')
|
199
|
+
expect(replies.last).to eq('Cannot set points on issue')
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
168
203
|
describe '#todo' do
|
169
204
|
it 'creates a new issue if the project is valid and there is a summary' do
|
170
205
|
grab_request(valid_client)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-jira
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Sigler
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-06-01 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: lita
|