lita-slack-standup 0.1.1 → 0.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 +10 -11
- data/lib/lita/handlers/slack_standup.rb +50 -37
- data/lita-slack-standup.gemspec +1 -1
- data/locales/en.yml +1 -1
- data/spec/lita/handlers/slack_standup_spec.rb +42 -47
- 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: 88e73917d16c70d9f71ad82a693d952710200309
|
4
|
+
data.tar.gz: 593553562ef488af54ccedcbc829535c9edb0f1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2df34d19c44e6fa3b9005c8954e71454f5818dceedcc335b065353bc9e20e109a620ecc326cb343e33364e381fa152247d196f7c890f92bbb91ee5f8f3ae84ca
|
7
|
+
data.tar.gz: 1426c5fd4cb1302d7ec8d7491ca0e1698bc9b329da552fe1e985d061a65106726c24120fe1795b34c96b98d1aaf6811aa610c7d44a3508420f658520c0556c36
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# lita-lack-tandup
|
2
2
|
|
3
|
-
lita-slack-standup is a gem for Lita (https://www.lita.io/), a chat bot written in ruby.
|
3
|
+
lita-slack-standup is a gem for Lita (https://www.lita.io/), a chat bot written in ruby.
|
4
4
|
It handles standup meetings on slack (the sentences are in french for now).
|
5
5
|
|
6
6
|
## Installation
|
@@ -16,7 +16,6 @@ gem "lita-standup"
|
|
16
16
|
In your lita configuration file (lita_config.rb), add the lines :
|
17
17
|
``` ruby
|
18
18
|
Lita.congifure do |config|
|
19
|
-
## standup
|
20
19
|
config.handlers.slack_standup.channel = ENV['STANDUP_CHANNEL']
|
21
20
|
end
|
22
21
|
```
|
@@ -25,16 +24,16 @@ And set the environment variable STANDUP_CHANNEL, with the name of the channel w
|
|
25
24
|
|
26
25
|
## Test
|
27
26
|
|
28
|
-
We used VCR generated by real standups on slack.
|
29
|
-
|
27
|
+
We used VCR generated by real standups on slack. We had to delete them for privacy reasons.
|
28
|
+
To rerun the tests and recreate some VCR, you need to bundle the gem into a lita bot.
|
30
29
|
|
31
30
|
## Usage
|
32
31
|
|
33
|
-
- !start
|
34
|
-
- !next
|
35
|
-
- !standup <some standup report> : saves your standup. If you do it before the start of the standup, you won't be asked to report. The bot will displays your standup in your stead
|
36
|
-
- !ignore <some user> : ignores an user for the standups
|
37
|
-
- !unignore <some user> : unignores an user
|
38
|
-
- !list
|
39
|
-
|
32
|
+
- !standup start : launches the standup, prints the standups already filled and asks for someone else to report
|
33
|
+
- !standup next : skips the current user and asks the next user to do his standup report
|
34
|
+
- !standup report <some standup report> : saves your standup. If you do it before the start of the standup, you won't be asked to report. The bot will displays your standup in your stead
|
35
|
+
- !standup ignore <some user> : ignores an user for the standups
|
36
|
+
- !standup unignore <some user> : unignores an user
|
37
|
+
- !standup list : list all ignored users
|
38
|
+
|
40
39
|
The standup stops when everyone has done his report or has been skipped.
|
@@ -5,82 +5,96 @@ module Lita
|
|
5
5
|
|
6
6
|
config :channel
|
7
7
|
|
8
|
-
route(/^
|
8
|
+
route(/^standup\s*start?/, :standup_start, command: true, help: {"standup start" => "Lance le standup." })
|
9
9
|
|
10
|
-
def
|
10
|
+
def standup_start(message=nil)
|
11
11
|
in_standup.value = 'true'
|
12
12
|
setup_redis_objects
|
13
13
|
send_message(config.channel, 'Hello <!channel> ! Le standup va commencer : )')
|
14
14
|
prewritten_standups_summary
|
15
|
-
|
15
|
+
standup_next
|
16
16
|
end
|
17
17
|
|
18
|
-
route(/^standup\s*(.*)$/, :
|
18
|
+
route(/^standup\s*report\s*(.*)$/, :standup_report, command: true, help: {"standup report TEXT" => "Permet d'écrire son standup à l'avance ou pendant le tour d'un autre."})
|
19
19
|
|
20
|
-
def
|
20
|
+
def standup_report(message)
|
21
21
|
setup_redis_objects
|
22
22
|
save_standup message
|
23
23
|
message.reply("Ton standup est enregistré. Merci :)")
|
24
24
|
end
|
25
25
|
|
26
|
-
route(/^
|
26
|
+
route(/^standup\s*next?/, :standup_next, command: true, help: {"standup next" => "Passe à l'utilisateur suivant et considère le standup précédent comme fait."})
|
27
27
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
send_message(config.channel,"Bonjour <@#{next_attendee}> ! C'est à ton tour de parler.")
|
35
|
-
fill_standup(next_attendee)
|
36
|
-
end
|
28
|
+
def standup_next(message=nil)
|
29
|
+
setup_redis_objects
|
30
|
+
return unless standup_check?
|
31
|
+
|
32
|
+
if standup_members.none? { |user, standup| standup.empty? }
|
33
|
+
standup_end
|
37
34
|
else
|
38
|
-
|
35
|
+
next_attendee = select_next_standup
|
36
|
+
send_message(config.channel,"Bonjour <@#{next_attendee}> ! C'est à ton tour de parler.")
|
37
|
+
fill_standup(next_attendee)
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
41
|
def reminder
|
42
|
+
setup_redis_objects
|
43
43
|
standup_members.each do |user, standup|
|
44
44
|
send_message("@#{user}","Bonsoir <@#{user}> ! Tu peux donner ton standup pour demain. !standup 3615mavie") if standup.empty?
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
route(/^
|
48
|
+
route(/^standup*\signore\s*(.*)$/, :standup_ignore, command: true, help: {"standup ignore USER" => "Retire un utilisateur de la liste des personnes ayant à faire le standup"})
|
49
49
|
|
50
|
-
def
|
50
|
+
def standup_ignore(message)
|
51
|
+
setup_redis_objects
|
51
52
|
user = message.matches[0][0].gsub('@','')
|
53
|
+
|
52
54
|
unless ignored_members.include? user
|
53
55
|
ignored_members << user
|
54
56
|
standup_members.delete(user)
|
55
57
|
end
|
58
|
+
|
56
59
|
message.reply("<@#{user}> est désormais ignoré jusqu'à nouvel ordre.")
|
57
60
|
end
|
58
61
|
|
59
|
-
route(/^
|
62
|
+
route(/^standup*\sunignore\s*(.*)$/, :standup_unignore, command: true, help: {"standup unignore USER" => "Remet l'utilisateur dans la liste des personnes participant aux standups."})
|
60
63
|
|
61
|
-
def
|
64
|
+
def standup_unignore(message)
|
65
|
+
setup_redis_objects
|
62
66
|
user = message.matches[0][0].gsub('@','')
|
67
|
+
|
63
68
|
if ignored_members.include? user
|
64
69
|
ignored_members.delete(user)
|
65
70
|
standup_members[user] = ''
|
66
71
|
end
|
72
|
+
|
67
73
|
message.reply("<@#{user}> est à nouveau inclus dans les standups.")
|
68
74
|
end
|
69
75
|
|
70
|
-
route(/^
|
76
|
+
route(/^standup\s*list?/, :standup_list, command: true, help: {"standup list" => "Liste les utilisateurs ignorés."})
|
71
77
|
|
72
|
-
def
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
+
def standup_list(message)
|
79
|
+
setup_redis_objects
|
80
|
+
message.reply(
|
81
|
+
ignored_members.inject("Utilisateurs ignorés : ") do |reply, user|
|
82
|
+
reply += "#{user} "
|
83
|
+
end
|
84
|
+
)
|
78
85
|
end
|
79
86
|
|
80
87
|
private
|
81
88
|
|
89
|
+
def standup_check?
|
90
|
+
if in_standup.value != 'true'
|
91
|
+
send_message(config.channel,"La commande n'est pas disponible en dehors d'un standup.")
|
92
|
+
end
|
93
|
+
in_standup.value == 'true'
|
94
|
+
end
|
95
|
+
|
82
96
|
def in_standup
|
83
|
-
@in_standup ||= Redis::Value.new('in_standup', redis
|
97
|
+
@in_standup ||= Redis::Value.new('in_standup', redis)
|
84
98
|
end
|
85
99
|
|
86
100
|
def ignored_members
|
@@ -88,8 +102,8 @@ module Lita
|
|
88
102
|
end
|
89
103
|
|
90
104
|
def setup_redis_objects
|
91
|
-
|
92
|
-
|
105
|
+
update_ids_to_members if ids_to_members.empty?
|
106
|
+
update_standup_members if standup_members.empty?
|
93
107
|
end
|
94
108
|
|
95
109
|
def standup_members
|
@@ -97,10 +111,9 @@ module Lita
|
|
97
111
|
end
|
98
112
|
|
99
113
|
def retrieve_channel
|
100
|
-
slack_client.channels_list['channels'].
|
101
|
-
|
102
|
-
|
103
|
-
end
|
114
|
+
slack_client.channels_list['channels'].find do |channel|
|
115
|
+
"##{ channel['name'] }" == config.channel
|
116
|
+
end
|
104
117
|
end
|
105
118
|
|
106
119
|
def fill_standup_members(members_list)
|
@@ -129,7 +142,7 @@ module Lita
|
|
129
142
|
|
130
143
|
def prewritten_standups_summary
|
131
144
|
standup_members.each do |user, standup|
|
132
|
-
|
145
|
+
display_standup(user, standup) unless standup.empty?
|
133
146
|
end
|
134
147
|
end
|
135
148
|
|
@@ -151,14 +164,14 @@ module Lita
|
|
151
164
|
standup_members.select{ |key,value| value.empty? }.first.first
|
152
165
|
end
|
153
166
|
|
154
|
-
def
|
167
|
+
def standup_end
|
155
168
|
in_standup.value = 'false'
|
156
169
|
|
157
170
|
send_message(config.channel, "Et voilà ! C'est bon pour aujourd'hui. Merci tout le monde :parrot:")
|
171
|
+
|
158
172
|
update_standup_members
|
159
173
|
update_ids_to_members
|
160
174
|
end
|
161
|
-
|
162
175
|
end
|
163
176
|
Lita.register_handler(SlackStandup)
|
164
177
|
end
|
data/lita-slack-standup.gemspec
CHANGED
data/locales/en.yml
CHANGED
@@ -40,12 +40,11 @@ describe Lita::Handlers::SlackStandup, lita_handler: true do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
describe "when standup starts" do
|
43
|
-
|
44
43
|
subject do
|
45
|
-
send_message("!start
|
44
|
+
send_message("!standup start", as: sybil, from: channel)
|
46
45
|
end
|
47
46
|
|
48
|
-
it "starts standup", vcr: {cassette_name: '
|
47
|
+
it "starts standup", vcr: {cassette_name: 'standup_start'} do
|
49
48
|
[ "Hello <!channel> ! Le standup va commencer : )",
|
50
49
|
"Bonjour <@zaratan> ! C'est à ton tour de parler."
|
51
50
|
].each do |text|
|
@@ -55,28 +54,28 @@ describe Lita::Handlers::SlackStandup, lita_handler: true do
|
|
55
54
|
subject
|
56
55
|
end
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
context "with pre-filled reports" do
|
63
|
-
it "displays known reports", vcr: {cassette_name: 'standup_prefilled'} do
|
64
|
-
send_message("!standup My standup report for testing purposes", as: sybil, from: channel)
|
57
|
+
context "with pre-filled report" do
|
58
|
+
before do
|
59
|
+
send_message("!standup report My standup report for testing purposes", as: sybil, from: channel)
|
60
|
+
end
|
65
61
|
|
62
|
+
it "displays known reports", vcr: {cassette_name: 'standup_one_report_prefilled'} do
|
66
63
|
[ "Hello <!channel> ! Le standup va commencer : )",
|
67
64
|
"sybil a déjà renseigné son standup : \n My standup report for testing purposes",
|
68
65
|
"Bonjour <@zaratan> ! C'est à ton tour de parler."
|
69
66
|
].each do |text|
|
70
67
|
expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with({:channel=>channel, :text=>text, :as_user=>true})
|
71
68
|
end
|
72
|
-
|
73
69
|
subject
|
74
70
|
end
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
send_message("!standup My standup report for testing purposes", as:
|
71
|
+
|
72
|
+
context "with all reports pre-filled", vcr: {cassette_name: 'standup_all_reports_prefilled'} do
|
73
|
+
before do
|
74
|
+
send_message("!standup report My standup report for testing purposes", as: sybil, from: channel)
|
75
|
+
send_message("!standup report My standup report for testing purposes", as: zaratan, from: channel)
|
76
|
+
end
|
79
77
|
|
78
|
+
it "displays the standups and ends the meeting" do
|
80
79
|
[ "Hello <!channel> ! Le standup va commencer : )",
|
81
80
|
"zaratan a déjà renseigné son standup : \n My standup report for testing purposes",
|
82
81
|
"sybil a déjà renseigné son standup : \n My standup report for testing purposes",
|
@@ -84,85 +83,81 @@ describe Lita::Handlers::SlackStandup, lita_handler: true do
|
|
84
83
|
].each do |text|
|
85
84
|
expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with({:channel=>channel, :text=>text, :as_user=>true})
|
86
85
|
end
|
87
|
-
|
88
86
|
subject
|
89
87
|
end
|
90
88
|
end
|
91
89
|
end
|
92
90
|
end
|
93
91
|
|
94
|
-
describe "!standup command", vcr: {cassette_name: '
|
92
|
+
describe "!standup report command", vcr: {cassette_name: 'standup_report'} do
|
95
93
|
subject do
|
96
|
-
send_message("!standup My standup report for testing purposes", as: sybil, from: channel)
|
94
|
+
send_message("!standup report My standup report for testing purposes", as: sybil, from: channel)
|
97
95
|
end
|
98
96
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
expect(replies.last).to eq("Ton standup est enregistré. Merci :)")
|
103
|
-
end
|
97
|
+
it "saves the report" do
|
98
|
+
subject
|
99
|
+
expect(replies.last).to eq("Ton standup est enregistré. Merci :)")
|
104
100
|
end
|
105
101
|
end
|
106
102
|
|
107
|
-
describe "!
|
103
|
+
describe "!standup mext command" do
|
108
104
|
subject do
|
109
|
-
send_message("!next
|
105
|
+
send_message("!standup next", as: sybil, from: channel)
|
110
106
|
end
|
111
107
|
|
112
|
-
context "when its called oustide of standups", vcr: {cassette_name: '
|
108
|
+
context "when its called oustide of standups", vcr: {cassette_name: 'standup_next_refused'} do
|
113
109
|
it "is not available" do
|
114
110
|
expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with({:channel=>channel, :text=>"La commande n'est pas disponible en dehors d'un standup.", :as_user=>true})
|
115
|
-
|
116
111
|
subject
|
117
112
|
end
|
118
113
|
end
|
119
114
|
|
120
|
-
context "when it's called during standup", vcr: {cassette_name: '
|
115
|
+
context "when it's called during standup", vcr: {cassette_name: 'standup_next'} do
|
116
|
+
before do
|
117
|
+
send_message("!standup start", as: sybil, from: channel)
|
118
|
+
end
|
119
|
+
|
121
120
|
it "asks the next user to report" do
|
122
|
-
send_message("!start standup", as: sybil, from: channel)
|
123
|
-
|
124
121
|
expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with({:channel=>channel, :text=>"Bonjour <@sybil> ! C'est à ton tour de parler.", :as_user=>true})
|
125
|
-
|
126
122
|
subject
|
127
123
|
end
|
128
124
|
end
|
129
125
|
end
|
130
126
|
|
131
|
-
describe "!ignore user command", vcr: {cassette_name: '
|
127
|
+
describe "!standup ignore user command", vcr: {cassette_name: 'standup_ignore'} do
|
128
|
+
|
129
|
+
before do
|
130
|
+
send_message("!standup start", as: sybil, from: channel)
|
131
|
+
end
|
132
132
|
|
133
133
|
subject do
|
134
|
-
send_message("!ignore sybil", as: sybil, from: channel)
|
135
|
-
send_message("!next standup", as: sybil, from: channel)
|
134
|
+
send_message("!standup ignore sybil", as: sybil, from: channel)
|
135
|
+
send_message("!standup next standup", as: sybil, from: channel)
|
136
136
|
end
|
137
137
|
|
138
138
|
it "ignores an user" do
|
139
|
-
send_message("!start standup", as: sybil, from: channel)
|
140
|
-
|
141
139
|
expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with({:channel=>channel, :text=>"Et voilà ! C'est bon pour aujourd'hui. Merci tout le monde :parrot:", :as_user=>true})
|
142
|
-
|
143
140
|
subject
|
144
141
|
expect(replies.last).to eq("<@sybil> est désormais ignoré jusqu'à nouvel ordre.")
|
145
|
-
|
146
142
|
end
|
147
143
|
end
|
148
144
|
|
149
|
-
describe "!unignore user command", vcr: {cassette_name: '
|
145
|
+
describe "!standup unignore user command", vcr: {cassette_name: 'standup_unignore'} do
|
146
|
+
|
147
|
+
before do
|
148
|
+
send_message("!standup start", as: sybil, from: channel)
|
149
|
+
send_message("!standup ignore sybil", as: sybil, from: channel)
|
150
|
+
end
|
150
151
|
|
151
152
|
subject do
|
152
|
-
send_message("!unignore sybil", as: sybil, from: channel)
|
153
|
-
send_message("!next
|
153
|
+
send_message("!standup unignore sybil", as: sybil, from: channel)
|
154
|
+
send_message("!standup next", as: sybil, from: channel)
|
154
155
|
end
|
155
156
|
|
156
157
|
it "unignores an user" do
|
157
|
-
send_message("!start standup", as: sybil, from: channel)
|
158
|
-
send_message("!ignore sybil", as: sybil, from: channel)
|
159
|
-
|
160
158
|
expect_any_instance_of(Slack::Web::Client).to receive(:chat_postMessage).with({:channel=>channel, :text=>"Bonjour <@sybil> ! C'est à ton tour de parler.", :as_user=>true})
|
161
|
-
|
162
159
|
subject
|
163
160
|
expect(replies.last).to eq("<@sybil> est à nouveau inclus dans les standups.")
|
164
|
-
|
165
161
|
end
|
166
162
|
end
|
167
|
-
|
168
163
|
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: 0.
|
4
|
+
version: 0.2.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-02-
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|