lita-trello 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +19 -0
- data/README.md +35 -0
- data/Rakefile +6 -0
- data/lib/lita-trello.rb +12 -0
- data/lib/lita/handlers/trello.rb +127 -0
- data/lita-trello.gemspec +25 -0
- data/locales/en.yml +4 -0
- data/spec/lita/handlers/trello_spec.rb +4 -0
- data/spec/spec_helper.rb +6 -0
- data/templates/.gitkeep +0 -0
- metadata +157 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 488c922e040c16f6e89272e70d1c592c51c9818c
|
4
|
+
data.tar.gz: 56158be5a8970eb06cf7be5285253ae72086472e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ca5301eed14724cd9f4e4a602b46d1e26d0b1495356e11a2457c5eb8748e9a2ea9cf2d075c1b028ce675b20009581522396659b5f4790f69261731a7bec3255c
|
7
|
+
data.tar.gz: ea9764787202b249993c120242afcbdabe50019de9923723b3e29b168b1715c795231121ed97f7e5fa3f7317ffb5ac88cef83d1d1901f84682b60b9ee5be1219
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2015 Reed Kraft-Murphy
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# lita-trello
|
2
|
+
|
3
|
+
Manage your Trello board from Lita.
|
4
|
+
|
5
|
+
Inspired by [hubot-trello](https://github.com/hubot-scripts/hubot-trello).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add lita-trello to your Lita instance's Gemfile:
|
10
|
+
|
11
|
+
``` ruby
|
12
|
+
gem "lita-trello"
|
13
|
+
```
|
14
|
+
|
15
|
+
## Configuration
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
Lita.configure do |config|
|
19
|
+
# ...
|
20
|
+
config.handlers.trello.public_key = "0123456789abcdef0123456789abcdef"
|
21
|
+
config.handlers.trello.token = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
|
22
|
+
config.handlers.trello.board = "01234567"
|
23
|
+
# ...
|
24
|
+
end
|
25
|
+
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
```
|
31
|
+
trello new LIST Do the thing - Create a new card in LIST called 'Do the thing'
|
32
|
+
trello move https://trello.com/c/CARD_ID LIST - Move a card to LIST
|
33
|
+
trello list LIST - Show all cards in LIST
|
34
|
+
trello lists - Show all lists on your board
|
35
|
+
```
|
data/Rakefile
ADDED
data/lib/lita-trello.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "lita"
|
2
|
+
|
3
|
+
Lita.load_locales Dir[File.expand_path(
|
4
|
+
File.join("..", "..", "locales", "*.yml"), __FILE__
|
5
|
+
)]
|
6
|
+
|
7
|
+
require "lita/handlers/trello"
|
8
|
+
|
9
|
+
Lita::Handlers::Trello.template_root File.expand_path(
|
10
|
+
File.join("..", "..", "templates"),
|
11
|
+
__FILE__
|
12
|
+
)
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'trello'
|
2
|
+
|
3
|
+
module Lita
|
4
|
+
module Handlers
|
5
|
+
class Trello < Handler
|
6
|
+
config :public_key
|
7
|
+
config :token
|
8
|
+
config :board
|
9
|
+
|
10
|
+
route(/^trello\s+new\s+[^\s]+\s+[^\s]+/i, :handle_create_card, command: true, help: {
|
11
|
+
"trello new LIST Do the thing" => "Create a new card in LIST called 'Do the thing'"
|
12
|
+
})
|
13
|
+
def handle_create_card(r)
|
14
|
+
list_name = r.args[1]
|
15
|
+
name = r.args[2..-1].join(" ")
|
16
|
+
|
17
|
+
list_id = lists[list_name.downcase].id
|
18
|
+
if list_id.nil?
|
19
|
+
r.reply "I couldn't find a list named #{list_name}."
|
20
|
+
return
|
21
|
+
end
|
22
|
+
|
23
|
+
r.reply "Ok #{r.user.name}, I'm creating a new card in #{list}."
|
24
|
+
begin
|
25
|
+
card = new_card(name, list_id)
|
26
|
+
r.reply "Here you go: #{card.short_url}"
|
27
|
+
rescue => err
|
28
|
+
r.reply "Something failed."
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
route(/^trello\s+move\s+[^\s]+\s+[^\s]+/i, :handle_move_card, command: true, help: {
|
33
|
+
"trello move https://trello.com/c/CARD_ID LIST" => "Move a card to LIST"
|
34
|
+
})
|
35
|
+
def handle_move_card(r)
|
36
|
+
card_id = r.args[1]
|
37
|
+
list_name = r.args[2]
|
38
|
+
|
39
|
+
list = lists[list_name.downcase]
|
40
|
+
if list.nil?
|
41
|
+
r.reply "I couldn't find a list named #{list_name}."
|
42
|
+
return
|
43
|
+
end
|
44
|
+
|
45
|
+
card_id = card_id.gsub(/(^<|>$)/, '')
|
46
|
+
if %r{^https?://trello.com/c/([^/]+)/?$} =~ card_id
|
47
|
+
card_id = $1
|
48
|
+
end
|
49
|
+
|
50
|
+
card = trello.find(:card, card_id)
|
51
|
+
if card.nil?
|
52
|
+
r.reply "I couldn't find that card."
|
53
|
+
return
|
54
|
+
end
|
55
|
+
|
56
|
+
begin
|
57
|
+
card.move_to_list(list)
|
58
|
+
r.reply "Ok #{r.user.name}, I moved that card to #{list_name}."
|
59
|
+
rescue => err
|
60
|
+
r.reply "Something failed."
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
route(/^trello\s+list\s+[^\s]+/i, :handle_list_cards, command: true, help: {
|
65
|
+
"trello list LIST" => "Show all cards in LIST"
|
66
|
+
})
|
67
|
+
def handle_list_cards(r)
|
68
|
+
list_name = r.args[1]
|
69
|
+
list = lists[list_name.downcase]
|
70
|
+
if list.nil?
|
71
|
+
r.reply "I couldn't find a list named #{list_name}."
|
72
|
+
return
|
73
|
+
end
|
74
|
+
|
75
|
+
r.reply("Here are the cards in #{list.name}:\n\n" +
|
76
|
+
list.cards.map { |card| "* #{card.name} - #{card.short_url}" }.join("\n")
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
route(/^trello\s+lists$/i, :handle_lists, command: true, help: {
|
81
|
+
"trello lists" => "Show all lists on your board"
|
82
|
+
})
|
83
|
+
def handle_lists(r)
|
84
|
+
r.reply("Here are all the lists on your board:\n\n" +
|
85
|
+
lists.each_pair.map { |list_name, list| "* #{list_name}" }.join("\n")
|
86
|
+
)
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
def debug_reply(response, m)
|
91
|
+
m == "```\n#{m}\n```"
|
92
|
+
response.reply(m)
|
93
|
+
end
|
94
|
+
|
95
|
+
def trello
|
96
|
+
@trello ||= ::Trello::Client.new(
|
97
|
+
developer_public_key: config.public_key,
|
98
|
+
member_token: config.token,
|
99
|
+
)
|
100
|
+
end
|
101
|
+
|
102
|
+
def board
|
103
|
+
@board ||= trello.find(:board, config.board)
|
104
|
+
end
|
105
|
+
|
106
|
+
def lists
|
107
|
+
@lists ||= begin
|
108
|
+
board.lists.map { |list| [list.name.downcase, list] }.to_h
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def default_list_id
|
113
|
+
@default_list_id ||= redis.get('default_list_id')
|
114
|
+
end
|
115
|
+
|
116
|
+
def new_card(name, list_id=nil)
|
117
|
+
trello.create(:card,
|
118
|
+
'name' => name,
|
119
|
+
'idList' => list_id || default_list_id,
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
124
|
+
|
125
|
+
Lita.register_handler(Trello)
|
126
|
+
end
|
127
|
+
end
|
data/lita-trello.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Gem::Specification.new do |spec|
|
2
|
+
spec.name = "lita-trello"
|
3
|
+
spec.version = "0.0.3"
|
4
|
+
spec.authors = ["Reed Kraft-Murphy"]
|
5
|
+
spec.email = ["reed@reedmurphy.net"]
|
6
|
+
spec.description = "Manage your Trello board from Lita"
|
7
|
+
spec.summary = "Manage your Trello board from Lita"
|
8
|
+
spec.homepage = "https://github.com/RWJMurphy/lita-trello"
|
9
|
+
spec.license = "MIT"
|
10
|
+
spec.metadata = { "lita_plugin_type" => "handler" }
|
11
|
+
|
12
|
+
spec.files = `git ls-files`.split($/)
|
13
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
14
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
|
+
spec.require_paths = ["lib"]
|
16
|
+
|
17
|
+
spec.add_runtime_dependency "lita", ">= 4.3"
|
18
|
+
spec.add_runtime_dependency "ruby-trello", "~> 1.1"
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "pry-byebug"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rack-test"
|
24
|
+
spec.add_development_dependency "rspec", ">= 3.0.0"
|
25
|
+
end
|
data/locales/en.yml
ADDED
data/spec/spec_helper.rb
ADDED
data/templates/.gitkeep
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lita-trello
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Reed Kraft-Murphy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: lita
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ruby-trello
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
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'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack-test
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 3.0.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 3.0.0
|
111
|
+
description: Manage your Trello board from Lita
|
112
|
+
email:
|
113
|
+
- reed@reedmurphy.net
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".gitignore"
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE.txt
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- lib/lita-trello.rb
|
124
|
+
- lib/lita/handlers/trello.rb
|
125
|
+
- lita-trello.gemspec
|
126
|
+
- locales/en.yml
|
127
|
+
- spec/lita/handlers/trello_spec.rb
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
- templates/.gitkeep
|
130
|
+
homepage: https://github.com/RWJMurphy/lita-trello
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
metadata:
|
134
|
+
lita_plugin_type: handler
|
135
|
+
post_install_message:
|
136
|
+
rdoc_options: []
|
137
|
+
require_paths:
|
138
|
+
- lib
|
139
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 2.2.2
|
152
|
+
signing_key:
|
153
|
+
specification_version: 4
|
154
|
+
summary: Manage your Trello board from Lita
|
155
|
+
test_files:
|
156
|
+
- spec/lita/handlers/trello_spec.rb
|
157
|
+
- spec/spec_helper.rb
|