slack_trello 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slack_trello/create_card_command.rb +2 -2
- data/lib/slack_trello/retro_command.rb +92 -0
- data/lib/slack_trello/version.rb +1 -1
- data/lib/slack_trello.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bc22dc727048c0d87b14bfceacd21cd5b3bb7a0
|
4
|
+
data.tar.gz: 28a273bd9d1226aa02ead0aabb6694c4f0b68c41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e280ed1fb28ff11fd72af69d9b33b4d52b3c70d0a059f7fe09727cd85b70c506a392a8a65dd39eda63084d5e5b04438951785d122352057828306a131c4ae902
|
7
|
+
data.tar.gz: e09e4ae85645c4f65b688c438fb82ea5c28feb0178d67b480decc110066d6b618c3bbe26f79a601e7974b8823866d699a8fb89402d64b960cc56f815e38c6932
|
@@ -62,11 +62,11 @@ For example, Some Board Name => some_board_name
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def board_not_found_message
|
65
|
-
"A Trello board named '#{trello_board_name}' must be created and the Trello user in the codebase must be added to the board for
|
65
|
+
"A Trello board named '#{trello_board_name}' must be created and the Trello user in the codebase must be added to the board for this command to function for this Slack room."
|
66
66
|
end
|
67
67
|
|
68
68
|
def list_not_found_message
|
69
|
-
"A Trello list named #{trello_list_name} must be added to the '#{trello_board_name}' board for
|
69
|
+
"A Trello list named #{trello_list_name} must be added to the '#{trello_board_name}' board for this command to function."
|
70
70
|
end
|
71
71
|
|
72
72
|
def success_message
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module SlackTrello; class RetroCommand
|
2
|
+
|
3
|
+
include TextParser
|
4
|
+
|
5
|
+
attr_reader :parser, :webhook_url
|
6
|
+
|
7
|
+
def initialize(args, webhook_url)
|
8
|
+
@parser = ResponseParser.new(args)
|
9
|
+
@webhook_url = webhook_url
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
return help_message unless valid_text_format?
|
14
|
+
return help_message unless num_args == 1
|
15
|
+
return board_not_found_message unless trello_card_creator.trello_board
|
16
|
+
return list_not_found_message unless trello_card_creator.trello_list
|
17
|
+
|
18
|
+
trello_card
|
19
|
+
speaker.speak success_message
|
20
|
+
"You should see a notification with a link. If not, the card might not have been created."
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def help_message
|
26
|
+
%{:cry: Invalid format
|
27
|
+
Your message: #{text}
|
28
|
+
Example: /card (trello_list) card title
|
29
|
+
Available list names: #{list_names.join(", ")}
|
30
|
+
If the Trello list has spaces, replace them with underscores
|
31
|
+
For example, Some List Name => some_list_name
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def speaker
|
36
|
+
args = {
|
37
|
+
webhook_url: webhook_url,
|
38
|
+
channel: parser.channel_name,
|
39
|
+
username: parser.user_name
|
40
|
+
}
|
41
|
+
Speaker.new(args)
|
42
|
+
end
|
43
|
+
|
44
|
+
def trello_card_creator
|
45
|
+
args = {
|
46
|
+
board_name: trello_board_name,
|
47
|
+
list_name: trello_list_name,
|
48
|
+
card_name: card_title
|
49
|
+
}
|
50
|
+
@trello_card_creator ||= CreateTrelloCard.new(args)
|
51
|
+
end
|
52
|
+
|
53
|
+
def trello_card
|
54
|
+
trello_card_creator.card
|
55
|
+
end
|
56
|
+
|
57
|
+
def trello_board_name
|
58
|
+
"#{parser.channel_name.titleize} Retro"
|
59
|
+
end
|
60
|
+
|
61
|
+
def trello_list_name
|
62
|
+
args[0]
|
63
|
+
end
|
64
|
+
|
65
|
+
def board_not_found_message
|
66
|
+
"A Trello board named '#{trello_board_name}' must be created and the Trello user in the codebase must be added to the board for this command to function for this Slack room."
|
67
|
+
end
|
68
|
+
|
69
|
+
def list_not_found_message
|
70
|
+
"A Trello list named #{trello_list_name} must be added to the '#{trello_board_name}' board for this command to function."
|
71
|
+
end
|
72
|
+
|
73
|
+
def success_message
|
74
|
+
":trello: [#{parser.user_name}] has created a new trello card: <#{trello_card.short_url}|#{parser.text.strip}>"
|
75
|
+
end
|
76
|
+
|
77
|
+
def card_title
|
78
|
+
"#{text_message} -- #{parser.user_name}"
|
79
|
+
end
|
80
|
+
|
81
|
+
def text
|
82
|
+
parser.text
|
83
|
+
end
|
84
|
+
|
85
|
+
def list_names
|
86
|
+
trello_card_creator.trello_board.lists.map do |list|
|
87
|
+
list.name.parameterize.underscore
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end; end
|
92
|
+
|
data/lib/slack_trello/version.rb
CHANGED
data/lib/slack_trello.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_trello
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Powers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -115,6 +115,7 @@ files:
|
|
115
115
|
- lib/slack_trello/create_card_command.rb
|
116
116
|
- lib/slack_trello/create_trello_card.rb
|
117
117
|
- lib/slack_trello/response_parser.rb
|
118
|
+
- lib/slack_trello/retro_command.rb
|
118
119
|
- lib/slack_trello/speaker.rb
|
119
120
|
- lib/slack_trello/text_parser.rb
|
120
121
|
- lib/slack_trello/version.rb
|