lita-slack-standup 1.0.1 → 1.1.0

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: 89112ea2047b1056586a00ba012d2512df53e655
4
- data.tar.gz: 73e7b3aed31e7f7a3dc1ad27ee2cbe3e574771c7
3
+ metadata.gz: 38999471fd83dfe57f5adc75dbebb15f93c51fc5
4
+ data.tar.gz: f527dd1672afc7cb7db53c71bf35270094d9e0f3
5
5
  SHA512:
6
- metadata.gz: d4b60e34957088fb7216d253e3b96c07dee1a843b3f139c86b88cf060b41685c06e77380cb16cb359538f01c2e774b8446f3b3e87f2714a1bb256b2b6e1f85c8
7
- data.tar.gz: 1ae64a78fb0e9c86564f5ef8594aaa3be5a23ec74ada631a9c6aae047527739b45f6afbfb0a19f515834075181d523a20c724d31d13c6e61ee74a311f8bd242b
6
+ metadata.gz: 7426edba42c616d3c1146c964e8f7a40edb49043178c04768e20779b8f5161650accf1eb5d257e9412c35fb640d8a23d572a4c4e0b84285279131365d9c32a98
7
+ data.tar.gz: 27effeaa8ba2578fc143105ce37cfdc910e17e7f1670e15cc58c2d45b5d682c47813a539fa1f4c8d7ccf4fb2490a84d2b8562e0f54fe1ad60c51b8bddb332ee6
@@ -43,9 +43,12 @@ module Lita
43
43
  end
44
44
 
45
45
  def reminder
46
- standup_members.each do |user, standup|
47
- send_message("@#{user}", t("sentence.reminder", user: user)) if standup.empty?
46
+ if in_standup.value == "true"
47
+ spam_users_without_report("shame")
48
+ standup_end
48
49
  end
50
+
51
+ spam_users_without_report("reminder")
49
52
  end
50
53
 
51
54
  route(/^standup\s+ignore\s*(.*)$/, :standup_ignore, command: true, help: {t("help.ignore_cmd") => t("help.ignore_description")})
@@ -96,6 +99,12 @@ module Lita
96
99
 
97
100
  private
98
101
 
102
+ def spam_users_without_report(translate_key)
103
+ standup_members.each do |user, standup|
104
+ send_message("@#{user}", t("sentence.#{translate_key}", user: user)) if standup.empty?
105
+ end
106
+ end
107
+
99
108
  def extract_user(message)
100
109
  message.matches[0][0].gsub('@','')
101
110
  end
@@ -176,12 +185,25 @@ module Lita
176
185
 
177
186
  def prewritten_standups_summary
178
187
  standup_members.each do |user, standup|
179
- display_standup(user, standup) unless standup.empty?
188
+ unless standup.empty?
189
+ report = report_as_attachment(user, standup)
190
+ slack_client.chat_postMessage(channel: config.channel, text:"", attachments: report, as_user: true)
191
+ end
180
192
  end
181
193
  end
182
194
 
183
- def display_standup(user, standup)
184
- send_message(config.channel, t("sentence.standup_done",{user: user, standup: standup}))
195
+ def report_as_attachment(user,standup)
196
+ [{
197
+ fallback: t("sentence.fallback_standup_done",{user: user, standup: standup}),
198
+ title: t("sentence.standup_done", user: user),
199
+ text: standup,
200
+ color: name_to_color(user)
201
+ }]
202
+ end
203
+
204
+ def name_to_color(name)
205
+ name.each_char.map { |char| ((char.to_i(36)-10) % 16).to_s(16) }.
206
+ join[0..5].rjust(6,'0')
185
207
  end
186
208
 
187
209
  def save_standup(message)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-slack-standup"
3
- spec.version = "1.0.1"
3
+ spec.version = "1.1.0"
4
4
  spec.authors = ["Sybil Deboin"]
5
5
  spec.email = ["sybil.deboin@gmail.com"]
6
6
  spec.description = "Standup feature for slack"
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.add_runtime_dependency "slack-ruby-client"
20
20
  spec.add_runtime_dependency "redis-objects"
21
21
 
22
+ spec.add_development_dependency "pry"
22
23
  spec.add_development_dependency "bundler", "~> 1.3"
23
24
  spec.add_development_dependency "rake"
24
25
  spec.add_development_dependency "rspec", ">= 3.0.0"
data/locales/en.yml CHANGED
@@ -22,11 +22,13 @@ en:
22
22
  report: "your standup is saved. Thanks :)"
23
23
  next: "Good morning <@%{user}> ! It's your turn."
24
24
  ignore: "<@%{user}> is now ignored."
25
+ shame: "Since you didn't report today, I had to end the meeting without your input :("
25
26
  reminder: "Good evening <@%{user}> ! You can write your standup for tomorrow !standup report hashtagmylife"
26
27
  unignore: "<@%{user}> is now an attendee of the standups"
27
28
  list: "Ignored users : "
28
29
  next_forbidden: "The command is unavailable outside standups."
29
- standup_done: "%{user} has already filled her/his/its standup: \n %{standup}"
30
+ fallback_standup_done: "%{user}'s report : \n %{standup}"
31
+ standup_done: "%{user}'s report"
30
32
  standup_fill: "Standup done in live."
31
33
  already_started: "The standup is already started."
32
34
  end_standup: "That's it ! It's all good for today. Thanks everyone :)"
data/locales/fr.yml CHANGED
@@ -22,11 +22,13 @@ fr:
22
22
  report: "Ton standup est enregistré. Merci :)"
23
23
  next: "Bonjour <@%{user}> ! C'est à ton tour de parler."
24
24
  ignore: "<@%{user}> est désormais ignoré jusqu'à nouvel ordre."
25
+ shame: "Vu que tu n'as pas participé au standup aujourd'hui, j'ai du terminer le standup sans toi :("
25
26
  reminder: "Bonsoir <@%{user}> ! Tu peux donner ton standup pour demain. !standup report 3615mavie"
26
27
  unignore: "<@%{user}> est à nouveau inclus dans les standups."
27
28
  list: "Utilisateurs ignorés : "
28
29
  next_forbidden: "La commande n'est pas disponible en dehors d'un standup."
29
- standup_done: "%{user} a déjà renseigné son standup : \n %{standup}"
30
+ fallback_standup_done: "%{user} a déjà renseigné son standup : \n %{standup}"
31
+ standup_done: "Rapport de %{user}"
30
32
  standup_fill: "Standup fait en live."
31
33
  already_started: "Le standup est déjà en cours."
32
34
  end_standup: "Et voilà ! C'est bon pour aujourd'hui. Merci tout le monde :)"
@@ -9,7 +9,7 @@ describe Lita::Handlers::SlackStandup, lita_handler: true do
9
9
  {'Accept'=>'application/json; charset=utf-8',
10
10
  'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
11
11
  'Content-Type'=>'application/x-www-form-urlencoded',
12
- 'User-Agent'=>'Slack Ruby Client/0.6.0'}
12
+ 'User-Agent'=>'Slack Ruby Client/0.7.0'}
13
13
  }
14
14
 
15
15
  let(:registry) do
@@ -105,11 +105,18 @@ describe Lita::Handlers::SlackStandup, lita_handler: true do
105
105
  end
106
106
 
107
107
  it "displays known reports" do
108
- [ "Hello <!channel> ! Le standup va commencer :)",
109
- "sybil a déjà renseigné son standup : \n My standup report for testing purposes",
110
- "Bonjour <@zaratan> ! C'est à ton tour de parler."
111
- ].each do |text|
112
- expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with({:channel=>channel, :text=>text, :as_user=>true})
108
+ [ {channel: channel, text: "Hello <!channel> ! Le standup va commencer :)", as_user: true},
109
+ {channel: channel, text: "", as_user: true, attachments:
110
+ [{
111
+ fallback: "sybil a déjà renseigné son standup : \n My standup report for testing purposes",
112
+ title: "Rapport de sybil",
113
+ text: "My standup report for testing purposes",
114
+ color: "02818b"
115
+ }]
116
+ },
117
+ {channel: channel, text: "Bonjour <@zaratan> ! C'est à ton tour de parler.", as_user: true}
118
+ ].each do |message_content|
119
+ expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with(message_content)
113
120
  end
114
121
  subject
115
122
  end
@@ -121,15 +128,29 @@ describe Lita::Handlers::SlackStandup, lita_handler: true do
121
128
  end
122
129
 
123
130
  it "displays the standups and ends the meeting" do
124
- [ "Hello <!channel> ! Le standup va commencer :)",
125
- "zaratan a déjà renseigné son standup : \n My standup report for testing purposes",
126
- "sybil a déjà renseigné son standup : \n My standup report for testing purposes",
127
- "Et voilà ! C'est bon pour aujourd'hui. Merci tout le monde :)"
128
- ].each do |text|
129
- expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with({:channel=>channel, :text=>text, :as_user=>true})
131
+ [ {channel: channel, text: "Hello <!channel> ! Le standup va commencer :)", as_user: true},
132
+ {channel: channel, text: "", as_user: true, attachments:
133
+ [{
134
+ fallback: "zaratan a déjà renseigné son standup : \n My standup report for testing purposes",
135
+ title: "Rapport de zaratan",
136
+ text: "My standup report for testing purposes",
137
+ color: "901030"
138
+ }]
139
+ },
140
+ {channel: channel, text: "", as_user: true, attachments:
141
+ [{
142
+ fallback: "sybil a déjà renseigné son standup : \n My standup report for testing purposes",
143
+ title: "Rapport de sybil",
144
+ text: "My standup report for testing purposes",
145
+ color: "02818b"
146
+ }]
147
+ },
148
+ {channel: channel, text: "Et voilà ! C'est bon pour aujourd'hui. Merci tout le monde :)", as_user: true}
149
+ ].each do |message_content|
150
+ expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with(message_content)
151
+ end
152
+ subject
130
153
  end
131
- subject
132
- end
133
154
  end
134
155
  end
135
156
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-slack-standup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sybil Deboin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-03 00:00:00.000000000 Z
11
+ date: 2016-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: bundler
71
85
  requirement: !ruby/object:Gem::Requirement