lita-team 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +243 -0
- data/.ruby-version +1 -1
- data/.travis.yml +1 -1
- data/README.md +2 -1
- data/lib/lita/handlers/add_member_to_team.rb +74 -0
- data/lib/lita/handlers/block_team.rb +42 -0
- data/lib/lita/handlers/clear_team.rb +38 -0
- data/lib/lita/handlers/confirm_member.rb +56 -0
- data/lib/lita/handlers/create_team.rb +38 -0
- data/lib/lita/handlers/delete_team.rb +26 -0
- data/lib/lita/handlers/list_team.rb +36 -0
- data/lib/lita/handlers/list_teams.rb +35 -0
- data/lib/lita/handlers/remove_member_from_team.rb +63 -0
- data/lib/lita/handlers/team.rb +2 -53
- data/lib/lita/handlers/update_team.rb +63 -0
- data/lib/lita-team.rb +12 -16
- data/lita-team.gemspec +2 -2
- data/locales/en.yml +21 -15
- data/spec/lita/handlers/add_member_to_team_spec.rb +92 -0
- data/spec/lita/handlers/block_team_spec.rb +29 -0
- data/spec/lita/handlers/clear_team_spec.rb +21 -0
- data/spec/lita/handlers/confirm_member_spec.rb +82 -0
- data/spec/lita/handlers/create_team_spec.rb +18 -0
- data/spec/lita/handlers/delete_team_spec.rb +20 -0
- data/spec/lita/handlers/list_team_spec.rb +65 -0
- data/spec/lita/handlers/list_teams_spec.rb +26 -0
- data/spec/lita/handlers/remove_member_from_team_spec.rb +104 -0
- data/spec/lita/handlers/team_spec.rb +0 -199
- data/spec/lita/handlers/update_team_spec.rb +41 -0
- data/spec/spec_helper.rb +1 -1
- data/templates/list_team.erb +8 -5
- data/templates/list_teams.erb +2 -8
- data/templates/member_added_to_team.erb +2 -2
- data/templates/member_confirmed.erb +4 -0
- data/templates/member_not_on_team.erb +0 -0
- data/templates/member_removed_from_team.erb +3 -3
- data/templates/team_already_exists.erb +1 -0
- data/templates/team_blocked.erb +1 -0
- data/templates/team_cannot_perform_operation.erb +1 -0
- data/templates/team_created.erb +1 -0
- data/templates/team_deleted.erb +1 -0
- data/templates/team_not_found.erb +1 -0
- data/templates/team_unblocked.erb +1 -0
- data/templates/team_updated.erb +1 -0
- metadata +46 -17
- data/lib/lita/actions/add_member_to_team.rb +0 -38
- data/lib/lita/actions/base.rb +0 -28
- data/lib/lita/actions/clear_team.rb +0 -30
- data/lib/lita/actions/create_team.rb +0 -21
- data/lib/lita/actions/delete_team.rb +0 -21
- data/lib/lita/actions/list_team.rb +0 -25
- data/lib/lita/actions/list_teams.rb +0 -11
- data/lib/lita/actions/remove_member_from_team.rb +0 -37
- data/lib/lita/member.rb +0 -17
- data/lib/lita/store/member.rb +0 -32
- data/lib/lita/store/team.rb +0 -34
- data/lib/lita/team.rb +0 -27
@@ -0,0 +1,104 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Lita::Handlers::RemoveMemberFromTeam,
|
4
|
+
lita_handler: true,
|
5
|
+
additional_lita_handlers:
|
6
|
+
[
|
7
|
+
Lita::Handlers::CreateTeam,
|
8
|
+
Lita::Handlers::BlockTeam,
|
9
|
+
Lita::Handlers::AddMemberToTeam
|
10
|
+
] do
|
11
|
+
describe "remove member from team" do
|
12
|
+
it "removes a member from the team" do
|
13
|
+
send_command "create testing team"
|
14
|
+
send_command "testing team add mel"
|
15
|
+
send_command "testing team remove mel"
|
16
|
+
expect(replies.last).to eq("mel removed from the testing team")
|
17
|
+
end
|
18
|
+
|
19
|
+
context "me" do
|
20
|
+
it "removes current user from the team" do
|
21
|
+
send_command "create testing team"
|
22
|
+
send_command "testing team add me"
|
23
|
+
send_command "testing team remove me"
|
24
|
+
expect(replies.last).to eq("#{user.name} removed from the testing team")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "+1" do
|
29
|
+
it "removes current user from the team" do
|
30
|
+
send_command "create testing team"
|
31
|
+
send_command "testing team +1"
|
32
|
+
send_command "testing team -1"
|
33
|
+
expect(replies.last).to eq("#{user.name} removed from the testing team")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "mention" do
|
38
|
+
it "uses the lita users database" do
|
39
|
+
send_command "create testing team"
|
40
|
+
send_command "testing team add @Test"
|
41
|
+
send_command "testing team remove @Test"
|
42
|
+
expect(replies.last).to eq("Test User removed from the testing team")
|
43
|
+
end
|
44
|
+
|
45
|
+
it "removes @ from non-existing users" do
|
46
|
+
send_command "create testing team"
|
47
|
+
send_command "testing team add @james"
|
48
|
+
send_command "testing team remove @james"
|
49
|
+
expect(replies.last).to eq("james removed from the testing team")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "there are members in the team" do
|
54
|
+
before do
|
55
|
+
send_command "create testing team"
|
56
|
+
send_command "testing team add john"
|
57
|
+
send_command "testing team add james"
|
58
|
+
end
|
59
|
+
context "there is a member in the team" do
|
60
|
+
it "removes the member and displays a message" do
|
61
|
+
send_command "testing team remove james"
|
62
|
+
expect(replies.last).
|
63
|
+
to eq("james removed from the testing team, 1 other is in")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
context "there are two or more members in the team" do
|
68
|
+
it "adds the member and shows a message" do
|
69
|
+
send_command "testing team add robert"
|
70
|
+
send_command "testing team remove robert"
|
71
|
+
expect(replies.last).
|
72
|
+
to eq("robert removed from the testing team, 2 others are in")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context "the member is not in the team" do
|
78
|
+
it "does not remove anyone" do
|
79
|
+
send_command "create testing team"
|
80
|
+
send_command "testing team remove john"
|
81
|
+
expect(replies.last).to eq("john is not on the testing team")
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "team does not exist" do
|
86
|
+
it "does not remove the member" do
|
87
|
+
send_command "testing team remove john"
|
88
|
+
expect(replies.last).to eq("testing team does not exist")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "team blocked" do
|
93
|
+
it "does not remove the member" do
|
94
|
+
send_command "create testing team"
|
95
|
+
send_command "testing team add jhon"
|
96
|
+
send_command "block testing team"
|
97
|
+
send_command "testing team remove jhon"
|
98
|
+
reply =
|
99
|
+
"testing team is blocked. You cannot perform this operation"
|
100
|
+
expect(replies.last).to eq(reply)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -1,203 +1,4 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
describe Lita::Handlers::Team, lita_handler: true do
|
4
|
-
describe "create team" do
|
5
|
-
it "creates a new team" do
|
6
|
-
send_command "create testing team"
|
7
|
-
expect(replies.last).to eq("testing team created, add some people to it")
|
8
|
-
end
|
9
|
-
|
10
|
-
context "team already exists" do
|
11
|
-
it "does not create a new team" do
|
12
|
-
send_command "create testing team"
|
13
|
-
send_command "create testing team"
|
14
|
-
expect(replies.last).to eq("testing team already exists")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "delete team" do
|
20
|
-
it "deletes a team" do
|
21
|
-
send_command "create testing team"
|
22
|
-
send_command "delete testing team"
|
23
|
-
expect(replies.last).to eq("testing team deleted")
|
24
|
-
end
|
25
|
-
|
26
|
-
context "team does not exist" do
|
27
|
-
it "does not delete a team" do
|
28
|
-
send_command "delete testing team"
|
29
|
-
expect(replies.last).to eq("testing team does not exist")
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe "list teams" do
|
35
|
-
it "list all teams" do
|
36
|
-
send_command "create testing team"
|
37
|
-
send_command "create qa team"
|
38
|
-
send_command "list teams"
|
39
|
-
expect(replies.last).to eq("Teams:\nqa (0 members)\ntesting (0 members)\n")
|
40
|
-
end
|
41
|
-
|
42
|
-
context "without teams" do
|
43
|
-
it "shows a message" do
|
44
|
-
send_command "list teams"
|
45
|
-
expect(replies.last).to eq("No team has been created so far")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe "add member to team" do
|
51
|
-
it "adds a member to the team" do
|
52
|
-
send_command "create testing team"
|
53
|
-
send_command "testing team add john"
|
54
|
-
expect(replies.last).to eq("john added to the testing team")
|
55
|
-
end
|
56
|
-
|
57
|
-
context "me" do
|
58
|
-
it "adds current user to the team" do
|
59
|
-
send_command "create testing team"
|
60
|
-
send_command "testing team add me"
|
61
|
-
expect(replies.last).to eq("#{user.name} added to the testing team")
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
context "+1" do
|
66
|
-
it "adds current user to the team" do
|
67
|
-
send_command "create testing team"
|
68
|
-
send_command "testing team +1"
|
69
|
-
expect(replies.last).to eq("#{user.name} added to the testing team")
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
context "there is a member in the team" do
|
74
|
-
it "adds the member and shows a message" do
|
75
|
-
send_command "create testing team"
|
76
|
-
send_command "testing team add john"
|
77
|
-
send_command "testing team add james"
|
78
|
-
expect(replies.last).to eq("james added to the testing team, 1 other is in")
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context "there are two or more members in the team" do
|
83
|
-
it "adds the member and shows a message" do
|
84
|
-
send_command "create testing team"
|
85
|
-
send_command "testing team add john"
|
86
|
-
send_command "testing team add james"
|
87
|
-
send_command "testing team add robert"
|
88
|
-
expect(replies.last).to eq("robert added to the testing team, 2 others are in")
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
context "the member is already in the team" do
|
93
|
-
it "does not add the member to the team" do
|
94
|
-
send_command "create testing team"
|
95
|
-
send_command "testing team add john"
|
96
|
-
send_command "testing team add john"
|
97
|
-
expect(replies.last).to eq("john already in the testing team")
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
context "team does not exist" do
|
102
|
-
it "does not add the member" do
|
103
|
-
send_command "testing team add john"
|
104
|
-
expect(replies.last).to eq("testing team does not exist")
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
describe "remove member from team" do
|
110
|
-
it "removes a member from the team" do
|
111
|
-
send_command "create testing team"
|
112
|
-
send_command "testing team add john"
|
113
|
-
send_command "testing team remove john"
|
114
|
-
expect(replies.last).to eq("john removed from the testing team")
|
115
|
-
end
|
116
|
-
|
117
|
-
context "me" do
|
118
|
-
it "removes current user from the team" do
|
119
|
-
send_command "create testing team"
|
120
|
-
send_command "testing team add me"
|
121
|
-
send_command "testing team remove me"
|
122
|
-
expect(replies.last).to eq("#{user.name} removed from the testing team")
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
context "-1" do
|
127
|
-
it "removes current user from the team" do
|
128
|
-
send_command "create testing team"
|
129
|
-
send_command "testing team +1"
|
130
|
-
send_command "testing team -1"
|
131
|
-
expect(replies.last).to eq("#{user.name} removed from the testing team")
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
context "there are two or more members in the team" do
|
136
|
-
it "adds the member and shows a message" do
|
137
|
-
send_command "create testing team"
|
138
|
-
send_command "testing team add john"
|
139
|
-
send_command "testing team add james"
|
140
|
-
send_command "testing team remove john"
|
141
|
-
expect(replies.last).to eq("john removed from the testing team, 1 other is in")
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
context "the member is not in the team" do
|
146
|
-
it "does not removes the member from the team" do
|
147
|
-
send_command "create testing team"
|
148
|
-
send_command "testing team remove john"
|
149
|
-
expect(replies.last).to eq("john already out of the testing team")
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
context "team does not exist" do
|
154
|
-
it "does not add the member" do
|
155
|
-
send_command "testing team remove john"
|
156
|
-
expect(replies.last).to eq("testing team does not exist")
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
|
161
|
-
describe "list team" do
|
162
|
-
it "lists the members in the team" do
|
163
|
-
send_command "create testing team"
|
164
|
-
send_command "testing team add james"
|
165
|
-
send_command "testing team add john"
|
166
|
-
send_command "testing team list"
|
167
|
-
expect(replies.last).to eq("testing (2 members):\n1. james\n2. john\n")
|
168
|
-
end
|
169
|
-
|
170
|
-
context "team is empty" do
|
171
|
-
it "shows a message" do
|
172
|
-
send_command "create testing team"
|
173
|
-
send_command "testing team list"
|
174
|
-
expect(replies.last).to eq("There is no one in the testing team currently")
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
context "team does not exist" do
|
179
|
-
it "shows a message" do
|
180
|
-
send_command "testing team list"
|
181
|
-
expect(replies.last).to eq("testing team does not exist")
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
describe "clear team" do
|
187
|
-
it "removes the members of a team" do
|
188
|
-
send_command "create testing team"
|
189
|
-
send_command "testing team add john"
|
190
|
-
send_command "testing team clear"
|
191
|
-
expect(replies.last).to eq("testing team cleared")
|
192
|
-
send_command "testing team list"
|
193
|
-
expect(replies.last).to eq("There is no one in the testing team currently")
|
194
|
-
end
|
195
|
-
|
196
|
-
context "team does not exist" do
|
197
|
-
it "shows a message" do
|
198
|
-
send_command "testing team clear"
|
199
|
-
expect(replies.last).to eq("testing team does not exist")
|
200
|
-
end
|
201
|
-
end
|
202
|
-
end
|
203
4
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Lita::Handlers::UpdateTeam,
|
4
|
+
lita_handler: true,
|
5
|
+
additional_lita_handlers: Lita::Handlers::CreateTeam do
|
6
|
+
describe "update team" do
|
7
|
+
context "set limit" do
|
8
|
+
it "set limit to a given value" do
|
9
|
+
send_command "create testing team"
|
10
|
+
send_command "testing team set limit 10"
|
11
|
+
expect(replies.last).
|
12
|
+
to eq("testing team limit set to 10")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "set location" do
|
17
|
+
it "set location to a given value" do
|
18
|
+
send_command "create testing team"
|
19
|
+
send_command "testing team set location local place"
|
20
|
+
reply = "testing team location set to local place"
|
21
|
+
expect(replies.last).to eq(reply)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "set icon" do
|
26
|
+
it "set icon to a given value" do
|
27
|
+
send_command "create testing team"
|
28
|
+
send_command "testing team set icon :love:"
|
29
|
+
expect(replies.last).
|
30
|
+
to eq("testing team icon set to :love:")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "team does not exists" do
|
35
|
+
it "does not do anything" do
|
36
|
+
send_command "testing team set limit 10"
|
37
|
+
expect(replies.last).to eq("testing team does not exist")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/templates/list_team.erb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
-
<% if @team
|
2
|
-
<%= I18n.t(
|
1
|
+
<% if @team[:members].empty? %>
|
2
|
+
<%= I18n.t('lita.handlers.team.empty', team_name: @team[:name]) %>
|
3
3
|
<% else %>
|
4
|
-
<%=
|
5
|
-
|
6
|
-
<%=
|
4
|
+
<%= @team[:name] %>
|
5
|
+
|
6
|
+
<%= ":bust_in_silhouette: " + @team[:members].count.to_s %><%= " | " + @team[:icon] if @team[:icon] %><%= " " + @team[:location] if @team[:location] %><%= " | Max: " + @team[:limit].to_s if @team[:limit] %>
|
7
|
+
|
8
|
+
<% @team[:members].each_with_index do |(key, member), i| %>
|
9
|
+
<%= i + 1 %>. <%= member[:name] %><%= " :point_up:" if member[:confirmed] %>
|
7
10
|
|
8
11
|
<% end %>
|
9
12
|
<% end %>
|
data/templates/list_teams.erb
CHANGED
@@ -1,10 +1,4 @@
|
|
1
|
-
|
2
|
-
<%= I18n.t("lita.handlers.team.no_teams_has_been_created") %>
|
3
|
-
<% else %>
|
4
|
-
<%= I18n.t("lita.handlers.team.teams_title") %>
|
5
|
-
|
1
|
+
<%= I18n.t("lita.handlers.team.teams_title") %>:
|
6
2
|
<% @teams.each do |team| %>
|
7
|
-
<%=
|
8
|
-
|
9
|
-
<% end %>
|
3
|
+
<%= team[:name] %> (<%= team[:members].count %> :bust_in_silhouette:)
|
10
4
|
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= I18n.t("lita.handlers.team.
|
1
|
+
<%= I18n.t("lita.handlers.team.member.added", member_name: @member_name, team_name: @team_name) %>
|
2
2
|
<% if @count > 0 %>
|
3
|
-
<%= I18n.t("lita.handlers.team.
|
3
|
+
<%= I18n.t("lita.handlers.team.members_count", count: @count) %>
|
4
4
|
<% end %>
|
File without changes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= I18n.t("lita.handlers.team.
|
2
|
-
<% if @
|
3
|
-
<%= I18n.t("lita.handlers.team.
|
1
|
+
<%= I18n.t("lita.handlers.team.member.removed", member_name: @member_name, team_name: @team_name) %>
|
2
|
+
<% if @count > 0 %>
|
3
|
+
<%= I18n.t("lita.handlers.team.members_count", count: @count) %>
|
4
4
|
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= I18n.t('lita.handlers.team.already_exists', team_name: @team_name) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= I18n.t("lita.handlers.team.blocked", team_name: @team_name) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= I18n.t('lita.handlers.team.cannot_perform_operation', team_name: @team_name) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= I18n.t("lita.handlers.team.created", team_name: @team_name) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= I18n.t("lita.handlers.team.deleted", team_name: @team_name) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= I18n.t("lita.handlers.team.not_found", team_name: @team_name) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= I18n.t("lita.handlers.team.unblocked", team_name: @team_name) %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= I18n.t("lita.handlers.team.updated", team_name: @team_name, attribute: @attribute, value: @value) %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-team
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edgar Ortega
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4.
|
19
|
+
version: '4.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '4.
|
26
|
+
version: '4.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".gitignore"
|
133
133
|
- ".rspec"
|
134
|
+
- ".rubocop.yml"
|
134
135
|
- ".ruby-gemset"
|
135
136
|
- ".ruby-version"
|
136
137
|
- ".travis.yml"
|
@@ -138,28 +139,46 @@ files:
|
|
138
139
|
- README.md
|
139
140
|
- Rakefile
|
140
141
|
- lib/lita-team.rb
|
141
|
-
- lib/lita/
|
142
|
-
- lib/lita/
|
143
|
-
- lib/lita/
|
144
|
-
- lib/lita/
|
145
|
-
- lib/lita/
|
146
|
-
- lib/lita/
|
147
|
-
- lib/lita/
|
148
|
-
- lib/lita/
|
142
|
+
- lib/lita/handlers/add_member_to_team.rb
|
143
|
+
- lib/lita/handlers/block_team.rb
|
144
|
+
- lib/lita/handlers/clear_team.rb
|
145
|
+
- lib/lita/handlers/confirm_member.rb
|
146
|
+
- lib/lita/handlers/create_team.rb
|
147
|
+
- lib/lita/handlers/delete_team.rb
|
148
|
+
- lib/lita/handlers/list_team.rb
|
149
|
+
- lib/lita/handlers/list_teams.rb
|
150
|
+
- lib/lita/handlers/remove_member_from_team.rb
|
149
151
|
- lib/lita/handlers/team.rb
|
150
|
-
- lib/lita/
|
151
|
-
- lib/lita/store/member.rb
|
152
|
-
- lib/lita/store/team.rb
|
153
|
-
- lib/lita/team.rb
|
152
|
+
- lib/lita/handlers/update_team.rb
|
154
153
|
- lita-team.gemspec
|
155
154
|
- locales/en.yml
|
155
|
+
- spec/lita/handlers/add_member_to_team_spec.rb
|
156
|
+
- spec/lita/handlers/block_team_spec.rb
|
157
|
+
- spec/lita/handlers/clear_team_spec.rb
|
158
|
+
- spec/lita/handlers/confirm_member_spec.rb
|
159
|
+
- spec/lita/handlers/create_team_spec.rb
|
160
|
+
- spec/lita/handlers/delete_team_spec.rb
|
161
|
+
- spec/lita/handlers/list_team_spec.rb
|
162
|
+
- spec/lita/handlers/list_teams_spec.rb
|
163
|
+
- spec/lita/handlers/remove_member_from_team_spec.rb
|
156
164
|
- spec/lita/handlers/team_spec.rb
|
165
|
+
- spec/lita/handlers/update_team_spec.rb
|
157
166
|
- spec/spec_helper.rb
|
158
167
|
- templates/.gitkeep
|
159
168
|
- templates/list_team.erb
|
160
169
|
- templates/list_teams.erb
|
161
170
|
- templates/member_added_to_team.erb
|
171
|
+
- templates/member_confirmed.erb
|
172
|
+
- templates/member_not_on_team.erb
|
162
173
|
- templates/member_removed_from_team.erb
|
174
|
+
- templates/team_already_exists.erb
|
175
|
+
- templates/team_blocked.erb
|
176
|
+
- templates/team_cannot_perform_operation.erb
|
177
|
+
- templates/team_created.erb
|
178
|
+
- templates/team_deleted.erb
|
179
|
+
- templates/team_not_found.erb
|
180
|
+
- templates/team_unblocked.erb
|
181
|
+
- templates/team_updated.erb
|
163
182
|
homepage: https://github.com/EdgarOrtegaRamirez/lita-team
|
164
183
|
licenses:
|
165
184
|
- MIT
|
@@ -181,10 +200,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
200
|
version: '0'
|
182
201
|
requirements: []
|
183
202
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
203
|
+
rubygems_version: 2.5.2
|
185
204
|
signing_key:
|
186
205
|
specification_version: 4
|
187
206
|
summary: create and manage the members of a team with Lita
|
188
207
|
test_files:
|
208
|
+
- spec/lita/handlers/add_member_to_team_spec.rb
|
209
|
+
- spec/lita/handlers/block_team_spec.rb
|
210
|
+
- spec/lita/handlers/clear_team_spec.rb
|
211
|
+
- spec/lita/handlers/confirm_member_spec.rb
|
212
|
+
- spec/lita/handlers/create_team_spec.rb
|
213
|
+
- spec/lita/handlers/delete_team_spec.rb
|
214
|
+
- spec/lita/handlers/list_team_spec.rb
|
215
|
+
- spec/lita/handlers/list_teams_spec.rb
|
216
|
+
- spec/lita/handlers/remove_member_from_team_spec.rb
|
189
217
|
- spec/lita/handlers/team_spec.rb
|
218
|
+
- spec/lita/handlers/update_team_spec.rb
|
190
219
|
- spec/spec_helper.rb
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Lita
|
2
|
-
module Actions
|
3
|
-
class AddMemberToTeam < Base
|
4
|
-
|
5
|
-
def call
|
6
|
-
if team
|
7
|
-
count_was = team.members.count
|
8
|
-
if create_member
|
9
|
-
response.reply render_template(:member_added_to_team, member: member_name, team: team_name, count: count_was)
|
10
|
-
else
|
11
|
-
response.reply t(:member_already_in_team, member: member_name, team: team_name)
|
12
|
-
end
|
13
|
-
else
|
14
|
-
response.reply t(:team_not_found, name: team_name)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def team_name
|
21
|
-
response.match_data[1]
|
22
|
-
end
|
23
|
-
|
24
|
-
def member_name
|
25
|
-
response.match_data[3] || response.user.mention_name
|
26
|
-
end
|
27
|
-
|
28
|
-
def team
|
29
|
-
@team ||= Lita::Team.find(team_name)
|
30
|
-
end
|
31
|
-
|
32
|
-
def create_member
|
33
|
-
Lita::Store::Member.create(member_name: member_name, team_name: team_name)
|
34
|
-
end
|
35
|
-
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
data/lib/lita/actions/base.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
module Lita
|
2
|
-
module Actions
|
3
|
-
class Base
|
4
|
-
include Lita::Handler::Common
|
5
|
-
|
6
|
-
attr :response
|
7
|
-
@@template_root = nil
|
8
|
-
|
9
|
-
def initialize(response)
|
10
|
-
@response = response
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.template_root(path = nil)
|
14
|
-
@@template_root = path if path
|
15
|
-
@@template_root
|
16
|
-
end
|
17
|
-
|
18
|
-
def robot
|
19
|
-
response.message.instance_variable_get :"@robot"
|
20
|
-
end
|
21
|
-
|
22
|
-
def translate(key, options = {})
|
23
|
-
I18n.translate("lita.handlers.team.#{key}", options)
|
24
|
-
end
|
25
|
-
alias_method :t, :translate
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Lita
|
2
|
-
module Actions
|
3
|
-
class ClearTeam < Base
|
4
|
-
|
5
|
-
def call
|
6
|
-
if team_exists?
|
7
|
-
destroy_members
|
8
|
-
response.reply t(:team_cleared, name: team_name)
|
9
|
-
else
|
10
|
-
response.reply t(:team_not_found, name: team_name)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def team_name
|
17
|
-
response.match_data[1]
|
18
|
-
end
|
19
|
-
|
20
|
-
def team_exists?
|
21
|
-
Lita::Team.find(team_name)
|
22
|
-
end
|
23
|
-
|
24
|
-
def destroy_members
|
25
|
-
Lita::Store::Member.destroy_all(team_name: team_name)
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|