the_dude-trello 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +50 -0
- data/README.md +3 -0
- data/Rakefile +8 -0
- data/lib/the_dude-trello.rb +65 -0
- data/lib/the_dude-trello/command.rb +14 -0
- data/lib/the_dude-trello/version.rb +5 -0
- data/the_dude-trello.gemspec +18 -0
- metadata +93 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
pkg
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create 1.9.3@dude-trello
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
the_dude-trello (0.0.1)
|
5
|
+
ruby-trello (>= 1)
|
6
|
+
|
7
|
+
PATH
|
8
|
+
remote: ~/Projects/Development/Open Source/Ruby/Gems/TheDude/source/
|
9
|
+
specs:
|
10
|
+
the_dude (0.0.2)
|
11
|
+
colored
|
12
|
+
hirb
|
13
|
+
nokogiri
|
14
|
+
|
15
|
+
GEM
|
16
|
+
remote: https://rubygems.org/
|
17
|
+
specs:
|
18
|
+
activemodel (3.2.13)
|
19
|
+
activesupport (= 3.2.13)
|
20
|
+
builder (~> 3.0.0)
|
21
|
+
activesupport (3.2.13)
|
22
|
+
i18n (= 0.6.1)
|
23
|
+
multi_json (~> 1.0)
|
24
|
+
addressable (2.3.4)
|
25
|
+
builder (3.0.4)
|
26
|
+
colored (1.2)
|
27
|
+
hirb (0.7.1)
|
28
|
+
i18n (0.6.1)
|
29
|
+
json (1.8.0)
|
30
|
+
mime-types (1.23)
|
31
|
+
multi_json (1.7.3)
|
32
|
+
nokogiri (1.5.9)
|
33
|
+
oauth (0.4.7)
|
34
|
+
rake (10.0.4)
|
35
|
+
rest-client (1.6.7)
|
36
|
+
mime-types (>= 1.16)
|
37
|
+
ruby-trello (1.0.1)
|
38
|
+
activemodel
|
39
|
+
addressable (~> 2.3)
|
40
|
+
json
|
41
|
+
oauth (~> 0.4.5)
|
42
|
+
rest-client (~> 1.6.7)
|
43
|
+
|
44
|
+
PLATFORMS
|
45
|
+
ruby
|
46
|
+
|
47
|
+
DEPENDENCIES
|
48
|
+
rake
|
49
|
+
the_dude!
|
50
|
+
the_dude-trello!
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'the_dude'
|
2
|
+
require 'trello'
|
3
|
+
|
4
|
+
require 'the_dude-trello/command'
|
5
|
+
|
6
|
+
Trello.configure do |config|
|
7
|
+
config.developer_public_key = ENV['TRELLO_DEVELOPER_PUBLIC_KEY']
|
8
|
+
config.member_token = ENV['TRELLO_MEMBER_TOKEN']
|
9
|
+
end
|
10
|
+
|
11
|
+
TheDude::Variable.new(:trello_board_id, /\S+/).register
|
12
|
+
|
13
|
+
TheDudeTrello::Command.new 'list trello boards' do
|
14
|
+
boards = Trello::Board.all;
|
15
|
+
|
16
|
+
boards.each do |board|
|
17
|
+
say "\n\n#{board.name}"
|
18
|
+
lists = board.lists.map!{|b| {title: b.name} }
|
19
|
+
if lists.any?
|
20
|
+
say Hirb::Helpers::Table.render(lists)
|
21
|
+
else
|
22
|
+
say '[ Sweet, nothing to worry about there ]'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
''
|
27
|
+
end
|
28
|
+
|
29
|
+
TheDudeTrello::Command.new /list trello cards on board :trello_board_id/ do |board_id|
|
30
|
+
board = Trello::Board.find(board_id);
|
31
|
+
|
32
|
+
board.lists.each do |list|
|
33
|
+
say "\n\n#{list.name}"
|
34
|
+
cards = list.cards.map!{|c| {title: c.name} }
|
35
|
+
if cards.any?
|
36
|
+
say Hirb::Helpers::Table.render(cards)
|
37
|
+
else
|
38
|
+
say '[ Sweet, nothing to worry about there ]'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
''
|
43
|
+
end
|
44
|
+
|
45
|
+
TheDude::Command.new /find (\S+) on trello board :trello_board_id/ do |card_title, board_id|
|
46
|
+
extend Hirb::Console
|
47
|
+
card_regex = Regexp.new(Regexp.quote(card_title), Regexp::IGNORECASE)
|
48
|
+
board = Trello::Board.find(board_id);
|
49
|
+
anything_found = false
|
50
|
+
|
51
|
+
board.lists.each do |list|
|
52
|
+
cards = list.cards.map!{|c| {title: c.name, url: c.url} }.select{|c| c[:title].match card_regex}
|
53
|
+
if cards.any?
|
54
|
+
say "\n\n#{list.name}"
|
55
|
+
card_index = menu(cards, :fields => [:title])
|
56
|
+
card_index.each do |ci|
|
57
|
+
`open #{ci[:url]}`
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
puts "Nah, nothing for #{card_title}" unless anything_found
|
63
|
+
''
|
64
|
+
end
|
65
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module TheDudeTrello
|
2
|
+
class Command < TheDude::Command
|
3
|
+
# Checks that the necessary Trello configuration variables are set before
|
4
|
+
# trying a request
|
5
|
+
def ask *args
|
6
|
+
begin
|
7
|
+
raise 'You need to tell me your trello details' unless Trello.configuration.developer_public_key && Trello.configuration.member_token
|
8
|
+
super *args
|
9
|
+
rescue Exception => e
|
10
|
+
TheDude.complain e.message
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','the_dude-trello','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'the_dude-trello'
|
5
|
+
s.version = TheDude::Trello::VERSION
|
6
|
+
s.author = 'Adam Phillips'
|
7
|
+
s.email = 'adam@29ways.co.uk'
|
8
|
+
s.homepage = 'http://github.com/adamphillips/the_dude-trello'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'Powers up The Dude with trello integration'
|
11
|
+
# Add your other files here if you make them
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
14
|
+
s.require_paths << 'lib'
|
15
|
+
s.bindir = 'bin'
|
16
|
+
s.add_development_dependency('rake')
|
17
|
+
s.add_runtime_dependency('ruby-trello', '>=1')
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: the_dude-trello
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Adam Phillips
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-16 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: ruby-trello
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1'
|
46
|
+
description:
|
47
|
+
email: adam@29ways.co.uk
|
48
|
+
executables: []
|
49
|
+
extensions: []
|
50
|
+
extra_rdoc_files: []
|
51
|
+
files:
|
52
|
+
- .gitignore
|
53
|
+
- .rvmrc
|
54
|
+
- Gemfile
|
55
|
+
- Gemfile.lock
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- lib/the_dude-trello.rb
|
59
|
+
- lib/the_dude-trello/command.rb
|
60
|
+
- lib/the_dude-trello/version.rb
|
61
|
+
- the_dude-trello.gemspec
|
62
|
+
homepage: http://github.com/adamphillips/the_dude-trello
|
63
|
+
licenses: []
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ! '>='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
hash: 147054777518657516
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
hash: 147054777518657516
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 1.8.25
|
90
|
+
signing_key:
|
91
|
+
specification_version: 3
|
92
|
+
summary: Powers up The Dude with trello integration
|
93
|
+
test_files: []
|