troo 0.0.12 → 0.0.13
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 +4 -4
- data/.gitignore +2 -1
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/bin/troo +0 -20
- data/config/en.yml +1 -1
- data/lib/troo.rb +1 -1
- data/lib/troo/cli/commands/add.rb +2 -2
- data/lib/troo/cli/commands/default.rb +2 -2
- data/lib/troo/cli/commands/move/card.rb +2 -2
- data/lib/troo/cli/commands/refresh.rb +2 -2
- data/lib/troo/cli/commands/show/show_boards.rb +2 -2
- data/lib/troo/cli/commands/show/show_comments.rb +2 -2
- data/lib/troo/cli/commands/status.rb +2 -2
- data/lib/troo/cli/thor_fixes.rb +1 -1
- data/lib/troo/cli/wizard.rb +40 -5
- data/lib/troo/database.rb +2 -2
- data/lib/troo/decorators/resource.rb +1 -1
- data/lib/troo/launcher.rb +1 -2
- data/lib/troo/preference.rb +1 -1
- data/lib/troo/retrieval/remote.rb +2 -2
- data/lib/troo/version.rb +1 -1
- data/test/lib/troo/api/client_test.rb +2 -0
- data/test/lib/troo/api/endpoints_test.rb +2 -0
- data/test/lib/troo/api/headers_test.rb +2 -0
- data/test/lib/troo/cli/add_test.rb +8 -0
- data/test/lib/troo/cli/commands/add_test.rb +2 -0
- data/test/lib/troo/cli/commands/default_test.rb +2 -0
- data/test/lib/troo/cli/commands/move/card_test.rb +2 -0
- data/test/lib/troo/cli/commands/refresh/all_test.rb +2 -0
- data/test/lib/troo/cli/commands/refresh_test.rb +2 -0
- data/test/lib/troo/cli/commands/show/show_boards_test.rb +2 -0
- data/test/lib/troo/cli/commands/show/show_comments_test.rb +2 -0
- data/test/lib/troo/cli/commands/show_test.rb +2 -0
- data/test/lib/troo/cli/commands/status_test.rb +2 -0
- data/test/lib/troo/cli/default_test.rb +6 -0
- data/test/lib/troo/cli/main_test.rb +10 -0
- data/test/lib/troo/cli/refresh_test.rb +8 -0
- data/test/lib/troo/cli/show_test.rb +10 -0
- data/test/lib/troo/cli/thor_fixes_test.rb +2 -0
- data/test/lib/troo/cli/wizard_test.rb +20 -0
- data/test/lib/troo/configuration_test.rb +4 -0
- data/test/lib/troo/database_test.rb +18 -0
- data/test/lib/troo/decorators/resource_test.rb +66 -0
- data/test/lib/troo/helpers/decorator_helpers_test.rb +2 -0
- data/test/lib/troo/helpers/model_helpers_test.rb +27 -3
- data/test/lib/troo/helpers/remote_model_helpers_test.rb +16 -0
- data/test/lib/troo/models/behaviours/set_default_test.rb +4 -0
- data/test/lib/troo/models/board_test.rb +2 -0
- data/test/lib/troo/models/card_test.rb +2 -0
- data/test/lib/troo/models/comment_test.rb +4 -0
- data/test/lib/troo/models/list_test.rb +4 -0
- data/test/lib/troo/models/member_test.rb +4 -0
- data/test/lib/troo/persistence/local_test.rb +2 -0
- data/test/lib/troo/preference_test.rb +2 -0
- data/test/lib/troo/remote/{comment_data_board.rb → comment_data_board_test.rb} +0 -0
- data/test/lib/troo/retrieval/local_test.rb +8 -2
- data/test/lib/troo/retrieval/remote_test.rb +7 -1
- data/test/lib/troo/version_test.rb +9 -0
- data/test/system_test.sh +0 -3
- metadata +6 -6
- data/test/lib/troo/models/database_test.rb +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 355a88b81a74299dc28bff18c0a914cbcf5afda2
|
|
4
|
+
data.tar.gz: 0cacd07a0f2d44cc02809293dcfae5cebbc5bdab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f59cc95a9bd5520f7002f6bd580eb58b03dc32ff2c4457248121915a19194246bbcc59cc7e120b00603dc8ed230504f78e5279a06d943b40ab6adb0a40796a2
|
|
7
|
+
data.tar.gz: ff15f1ab11fe9b71c3858870727d16d8b251acc1cf1e8fb09a12a6706f7dbe19805555955a86fd702ff2d72a588e0af3c89f132902baf10801479c9266f5f390
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -45,7 +45,7 @@ Simply run `troo wizard` and follow the on screen instructions.
|
|
|
45
45
|
|
|
46
46
|
https://trello.com/1/connect?key=your_key_here&name=troo&response_type=token&scope=read,write
|
|
47
47
|
|
|
48
|
-
4) Add your authentication tokens to the configuration file `.trooconf` in your home directory. (This file will be created for you the first time you run `troo
|
|
48
|
+
4) Add your authentication tokens to the configuration file `.trooconf` in your home directory. (This file will be created for you the first time you run `troo wizard`)
|
|
49
49
|
|
|
50
50
|
5) Have fun, and tweet me @gavinlaking if you like it.
|
|
51
51
|
|
|
@@ -73,7 +73,7 @@ Simply run `troo wizard` and follow the on screen instructions.
|
|
|
73
73
|
|
|
74
74
|
- Prepare to use Troo.
|
|
75
75
|
|
|
76
|
-
troo
|
|
76
|
+
troo wizard
|
|
77
77
|
|
|
78
78
|
- Move card with <card_id> to list with <list_id> optionally to another board with <board_id>.
|
|
79
79
|
|
data/Rakefile
CHANGED
data/bin/troo
CHANGED
|
@@ -8,26 +8,6 @@ if ARGV.include?('autocomplete')
|
|
|
8
8
|
%w{add cleanup config default init move refresh
|
|
9
9
|
show status version}.select { |e| /^#{command}/ =~ e }
|
|
10
10
|
.map { |c| puts c }
|
|
11
|
-
elsif ARGV.include?('init')
|
|
12
|
-
require 'fileutils'
|
|
13
|
-
|
|
14
|
-
source = File.dirname(__FILE__) + '/../config/trooconf.yml'
|
|
15
|
-
destination = Dir.home + '/.trooconf'
|
|
16
|
-
|
|
17
|
-
if File.exist?(destination)
|
|
18
|
-
puts "\nA configuration file already exists in your home " \
|
|
19
|
-
"directory.\n\n"
|
|
20
|
-
else
|
|
21
|
-
print "\nCreating a configuration file in your home directory..."
|
|
22
|
-
|
|
23
|
-
FileUtils.cp(source, destination)
|
|
24
|
-
|
|
25
|
-
sleep 1 # simulate work being done
|
|
26
|
-
print " done.\n\n"
|
|
27
|
-
|
|
28
|
-
help = File.read(File.dirname(__FILE__) + '/../config/help')
|
|
29
|
-
print help
|
|
30
|
-
end
|
|
31
11
|
elsif ARGV.include?('path')
|
|
32
12
|
puts File.expand_path File.dirname(__FILE__)
|
|
33
13
|
else
|
data/config/en.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
en:
|
|
2
2
|
configuration:
|
|
3
|
-
not_found: 'Configuration cannot be found, please run `troo
|
|
3
|
+
not_found: 'Configuration cannot be found, please run `troo wizard` or `./bin/troo wizard` first.'
|
|
4
4
|
cli:
|
|
5
5
|
add:
|
|
6
6
|
board: 'Add a new board with <name>; prompts if <name> not provided.'
|
data/lib/troo.rb
CHANGED
|
@@ -15,7 +15,7 @@ module Troo
|
|
|
15
15
|
def self.configuration(file = Dir.home + '/.trooconf', env = 'default')
|
|
16
16
|
unless File.exist?(file)
|
|
17
17
|
warn "\nConfiguration cannot be found, please run `troo " \
|
|
18
|
-
"
|
|
18
|
+
"wizard` or `./bin/troo wizard` first.\n"
|
|
19
19
|
file = root_path + '/config/trooconf.yml'
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -7,7 +7,7 @@ module Troo
|
|
|
7
7
|
# @param []
|
|
8
8
|
# @param []
|
|
9
9
|
# @param [Hash]
|
|
10
|
-
# @return []
|
|
10
|
+
# @return [String]
|
|
11
11
|
def dispatch(value, id = nil, options = {})
|
|
12
12
|
new(value, id, options).add
|
|
13
13
|
end
|
|
@@ -21,7 +21,7 @@ module Troo
|
|
|
21
21
|
@value, @id, @options = value, id, options
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
# @return []
|
|
24
|
+
# @return [String]
|
|
25
25
|
def add
|
|
26
26
|
return success if create
|
|
27
27
|
error
|
|
@@ -4,7 +4,7 @@ module Troo
|
|
|
4
4
|
class << self
|
|
5
5
|
# @param []
|
|
6
6
|
# @param []
|
|
7
|
-
# @return []
|
|
7
|
+
# @return [String]
|
|
8
8
|
def dispatch(klass, id)
|
|
9
9
|
new(klass, id).set_default
|
|
10
10
|
end
|
|
@@ -17,7 +17,7 @@ module Troo
|
|
|
17
17
|
@klass, @id = klass, id
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# @return []
|
|
20
|
+
# @return [String]
|
|
21
21
|
def set_default
|
|
22
22
|
return success if resource && resource.set_default!
|
|
23
23
|
error
|
|
@@ -6,7 +6,7 @@ module Troo
|
|
|
6
6
|
# @param []
|
|
7
7
|
# @param []
|
|
8
8
|
# @param []
|
|
9
|
-
# @return []
|
|
9
|
+
# @return [String]
|
|
10
10
|
def dispatch(card_id, list_id, board_id = nil)
|
|
11
11
|
new(card_id, list_id, board_id).move
|
|
12
12
|
end
|
|
@@ -20,7 +20,7 @@ module Troo
|
|
|
20
20
|
@card_id, @list_id, @board_id = card_id, list_id, board_id
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
# @return []
|
|
23
|
+
# @return [String]
|
|
24
24
|
def move
|
|
25
25
|
return 'Card cannot be found.' if card_not_found?
|
|
26
26
|
return 'List cannot be found.' if list_not_found?
|
|
@@ -6,7 +6,7 @@ module Troo
|
|
|
6
6
|
class << self
|
|
7
7
|
# @param []
|
|
8
8
|
# @param []
|
|
9
|
-
# @return []
|
|
9
|
+
# @return [String]
|
|
10
10
|
def dispatch(klass, id = nil)
|
|
11
11
|
new(klass, id).refresh
|
|
12
12
|
end
|
|
@@ -19,7 +19,7 @@ module Troo
|
|
|
19
19
|
@klass, @id = klass, id
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
# @return []
|
|
22
|
+
# @return [String]
|
|
23
23
|
def refresh
|
|
24
24
|
return not_found if not_found?
|
|
25
25
|
return many_success if multiple_refreshed?
|
|
@@ -2,7 +2,7 @@ module Troo
|
|
|
2
2
|
module Commands
|
|
3
3
|
class ShowBoards
|
|
4
4
|
class << self
|
|
5
|
-
# @return []
|
|
5
|
+
# @return [String]
|
|
6
6
|
def dispatch
|
|
7
7
|
new.render
|
|
8
8
|
end
|
|
@@ -10,7 +10,7 @@ module Troo
|
|
|
10
10
|
|
|
11
11
|
def initialize; end
|
|
12
12
|
|
|
13
|
-
# @return []
|
|
13
|
+
# @return [String]
|
|
14
14
|
def render
|
|
15
15
|
return presenter if resources.any?
|
|
16
16
|
error
|
|
@@ -5,7 +5,7 @@ module Troo
|
|
|
5
5
|
|
|
6
6
|
class << self
|
|
7
7
|
# @param []
|
|
8
|
-
# @return []
|
|
8
|
+
# @return [String]
|
|
9
9
|
def dispatch(id = nil)
|
|
10
10
|
new(id).render
|
|
11
11
|
end
|
|
@@ -17,7 +17,7 @@ module Troo
|
|
|
17
17
|
@id = id
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
# @return []
|
|
20
|
+
# @return [String]
|
|
21
21
|
def render
|
|
22
22
|
if resource
|
|
23
23
|
presenter
|
|
@@ -3,7 +3,7 @@ module Troo
|
|
|
3
3
|
class Status
|
|
4
4
|
class << self
|
|
5
5
|
# @param []
|
|
6
|
-
# @return []
|
|
6
|
+
# @return [String]
|
|
7
7
|
def dispatch(klass)
|
|
8
8
|
new(klass).report_status
|
|
9
9
|
end
|
|
@@ -15,7 +15,7 @@ module Troo
|
|
|
15
15
|
@klass = klass
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
# @return []
|
|
18
|
+
# @return [String]
|
|
19
19
|
def report_status
|
|
20
20
|
return success if resource
|
|
21
21
|
error
|
data/lib/troo/cli/thor_fixes.rb
CHANGED
data/lib/troo/cli/wizard.rb
CHANGED
|
@@ -9,10 +9,12 @@ module Troo
|
|
|
9
9
|
def start
|
|
10
10
|
say Troo::Formatter.wordwrap(welcome_message)
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
step_one!
|
|
12
|
+
step_zero!
|
|
14
13
|
|
|
15
14
|
say Troo::Formatter.wordwrap(step_one_message)
|
|
15
|
+
step_one!
|
|
16
|
+
|
|
17
|
+
say Troo::Formatter.wordwrap(step_two_message)
|
|
16
18
|
|
|
17
19
|
proceed?
|
|
18
20
|
step_two!
|
|
@@ -39,6 +41,18 @@ module Troo
|
|
|
39
41
|
raise ConfigurationAborted unless yes?(user_input('Proceed?'))
|
|
40
42
|
end
|
|
41
43
|
|
|
44
|
+
def step_zero!
|
|
45
|
+
if destination_exists?
|
|
46
|
+
say "A configuration file already exists.\n"
|
|
47
|
+
|
|
48
|
+
raise ConfigurationAborted unless yes?(user_input('Overwrite?'))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
copy_configuration
|
|
52
|
+
|
|
53
|
+
say "A configuration file was created.\n"
|
|
54
|
+
end
|
|
55
|
+
|
|
42
56
|
def step_one!
|
|
43
57
|
Launchy.open(generate_url)
|
|
44
58
|
config.api_key = ask(user_input('Key:'))
|
|
@@ -52,13 +66,18 @@ module Troo
|
|
|
52
66
|
end
|
|
53
67
|
|
|
54
68
|
def welcome_message
|
|
55
|
-
"Welcome to Troo. This wizard will
|
|
56
|
-
"
|
|
69
|
+
"Welcome to Troo. This wizard will create a configuration file " \
|
|
70
|
+
"in your home directory and help you configure your API credentials " \
|
|
71
|
+
"for Trello.\n\n"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def step_one_message
|
|
75
|
+
"First, you'll need to sign in " \
|
|
57
76
|
"to Trello in the normal way. Copy the API key and paste " \
|
|
58
77
|
"when prompted, then do the same for the secret.\n"
|
|
59
78
|
end
|
|
60
79
|
|
|
61
|
-
def
|
|
80
|
+
def step_two_message
|
|
62
81
|
"Thank you. You must now allow this application to use " \
|
|
63
82
|
"Trello account. Copy and paste the token when prompted.\n"
|
|
64
83
|
end
|
|
@@ -66,6 +85,22 @@ module Troo
|
|
|
66
85
|
def user_input(value)
|
|
67
86
|
[Esc.yellow, value, Esc.reset].join
|
|
68
87
|
end
|
|
88
|
+
|
|
89
|
+
def copy_configuration
|
|
90
|
+
FileUtils.cp(source, destination)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def destination_exists?
|
|
94
|
+
File.exist?(destination)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def destination
|
|
98
|
+
Dir.home + '/.trooconf'
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def source
|
|
102
|
+
File.dirname(__FILE__) + '/../../../config/trooconf.yml'
|
|
103
|
+
end
|
|
69
104
|
end
|
|
70
105
|
end
|
|
71
106
|
end
|
data/lib/troo/database.rb
CHANGED
|
@@ -11,12 +11,12 @@ module Troo
|
|
|
11
11
|
|
|
12
12
|
# @param []
|
|
13
13
|
# @param [Hash]
|
|
14
|
-
# @return []
|
|
14
|
+
# @return [Troo::Database]
|
|
15
15
|
def initialize(configuration, options = {})
|
|
16
16
|
@configuration, @options = configuration, options
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
# @return []
|
|
19
|
+
# @return [NilClass]
|
|
20
20
|
def connect
|
|
21
21
|
Ohm.connect(db: configuration.database)
|
|
22
22
|
end
|
data/lib/troo/launcher.rb
CHANGED
|
@@ -26,8 +26,7 @@ module Troo
|
|
|
26
26
|
rescue ConfigurationNotFound
|
|
27
27
|
pad do
|
|
28
28
|
puts "Configuration cannot be found, please run " \
|
|
29
|
-
"`troo wizard`
|
|
30
|
-
"configure."
|
|
29
|
+
"`troo wizard` to get started."
|
|
31
30
|
end
|
|
32
31
|
rescue ConfigurationAborted
|
|
33
32
|
pad { puts 'Configuration wizard aborted.' }
|
data/lib/troo/preference.rb
CHANGED
|
@@ -16,14 +16,14 @@ module Troo
|
|
|
16
16
|
# @param []
|
|
17
17
|
# @param []
|
|
18
18
|
# @param [Hash]
|
|
19
|
-
# @return []
|
|
19
|
+
# @return [Troo::Retrieval::Remote]
|
|
20
20
|
def initialize(klass, external_id, options = {})
|
|
21
21
|
@klass = klass
|
|
22
22
|
@external_id = external_id
|
|
23
23
|
@options = options
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
# @return []
|
|
26
|
+
# @return [Array]
|
|
27
27
|
def fetch
|
|
28
28
|
return [] if none?
|
|
29
29
|
return persist if persist?
|
data/lib/troo/version.rb
CHANGED
|
@@ -26,6 +26,8 @@ module Troo
|
|
|
26
26
|
describe '#perform' do
|
|
27
27
|
subject { described_class.perform(parameters) }
|
|
28
28
|
|
|
29
|
+
it { subject.must_be_instance_of(Array) }
|
|
30
|
+
|
|
29
31
|
context 'when all required parameters are provided' do
|
|
30
32
|
context 'and the API request returns a collection' do
|
|
31
33
|
let(:parsed_response) {
|
|
@@ -20,6 +20,8 @@ module Troo
|
|
|
20
20
|
context 'when a value is provided' do
|
|
21
21
|
let(:value) { 'some value' }
|
|
22
22
|
|
|
23
|
+
it { subject.must_be_instance_of(String) }
|
|
24
|
+
|
|
23
25
|
it 'returns the output of the command' do
|
|
24
26
|
subject.must_match(/could not be created/)
|
|
25
27
|
end
|
|
@@ -45,6 +47,8 @@ module Troo
|
|
|
45
47
|
context 'when a value is provided' do
|
|
46
48
|
let(:value) { 'some value' }
|
|
47
49
|
|
|
50
|
+
it { subject.must_be_instance_of(String) }
|
|
51
|
+
|
|
48
52
|
it 'returns the output of the command' do
|
|
49
53
|
subject.must_match(/could not be created/)
|
|
50
54
|
end
|
|
@@ -70,6 +74,8 @@ module Troo
|
|
|
70
74
|
context 'when a value is provided' do
|
|
71
75
|
let(:value) { 'some value' }
|
|
72
76
|
|
|
77
|
+
it { subject.must_be_instance_of(String) }
|
|
78
|
+
|
|
73
79
|
it 'returns the output of the command' do
|
|
74
80
|
subject.must_match(/could not be created/)
|
|
75
81
|
end
|
|
@@ -95,6 +101,8 @@ module Troo
|
|
|
95
101
|
context 'when a value is provided' do
|
|
96
102
|
let(:value) { 'some value' }
|
|
97
103
|
|
|
104
|
+
it { subject.must_be_instance_of(String) }
|
|
105
|
+
|
|
98
106
|
it 'returns the output of the command' do
|
|
99
107
|
subject.must_match(/could not be created/)
|
|
100
108
|
end
|