lita-rally 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -3
- data/lib/lita/handlers/rally.rb +87 -7
- data/lita-rally.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85bc9e2da252ab292fd7d432495ef642376d1641
|
4
|
+
data.tar.gz: f06272567e59f70f46b92cf75c91b45dfe39f09f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15e5903b2aec7b0159a255dbeed671270df77660c1d27eadec3a1be93d25e70cd8e86f2063a9530b27f4a8d2c6d74779e88e99401b9f3e2ed18cbe6946c4827c
|
7
|
+
data.tar.gz: 05c8cb34aad76aec59a3e68688c50f500cfecee44c56d1f33403499fddd94c21ff80bea0acc3d2aecca2b2d9f3da981ab0a9f4f723674271827dd627909b07e9
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ corresponding states of the artifact. **Default:**
|
|
36
36
|
'start' => 'Submitted',
|
37
37
|
'pause' => 'Submitted',
|
38
38
|
'backlog' => 'Submitted',
|
39
|
-
'
|
39
|
+
'finish' => 'Fixed',
|
40
40
|
'accept' => 'Closed',
|
41
41
|
}
|
42
42
|
```
|
@@ -97,7 +97,8 @@ Find object with terms
|
|
97
97
|
lita rally find defects <created|closed> between <date1> and <date2>
|
98
98
|
```
|
99
99
|
|
100
|
-
Find rally defects created/closed in certain date range
|
100
|
+
Find rally defects created/closed in certain date range, date format can be
|
101
|
+
**yyyy-mm-dd** **yy-mm-dd** **yyyy/mm/dd** **yy/mm/dd** **mm/dd**
|
101
102
|
|
102
103
|
```
|
103
104
|
lita rally find defects <created|closed> in last <number> days
|
@@ -105,11 +106,17 @@ lita rally find defects <created|closed> in last <number> days
|
|
105
106
|
|
106
107
|
Find rally defects created/closed in last few days
|
107
108
|
|
109
|
+
```
|
110
|
+
rally list <backlog|defined|active|completed> <defect|story|task> in <project>
|
111
|
+
```
|
112
|
+
|
113
|
+
List backlog/defined/active/completed defect/story/task in **project**
|
114
|
+
|
108
115
|
```
|
109
116
|
lita rally query <type> <query_string>
|
110
117
|
```
|
111
118
|
|
112
|
-
Execute raw Rally API query with
|
119
|
+
Execute raw Rally API query with **type** and **query_string**
|
113
120
|
|
114
121
|
```
|
115
122
|
lita rally mine
|
@@ -145,6 +152,14 @@ lita rally <start|pause|finish|accept|backlog> <FormattedID>
|
|
145
152
|
Move object between schedule states: **start** -> **In-Progress**, **pause** ->
|
146
153
|
**Defined**, **finish** -> **Completed**, **backlog** -> **Backlog**.
|
147
154
|
|
155
|
+
```
|
156
|
+
lita rally claim <FormattedID>
|
157
|
+
lita rally assign <FormattedID> to [@]mention
|
158
|
+
```
|
159
|
+
|
160
|
+
**(HipChat Only, require hipchat_token config)** claim a Rally object's
|
161
|
+
ownership or assign the object to another user.
|
162
|
+
|
148
163
|
## License
|
149
164
|
|
150
165
|
[MIT](http://opensource.org/licenses/MIT)
|
data/lib/lita/handlers/rally.rb
CHANGED
@@ -147,28 +147,88 @@ module Lita
|
|
147
147
|
'Find defect objects in date range'
|
148
148
|
})
|
149
149
|
|
150
|
-
route(
|
150
|
+
route(/^rally mine/, :rally_find_mine, command: true, help: {
|
151
151
|
'rally mine' =>
|
152
152
|
'(HipChat Only) Find all defects/stories/tasks belongs to me'
|
153
153
|
})
|
154
154
|
|
155
|
-
route(
|
155
|
+
route(/^rally my (defect|defects|story|stories|task|tasks)/,
|
156
156
|
:rally_find_my, command: true, help: {
|
157
157
|
'rally my <defect|story|task>' =>
|
158
158
|
'(HipChat Only) Find defects/stories/tasks belongs to me'
|
159
159
|
})
|
160
160
|
|
161
|
-
route(
|
161
|
+
route(/^rally for (.+)$/, :rally_find_mention, command: true, help: {
|
162
162
|
'rally for (@)mention' =>
|
163
163
|
'(HipChat Only) Find all defects/stories/tasks belongs to @mention'
|
164
164
|
})
|
165
165
|
|
166
|
-
route(
|
166
|
+
route(/^rally (defect|defects|story|stories|task|tasks) for (.+)$/,
|
167
167
|
:rally_find_mention, command: true, help: {
|
168
168
|
'rally <defect|story|task> for (@)mention' =>
|
169
169
|
'(HipChat Only) Find defects/stories/tasks belongs to @mention'
|
170
170
|
})
|
171
171
|
|
172
|
+
route(/^rally claim ([[:alpha:]]+)(\d+)/,
|
173
|
+
:rally_assign, command: true, help: {
|
174
|
+
'rally claim <FormattedID>' =>
|
175
|
+
"(HipChat Only) claim an object's ownership"
|
176
|
+
})
|
177
|
+
|
178
|
+
route(/^rally assign ([[:alpha:]]+)(\d+) to (.+)$/,
|
179
|
+
:rally_assign, command: true, help: {
|
180
|
+
'rally claim <FormattedID>' =>
|
181
|
+
"(HipChat Only) claim an object's ownership"
|
182
|
+
})
|
183
|
+
|
184
|
+
route(/^rally list (backlog|defined|active|completed) (defect|defects|story|stories|task|tasks) in (.+)/,
|
185
|
+
:rally_list_in_project, command: true, help: {
|
186
|
+
'rally list <backlog|defined|active|completed> ' \
|
187
|
+
'<defect|defects|story|stories|task|tasks> in <project>' =>
|
188
|
+
'List defect/story/task in project'
|
189
|
+
})
|
190
|
+
|
191
|
+
def rally_list_in_project(response)
|
192
|
+
state = response.matches[0][0]
|
193
|
+
type = response.matches[0][1]
|
194
|
+
project = response.matches[0][2].capitalize
|
195
|
+
|
196
|
+
type = 'story' if type == 'stories'
|
197
|
+
type = type[0..-2] if !type.nil? && type[-1] == 's'
|
198
|
+
|
199
|
+
case state
|
200
|
+
when 'defined','completed'
|
201
|
+
state.capitalize!
|
202
|
+
when 'backlog'
|
203
|
+
raise 'There is no backlog state for task!' if type == 'task'
|
204
|
+
state.capitalize!
|
205
|
+
when 'active'
|
206
|
+
state = 'In-Progress'
|
207
|
+
end
|
208
|
+
|
209
|
+
field = (type == 'task' ? 'State' : 'ScheduleState')
|
210
|
+
|
211
|
+
term = "((#{field} = \"#{state}\") AND (Project.name = \"#{project}\"))"
|
212
|
+
|
213
|
+
response.reply(rally_search(type, term, field))
|
214
|
+
|
215
|
+
end
|
216
|
+
|
217
|
+
def rally_assign(response)
|
218
|
+
type = response.matches[0][0].downcase
|
219
|
+
id = response.matches[0][1]
|
220
|
+
owner = response.matches[0][2]
|
221
|
+
|
222
|
+
mention = owner.nil? ? response.user.mention_name : owner
|
223
|
+
|
224
|
+
user = rally_find_user(hipchat_find_user(mention))
|
225
|
+
|
226
|
+
update_object(type, id, 'owner', user, options = {})
|
227
|
+
|
228
|
+
rescue Exception => e
|
229
|
+
response.reply("Error during assignment: #{e}")
|
230
|
+
end
|
231
|
+
|
172
232
|
def rally_find_mention(response)
|
173
233
|
if config.hipchat_token
|
174
234
|
p1 = response.matches[0][0]
|
@@ -181,7 +241,7 @@ module Lita
|
|
181
241
|
[nil, p1]
|
182
242
|
end
|
183
243
|
|
184
|
-
email = hipchat_find_user(user
|
244
|
+
email = hipchat_find_user(user)
|
185
245
|
|
186
246
|
raise "Could not find user's email" unless email
|
187
247
|
|
@@ -595,12 +655,32 @@ module Lita
|
|
595
655
|
)
|
596
656
|
end
|
597
657
|
|
598
|
-
def hipchat_find_user(
|
658
|
+
def hipchat_find_user(mention)
|
599
659
|
JSON.parse(
|
600
|
-
get_hipchat_rest[
|
660
|
+
get_hipchat_rest[
|
661
|
+
"user/@#{mention[0] == '@' ? mention[1..-1] : mention}"
|
662
|
+
].get
|
601
663
|
)['email']
|
602
664
|
end
|
603
665
|
|
666
|
+
def rally_find_user(email)
|
667
|
+
rally = get_rally_api
|
668
|
+
|
669
|
+
result =
|
670
|
+
rally.find(
|
671
|
+
RallyAPI::RallyQuery.new(
|
672
|
+
{
|
673
|
+
type: 'user',
|
674
|
+
query_string: "(EmailAddress = #{email})"
|
675
|
+
}
|
676
|
+
)
|
677
|
+
)
|
678
|
+
|
679
|
+
return nil if result.count == 0
|
680
|
+
|
681
|
+
result[0]
|
682
|
+
end
|
683
|
+
|
604
684
|
end
|
605
685
|
|
606
686
|
Lita.register_handler(Rally)
|
data/lita-rally.gemspec
CHANGED