totrello 0.1.13 → 0.1.14
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/lib/to_do_find.rb +1 -1
- data/lib/totrello/version.rb +1 -1
- data/lib/totrello.rb +16 -16
- data/test/totrello_spec.rb +39 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Njc3NmNlM2IyODE3NDBmOWFkZDFhOWNiNjZlYjM2OWE0YTUwMmM1YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmMyNzdiYThmNDA5OTc1ZTdlNmY0YzQ5OGQ4NmE0NmVlMmUxYjVhMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzdiNTVmMDA3YmVmODNkYjE3NTExMmUyZDUwZDE0N2E2OTcyZDI0NTA1Njdj
|
10
|
+
MGM0NjBkNzg1MmJlMDBjZTY3NGY1MDAyZDQ0N2I2YTg2NGZhODhhZTk5ZTg5
|
11
|
+
YmUzMWUxZWU2MGU3MDQxZjA5NmQwNmI2MzExMTg0MmFlNDk0YmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWI1YTkzZmI1ZGI3MDgyZjllNjQ5MjY5MjVkNTEyZGEwZGY4ZjViMjEzODI4
|
14
|
+
NDE0MmFkM2IyOTMzYzMxZGZhNjdmODY1ZjA0MmIwOGUwY2MzODk4OGRmMzM2
|
15
|
+
ZmMzNmEyZWEwYmI3YWI2NDkzNmRiNTUyNDdkZjg1MWNmODA4Yjc=
|
data/lib/to_do_find.rb
CHANGED
@@ -48,7 +48,7 @@ class ToDoFind
|
|
48
48
|
unless todo_location.nil?
|
49
49
|
temp_string_array = code_line.split(' ')
|
50
50
|
todo = code_line.split(' ')[(todo_location + 1)..((temp_string_array.length) - 1)].join(' ')
|
51
|
-
puts "Found! #{todo}"
|
51
|
+
#puts "Found! #{todo}"
|
52
52
|
todo_and_location = {:todo => todo,
|
53
53
|
:location => line_num}
|
54
54
|
@out.append(todo_and_location)
|
data/lib/totrello/version.rb
CHANGED
data/lib/totrello.rb
CHANGED
@@ -33,40 +33,40 @@ module Totrello
|
|
33
33
|
puts "Woot! We've got'em"
|
34
34
|
|
35
35
|
puts 'Generating your board'
|
36
|
+
|
36
37
|
board_name = todos[:directory].nil? ? todos[:directory] : @directory.split('/').last
|
37
38
|
puts "Creating the board: #{board_name}"
|
38
|
-
board = @trello.find_board(board_name)
|
39
|
-
board ||= @trello.create_board(board_name, 'Auto Generated by ToTrello Gem')
|
40
39
|
|
41
|
-
return -1 if board.nil?
|
42
|
-
puts "Created or found a board with the ID: #{board.name}"
|
43
40
|
|
41
|
+
board = create_or_gen_board(board_name)
|
44
42
|
|
43
|
+
return -1 if board.nil?
|
44
|
+
|
45
|
+
puts "Created or found a board with the ID: #{board.name}"
|
45
46
|
|
46
47
|
puts 'Talking to Trello, this is the longest part...'
|
47
48
|
todos[:todo_list].each do |tdl|
|
48
49
|
tdl[:todos].each do |td|
|
49
50
|
puts gen_description(tdl[:file], td)
|
50
|
-
|
51
|
+
#@trello.create_card(board,td, gen_description(tdl[:file],td),'To Do') unless td == ''
|
52
|
+
unless td == ''
|
53
|
+
create_trello_card(board, 'To Do', td, tdl[:file])
|
54
|
+
end
|
51
55
|
end
|
52
56
|
end
|
53
57
|
puts "And you're ready to go!"
|
54
58
|
end
|
55
59
|
|
60
|
+
def create_or_gen_board(board_name)
|
61
|
+
board = @trello.find_board(board_name)
|
62
|
+
board ||= @trello.create_board(board_name, 'Auto Generated by ToTrello Gem')
|
63
|
+
end
|
56
64
|
|
57
|
-
def
|
58
|
-
|
59
|
-
todo = ToDoFind.new
|
60
|
-
todos = todo.search(@directory)
|
61
|
-
|
62
|
-
todos[:todo_list].each do |tdl|
|
63
|
-
tdl[:todos].each do |td|
|
64
|
-
puts gen_description(tdl[:file], td)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
65
|
+
def create_trello_card(board, list, todo, filename)
|
66
|
+
@trello.create_card(board, todo, gen_description(filename,todo),list)
|
68
67
|
end
|
69
68
|
|
69
|
+
|
70
70
|
def gen_description(file, todo)
|
71
71
|
out = "TODO item found by ToTrello\n"
|
72
72
|
out += "Filename: #{file}\n"
|
data/test/totrello_spec.rb
CHANGED
@@ -1,4 +1,43 @@
|
|
1
1
|
require 'totrello'
|
2
|
+
require 'digest/sha1'
|
3
|
+
|
4
|
+
|
5
|
+
TRELLO_DEVELOPER_PUBLIC_KEY = ENV['TRELLO_DEVELOPER_PUBLIC_KEY']
|
6
|
+
TRELLO_MEMBER_TOKEN = ENV['TRELLO_MEMBER_TOKEN']
|
7
|
+
|
8
|
+
describe 'totrello#initialize' do
|
9
|
+
|
10
|
+
it "should return a trello and directory" do
|
11
|
+
|
12
|
+
t = Totrello::Trelloize.new("#{Dir.pwd}/test/test_data")
|
13
|
+
expect(t).to be_an_instance_of(Totrello::Trelloize)
|
14
|
+
#expect(@directory).to be_a_kind_of(String)
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'totrello#create_or_gen_board' do
|
21
|
+
it "should return a board" do
|
22
|
+
directory = "#{Dir.pwd}/test/test_data"
|
23
|
+
t = Totrello::Trelloize.new(directory)
|
24
|
+
board = t.create_or_gen_board(directory.split('/').last)
|
25
|
+
expect(board.name.downcase).to eq(directory.split('/').last.downcase)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'totrello#create_card' do
|
31
|
+
it "should return a card" do
|
32
|
+
directory = "#{Dir.pwd}/test/test_data"
|
33
|
+
t = Totrello::Trelloize.new(directory)
|
34
|
+
board = t.create_or_gen_board(directory.split('/').last)
|
35
|
+
card_name = Digest::SHA1.hexdigest Time.now.to_s
|
36
|
+
card = t.create_trello_card(board, 'To Do', {:todo => card_name, :location => card_name.reverse }, directory.split('/').last)
|
37
|
+
expect(card).to include(card_name)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
2
41
|
|
3
42
|
describe '#find_todo_items' do
|
4
43
|
it 'returns a hash of todo items from a directory'do
|