ruboty-redmine 0.1.1 → 0.1.2

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: 8954c5d6e58f0f961cf06093a4ad7efa7f78a7fa
4
- data.tar.gz: 48aec6768f7894b233293f7b2f08ee4b546f519f
3
+ metadata.gz: b062698bb23b60cb20b6e98ea1a4083c4b946063
4
+ data.tar.gz: 8d44e0231ff8932167cbc997206ece34d953aa92
5
5
  SHA512:
6
- metadata.gz: 4caf7d7250f4f9695be839b66025a9d4c898e8a6da5d11b942dab10de294895f69748321c1dc90405c4b6e57f17417f5ea98670b17e37f2aaed6bd2b480ac2bd
7
- data.tar.gz: 0e4652589c43d2e18af26cb2156dda7484107c19b87817171e13b6776c5c6ca2ef029bc963522006adc5a7c8b3f5a3fdc212a662eabbca49a133daedce91ce33
6
+ metadata.gz: 6f87ab91688bae1e8e8ddb7c06566a7ff7e87ff6429e97f8ff2f0cd1aa1de28c45bec2bf8c3426411d28e3a8ee990e81fabb40f6efdd0497ed47f47fce0af98c
7
+ data.tar.gz: dc3c757ca0d4c1b5a85dbb05d8715849a925e4eea1178e8243cfcefeca91d3549e2af914e2cdb8398ac5668621fc92e9914aa7dfd714e716868df1c60130f7a9
data/README.md CHANGED
@@ -12,13 +12,6 @@ This plugin is tested only with ruboty-hipchat.
12
12
  > ruboty create issue "subject" "Mobile" project "Feature" tracker
13
13
  ```
14
14
 
15
- You can register aliases:
16
-
17
- ```
18
- > ruboty register redmine alias "mobile" '"Mobile" project "Feature" tracker'
19
- > ruboty create issue "subject" mobile
20
- ```
21
-
22
15
  ### watch issues
23
16
 
24
17
  ```
@@ -46,8 +39,8 @@ You can list and stop watching issues:
46
39
  First, associate Redmine user ID with your name in chat:
47
40
 
48
41
  ```
49
- > ruboty associate redmine user 123 with "bob"
50
- > ruboty associate redmine user 456 with "alice"
42
+ > ruboty redmine user #123 is @bob
43
+ > ruboty redmine user #456 is @alice
51
44
  ```
52
45
 
53
46
  Register tracker:
@@ -15,12 +15,6 @@ module Ruboty
15
15
  description: 'Create a new issue'
16
16
  )
17
17
 
18
- on(
19
- /register redmine alias "(?<name>[^"]+)" ("(?<expand_to>[^"]+)"|'(?<expand_to>[^']+)')/,
20
- name: 'register_alias',
21
- description: 'Register an alias'
22
- )
23
-
24
18
  on(
25
19
  /watch redmine issues in "(?<tracker>[^"]+)" tracker of "(?<project>[^"]+)" project( and assign to (?<assignees>[\d,]+)|)/,
26
20
  name: 'watch_issues',
@@ -40,11 +34,29 @@ module Ruboty
40
34
  )
41
35
 
42
36
  on(
43
- /associate redmine user (?<redmine_id>\d+) with "(?<chat_name>[^"]+)"/,
37
+ /redmine user #(?<redmine_id>\d+) is @(?<chat_name>.+)/,
44
38
  name: 'associate_user',
45
39
  description: 'Associate redmine_id with chat_name',
46
40
  )
47
41
 
42
+ on(
43
+ /redmine stop assigning to (?<redmine_id>\d+)/,
44
+ name: 'stop_assigning',
45
+ description: 'Stop assigning issues to the user',
46
+ )
47
+
48
+ on(
49
+ /redmine start assigning to (?<redmine_id>\d+)/,
50
+ name: 'start_assigning',
51
+ description: 'Start assigning issues to the user',
52
+ )
53
+
54
+ on(
55
+ /redmine list absent users/,
56
+ name: 'list_absent_users',
57
+ description: 'List absent users',
58
+ )
59
+
48
60
  def initialize(*args)
49
61
  super
50
62
 
@@ -58,11 +70,6 @@ module Ruboty
58
70
  req = {}
59
71
  req[:subject] = "#{words.shift} (from #{from_name})"
60
72
 
61
- if words.size == 1
62
- expand_to = alias_for(words.first)
63
- words = parse_arg(expand_to) if expand_to
64
- end
65
-
66
73
  words.each_with_index do |word, i|
67
74
  next if i == 0
68
75
 
@@ -99,11 +106,6 @@ module Ruboty
99
106
  message.reply("Issue created: #{redmine.url_for_issue(issue)}")
100
107
  end
101
108
 
102
- def register_alias(message)
103
- aliases[message[:name]] = message[:expand_to]
104
- message.reply("Registered.")
105
- end
106
-
107
109
  def watch_issues(message)
108
110
  if message[:assignees]
109
111
  assignees = message[:assignees].split(',').map(&:to_i)
@@ -154,6 +156,22 @@ module Ruboty
154
156
  message.reply("Registered.")
155
157
  end
156
158
 
159
+ def stop_assigning(message)
160
+ u = message[:user]
161
+ absent_users << u.to_i
162
+ message.reply("Stop assigning issues to #{u}")
163
+ end
164
+
165
+ def start_assigning(message)
166
+ u = message[:user]
167
+ absent_users.delete(u.to_i)
168
+ message.reply("Start assigning issues to #{u}")
169
+ end
170
+
171
+ def list_absent_users(message)
172
+ message.reply(absent_users.map(&:to_s).join(", "))
173
+ end
174
+
157
175
  private
158
176
 
159
177
  def redmine
@@ -165,14 +183,6 @@ module Ruboty
165
183
  )
166
184
  end
167
185
 
168
- def alias_for(name)
169
- aliases[name]
170
- end
171
-
172
- def aliases
173
- robot.brain.data["#{NAMESPACE}_aliases"] ||= {}
174
- end
175
-
176
186
  def watches
177
187
  robot.brain.data["#{NAMESPACE}_watches"] ||= []
178
188
  end
@@ -181,6 +191,10 @@ module Ruboty
181
191
  robot.brain.data["#{NAMESPACE}_users"] ||= []
182
192
  end
183
193
 
194
+ def absent_users
195
+ robot.brain.data["#{NAMESPACE}_absent_users"] ||= []
196
+ end
197
+
184
198
  def find_user_by_id(id)
185
199
  users.find {|user| user['redmine_id'] == id }
186
200
  end
@@ -222,6 +236,7 @@ module Ruboty
222
236
  assignees = watch['assignees']
223
237
  assignee = nil
224
238
  if !assignees.empty? && !new_issue.assigned_to
239
+ assignees -= absent_users
225
240
  assignee = assignees[watch['assignee_index'] % assignees.size]
226
241
  watch['assignee_index'] += 1
227
242
 
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Redmine
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-redmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-11 00:00:00.000000000 Z
11
+ date: 2015-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty