totrello 0.3.04 → 1.0.0
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 +8 -8
- data/.gitignore +3 -83
- data/.hound.yml +1 -0
- data/.totrello.yml +3 -0
- data/.travis.yml +3 -7
- data/Gemfile +0 -1
- data/Guardfile +37 -0
- data/README.md +3 -1
- data/bin/ToTrello +31 -39
- data/lib/totrello.rb +3 -59
- data/lib/totrello/todos.rb +65 -0
- data/lib/totrello/trello_builder.rb +59 -0
- data/lib/totrello/trello_config.rb +31 -0
- data/lib/totrello/trelloize.rb +32 -0
- data/lib/totrello/version.rb +1 -1
- data/spec/fixtures/.totrello.yml +11 -0
- data/spec/fixtures/fixture.rb +19 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/todos_spec.rb +183 -0
- data/spec/totrello_spec.rb +7 -0
- data/spec/trello_builder_spec.rb +166 -0
- data/spec/trello_config_spec.rb +105 -0
- data/spec/trelloize_spec.rb +49 -0
- data/totrello.gemspec +10 -0
- metadata +165 -18
- data/lib/to_do_find.rb +0 -101
- data/lib/totrello_config.rb +0 -52
- data/lib/trello_creator.rb +0 -63
- data/test/spec_helper.rb +0 -8
- data/test/test_data/testing.rb +0 -19
- data/test/to_do_find_spec.rb +0 -67
- data/test/totrello_config_spec.rb +0 -23
- data/test/totrello_spec.rb +0 -67
- data/test/trello_creator_spec.rb +0 -60
data/lib/totrello_config.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
class TotrelloConfig
|
4
|
-
@project_name
|
5
|
-
@board_name
|
6
|
-
@default_list
|
7
|
-
@excludes
|
8
|
-
@todo_types
|
9
|
-
@file_types
|
10
|
-
@comment_style
|
11
|
-
|
12
|
-
def initialize(directory)
|
13
|
-
read_config(directory)
|
14
|
-
defaults(directory)
|
15
|
-
end
|
16
|
-
|
17
|
-
def build_hash
|
18
|
-
{
|
19
|
-
:project_name => @project_name,
|
20
|
-
:board_name => @board_name,
|
21
|
-
:default_list => @default_list,
|
22
|
-
:excludes => @excludes,
|
23
|
-
:todo_types => @todo_types,
|
24
|
-
:file_types => @file_types,
|
25
|
-
:comment_style => @comment_style
|
26
|
-
}
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
def read_config(directory)
|
31
|
-
|
32
|
-
totrello_config_file = File.join("#{directory}/", ".totrello.yml")
|
33
|
-
trello_yml = Dir.glob(totrello_config_file)[0]
|
34
|
-
|
35
|
-
unless trello_yml.nil?
|
36
|
-
config = YAML.load_file(trello_yml )
|
37
|
-
config['totrello'].each { |key, value| instance_variable_set("@#{key}", value) }
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
def defaults(directory)
|
43
|
-
@project_name ||= directory.split('/').last
|
44
|
-
@board_name ||= directory.split('/').last
|
45
|
-
@default_list ||= 'To Do'
|
46
|
-
@excludes ||= Array(nil)
|
47
|
-
@todo_types ||= Array(['TODO', '#TODO', '#TODO:', 'TODO:'])
|
48
|
-
@file_types ||= Array(['.rb','.erb'])
|
49
|
-
@comment_style ||= Array(['#'])
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
data/lib/trello_creator.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
require 'trello'
|
2
|
-
|
3
|
-
class TrelloCreator
|
4
|
-
def initialize
|
5
|
-
Trello.configure do |config|
|
6
|
-
config.developer_public_key = TRELLO_DEVELOPER_PUBLIC_KEY
|
7
|
-
config.member_token = TRELLO_MEMBER_TOKEN
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def create_card(board, name, description, list_name)
|
12
|
-
list_names = ['To Do', 'Doing', 'Done']
|
13
|
-
unless card_exists?(board, list_names, name)
|
14
|
-
card = Trello::Card.create(name: name, list_id: self.find_list(board, list_name), desc: description)
|
15
|
-
card.save
|
16
|
-
|
17
|
-
#puts card.desc
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def find_cards(board,list)
|
22
|
-
list = Trello::List.new 'idBoard' => board,
|
23
|
-
'id' => list
|
24
|
-
list.cards
|
25
|
-
end
|
26
|
-
|
27
|
-
def create_board(board_name, description)
|
28
|
-
Trello::Board.create(name: board_name, description: description)
|
29
|
-
end
|
30
|
-
|
31
|
-
def find_board(name)
|
32
|
-
out = ''
|
33
|
-
Trello::Board.all.each do |board|
|
34
|
-
if board.name.upcase == name.upcase
|
35
|
-
out = board.id
|
36
|
-
end
|
37
|
-
end
|
38
|
-
if out == ''
|
39
|
-
nil
|
40
|
-
else
|
41
|
-
Trello::Board.find(out)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def find_list(board, list_name)
|
46
|
-
board.lists.find { |list| list.name == list_name }.id
|
47
|
-
end
|
48
|
-
|
49
|
-
def card_exists?(board, list_names, card_name)
|
50
|
-
out = false
|
51
|
-
list_names.each do |list_name|
|
52
|
-
self.find_cards(board,self.find_list(board, list_name)).each do |card|
|
53
|
-
return true if card_name.nil?
|
54
|
-
if card.name.include? card_name
|
55
|
-
out = true
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
out
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
data/test/spec_helper.rb
DELETED
data/test/test_data/testing.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
#TODO: test1
|
2
|
-
# TODO: test2
|
3
|
-
# TODO test3
|
4
|
-
# TODO: test4}
|
5
|
-
#TODO test5
|
6
|
-
#TODO: test6
|
7
|
-
todo
|
8
|
-
todo.test
|
9
|
-
TODO.tst #sdfasdfasdf
|
10
|
-
def clean_todos(todo_array)
|
11
|
-
todo_array.each do |found_todos|
|
12
|
-
found_todos[:todo].gsub!('TODO:', '')
|
13
|
-
found_todos[:todo].gsub!('TODO', '')
|
14
|
-
found_todos[:todo].gsub!('#', '')
|
15
|
-
found_todos[:todo].chomp!
|
16
|
-
found_todos[:todo].lstrip!
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
data/test/to_do_find_spec.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
require 'totrello'
|
2
|
-
require 'digest/sha1'
|
3
|
-
|
4
|
-
describe 'ToDoFind' do
|
5
|
-
|
6
|
-
describe 'find_todo_items' do
|
7
|
-
it 'returns a hash of todo items from a directory'do
|
8
|
-
todo = ToDoFind.new
|
9
|
-
todos = todo.search("#{Dir.pwd}/test/test_data",
|
10
|
-
nil,
|
11
|
-
Array(['TODO', '#TODO', '#TODO:', 'TODO:']),
|
12
|
-
Array(['.rb','.erb']),
|
13
|
-
Array(['#']))
|
14
|
-
expected = {:directory => "test_data",
|
15
|
-
:todo_list => [{:file => "/testing.rb",
|
16
|
-
:todos => [{:todo => "test1", :location => 1},
|
17
|
-
{:todo => "test2", :location => 2},
|
18
|
-
{:todo => "test3", :location => 3},
|
19
|
-
{:todo => "test4}", :location => 4},
|
20
|
-
{:todo => "test5", :location => 5},
|
21
|
-
{:todo => "test6", :location => 6}]}]}
|
22
|
-
expect(todos).to include(expected)
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
describe 'formatted_data' do
|
28
|
-
it "Should have a string for the todo and an Int for the locaion" do
|
29
|
-
todo = ToDoFind.new
|
30
|
-
todos = todo.search("#{Dir.pwd}/test/test_data",
|
31
|
-
nil,
|
32
|
-
Array(['TODO', '#TODO', '#TODO:', 'TODO:']),
|
33
|
-
Array(['.rb','.erb']),
|
34
|
-
Array(['#']))
|
35
|
-
|
36
|
-
todos[:todo_list].each do |tdl|
|
37
|
-
tdl[:todos].each do |td|
|
38
|
-
expect(td[:todo]).to be_a_kind_of(String)
|
39
|
-
expect(td[:location]).to be_a_kind_of(Integer)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'get_folders' do
|
48
|
-
it "Should return an array of files and folders" do
|
49
|
-
todo = ToDoFind.new
|
50
|
-
files = todo.get_folders("#{Dir.pwd}/test/test_data",Array(['.rb','.erb']))
|
51
|
-
expect(files).to be_a(Array)
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
describe 'exclude_folders' do
|
57
|
-
it "Should return an array an empty array" do
|
58
|
-
todo = ToDoFind.new
|
59
|
-
files =todo.get_folders("#{Dir.pwd}/test/test_data",Array(['.rb','.erb']))
|
60
|
-
files = todo.exclude_folders(files, Array(['test']))
|
61
|
-
expect(files).to be_a(Array)
|
62
|
-
expect(files).to match_array([])
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'totrello_config'
|
3
|
-
|
4
|
-
describe 'defaults' do
|
5
|
-
|
6
|
-
it 'should produce a hash of the defaulted settings file' do
|
7
|
-
|
8
|
-
|
9
|
-
sample_config = TotrelloConfig.new("#{Dir.pwd}/test/test_data/noymlfile")
|
10
|
-
test_settings = {
|
11
|
-
:project_name => 'noymlfile',
|
12
|
-
:board_name => 'noymlfile',
|
13
|
-
:default_list => 'To Do',
|
14
|
-
:excludes => Array(nil)
|
15
|
-
}
|
16
|
-
expect(sample_config.build_hash).to include(test_settings)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
data/test/totrello_spec.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
require 'totrello'
|
2
|
-
require 'digest/sha1'
|
3
|
-
|
4
|
-
describe 'Totrello' do
|
5
|
-
|
6
|
-
describe 'initialize' do
|
7
|
-
|
8
|
-
it "should return a trello and directory" do
|
9
|
-
|
10
|
-
t = Totrello::Trelloize.new("#{Dir.pwd}/test/test_data")
|
11
|
-
expect(t).to be_an_instance_of(Totrello::Trelloize)
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
describe 'create_or_gen_board' do
|
18
|
-
|
19
|
-
it "should return a board" do
|
20
|
-
directory = "#{Dir.pwd}/test/test_data"
|
21
|
-
|
22
|
-
t = Totrello::Trelloize.new(directory)
|
23
|
-
board = t.create_or_gen_board
|
24
|
-
|
25
|
-
expect(board.name.downcase).to eq(directory.split('/').last.downcase)
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
describe 'create_card' do
|
32
|
-
|
33
|
-
it "should return a card" do
|
34
|
-
|
35
|
-
directory = "#{Dir.pwd}/test/test_data"
|
36
|
-
|
37
|
-
t = Totrello::Trelloize.new(directory)
|
38
|
-
board = t.create_or_gen_board
|
39
|
-
|
40
|
-
card_name = Digest::SHA1.hexdigest Time.now.to_s
|
41
|
-
|
42
|
-
card = t.create_trello_card(board, 'To Do', {:todo => card_name, :location => card_name.reverse }, directory.split('/').last)
|
43
|
-
|
44
|
-
expect(card).to include(card_name)
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
|
50
|
-
describe 'create_cards' do
|
51
|
-
it 'loop over the cards and create them' do
|
52
|
-
# Missing test
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe 'get_todos' do
|
57
|
-
it 'should return an hash map of todos' do
|
58
|
-
directory = "#{Dir.pwd}/test/test_data"
|
59
|
-
t = Totrello::Trelloize.new(directory)
|
60
|
-
todos = t.get_todos
|
61
|
-
expect(todos).to include(:todo_list)
|
62
|
-
expect(todos).to be_a_kind_of(Hash)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
end
|
67
|
-
|
data/test/trello_creator_spec.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'totrello'
|
2
|
-
require 'digest/sha1'
|
3
|
-
|
4
|
-
describe 'TrelloCreator' do
|
5
|
-
|
6
|
-
describe 'initialize' do
|
7
|
-
it 'should become an instance of itself' do
|
8
|
-
t = TrelloCreator.new
|
9
|
-
expect(t).to be_an_instance_of(TrelloCreator)
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
describe 'create_card' do
|
15
|
-
|
16
|
-
it 'should create a card' do
|
17
|
-
|
18
|
-
directory = "#{Dir.pwd}/test/test_data"
|
19
|
-
board_name = directory.split('/').last
|
20
|
-
|
21
|
-
|
22
|
-
t = TrelloCreator.new
|
23
|
-
|
24
|
-
board = t.find_board(board_name)
|
25
|
-
board ||= t.create_board(board_name, 'Auto Generated by ToTrello Gem')
|
26
|
-
|
27
|
-
card_name = {:todo => (Digest::SHA1.hexdigest Time.now.to_s)}
|
28
|
-
card = t.create_card(board, card_name[:todo], card_name[:todo].reverse,'To Do')
|
29
|
-
expect(card).to include(card_name[:todo])
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
describe 'find_cards' do
|
36
|
-
|
37
|
-
it 'should find cards' do
|
38
|
-
|
39
|
-
directory = "#{Dir.pwd}/test/test_data"
|
40
|
-
board_name = directory.split('/').last
|
41
|
-
|
42
|
-
|
43
|
-
t = TrelloCreator.new
|
44
|
-
|
45
|
-
board = t.find_board(board_name)
|
46
|
-
board ||= t.create_board(board_name, 'Auto Generated by ToTrello Gem')
|
47
|
-
list = t.find_list(board, 'To Do')
|
48
|
-
|
49
|
-
cards = t.find_cards(board,list)
|
50
|
-
expect(cards).to be_a(Array)
|
51
|
-
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
|
60
|
-
|