totrello 0.3.03 → 0.3.04
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/.travis.yml +2 -0
- data/bin/ToTrello +11 -2
- data/lib/to_do_find.rb +25 -19
- data/lib/totrello.rb +19 -57
- data/lib/totrello/version.rb +1 -1
- data/lib/totrello_config.rb +0 -1
- data/test/totrello_spec.rb +18 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTI2OGIzZWUzZWY3OGFkZDFhNzVjNGIzNWI2OTBiYTM1YjNjMmZmYQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODNjYjZmY2Y2MGE4NThlYzZmODg2Yzg2ZjJjNDhhNmE2ZmUwYjdiYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzkyNTk0N2RmZGJiNmQ4YzcwOGJmMTZkNWJlOTkxY2U1ODkzMDBjZWFkZWM0
|
10
|
+
NmQ5ZGY0MGY2N2E3NDQ2MzU5NGU4Zjg0NjFjZjZiM2RjZTE1NDZhMzE3NDRh
|
11
|
+
ODllYjgxODVmMzA5Yzk1ZDQ0ZWIxZmM1ODViOTY3ZTExNTNkMTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjQ3ODMxMzZiNzc0Y2FhYTdkOTQwNzBkOGU4MDQ0ODYzMGExZDkxNTMyNjZj
|
14
|
+
N2NlMjg4MjQ1OWU3NjVmNDAzZTAyZWRjZWQ0MzU0MmIyMzg3MWVjMTIwNWQ4
|
15
|
+
ZjUwMjM5MWZjOGYwOTYxZTNlNGQxZmViY2I0ODc4M2YxMTIyMzE=
|
data/.travis.yml
CHANGED
data/bin/ToTrello
CHANGED
@@ -32,11 +32,20 @@ def main
|
|
32
32
|
|
33
33
|
|
34
34
|
puts "You've specified to work in: #{dir}"
|
35
|
-
|
36
35
|
trel = Totrello::Trelloize.new(dir)
|
37
|
-
|
36
|
+
puts 'Generating your board'
|
37
|
+
board = trel.create_or_gen_board
|
38
|
+
return -1 if board.nil?
|
39
|
+
puts "Created or found a board with the ID: #{board.name}"
|
40
|
+
puts 'Finding your todo items... '
|
41
|
+
todos = trel.get_todos
|
42
|
+
puts "Woot! We've got'em"
|
43
|
+
trel.create_cards(board, todos)
|
44
|
+
puts "And you're ready to go!"
|
45
|
+
|
38
46
|
|
39
47
|
end
|
48
|
+
|
40
49
|
end
|
41
50
|
|
42
51
|
|
data/lib/to_do_find.rb
CHANGED
@@ -5,23 +5,18 @@ class ToDoFind
|
|
5
5
|
# This will search a given directory
|
6
6
|
#
|
7
7
|
def search(directory, excludes_dirs, todo_styles, file_types, comment_styles)
|
8
|
-
files_to_search = []
|
9
|
-
|
10
|
-
directory ||= Dir.pwd
|
11
8
|
|
12
9
|
todos= {directory: directory.split('/').last, :todo_list=>[] }
|
13
10
|
|
14
11
|
files_to_search = exclude_folders(get_folders(directory, file_types), Array(excludes_dirs))
|
15
12
|
|
13
|
+
files_to_search.each do |my_code_file|
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
found_todo = find_todo(my_text_file, todo_styles, comment_styles)
|
20
|
-
|
15
|
+
found_todo = find_todo(my_code_file, todo_styles, comment_styles)
|
21
16
|
|
22
17
|
if found_todo
|
23
18
|
todos[:todo_list].append(
|
24
|
-
{:file=>
|
19
|
+
{:file=> my_code_file.gsub(directory,''),
|
25
20
|
:todos => found_todo}
|
26
21
|
)
|
27
22
|
end
|
@@ -30,16 +25,14 @@ class ToDoFind
|
|
30
25
|
todos
|
31
26
|
end
|
32
27
|
|
33
|
-
def
|
28
|
+
def get_todos(files_to_search, found_todo)
|
34
29
|
|
35
|
-
files = []
|
36
|
-
directory ||= Dir.pwd
|
37
30
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
files
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_folders(directory, file_types)
|
34
|
+
directory ||= Dir.pwd
|
35
|
+
files = get_internal_folders(directory, file_types)
|
43
36
|
end
|
44
37
|
|
45
38
|
def exclude_folders(file_array, excludes_array)
|
@@ -51,17 +44,30 @@ class ToDoFind
|
|
51
44
|
|
52
45
|
def find_todo(file, todo_styles, comment_styles)
|
53
46
|
@out = []
|
54
|
-
code_lines = File.readlines(file)
|
55
|
-
code_lines= code_lines.map.with_index { |x,i| {:todo => x, :location => i + 1}}
|
56
47
|
|
57
48
|
todo_styles.each do |tds|
|
58
|
-
@out.concat((
|
49
|
+
@out.concat((get_code(file).find_all { |i| is_todo?(i[:todo], (tds))}))
|
59
50
|
end
|
60
51
|
|
61
52
|
clean_todos(@out, todo_styles, comment_styles).sort_by { |hsh| hsh[:todo] }
|
62
53
|
end
|
63
54
|
|
64
55
|
private
|
56
|
+
|
57
|
+
def get_internal_folders(directory, file_types)
|
58
|
+
files = []
|
59
|
+
file_types.each do |ft|
|
60
|
+
file = File.join("#{directory}/**", "*#{ft.to_s}")
|
61
|
+
files.concat(Dir.glob(file))
|
62
|
+
end
|
63
|
+
files
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_code(file)
|
67
|
+
code_lines = File.readlines(file)
|
68
|
+
code_lines.map.with_index { |x,i| {:todo => x, :location => i + 1}}
|
69
|
+
end
|
70
|
+
|
65
71
|
def clean_todos(todo_array, todo_styles, comment_styles)
|
66
72
|
todo_array.each do |found_todos|
|
67
73
|
todo_styles.each do |tds|
|
data/lib/totrello.rb
CHANGED
@@ -18,27 +18,9 @@ module Totrello
|
|
18
18
|
@config = totrello_config.build_hash
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
puts "Creating the board: #{@config[:board_name].to_s}"
|
26
|
-
|
27
|
-
board = create_or_gen_board(@config[:board_name].to_s)
|
28
|
-
|
29
|
-
return -1 if board.nil?
|
30
|
-
|
31
|
-
puts "Created or found a board with the ID: #{board.name}"
|
32
|
-
|
33
|
-
|
34
|
-
create_cards(board)
|
35
|
-
puts "And you're ready to go!"
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
def create_or_gen_board(board_name)
|
40
|
-
board = @trello.find_board(board_name)
|
41
|
-
board ||= @trello.create_board(board_name, 'Auto Generated by ToTrello Gem')
|
21
|
+
def create_or_gen_board
|
22
|
+
board = @trello.find_board(@config[:board_name].to_s)
|
23
|
+
board ||= @trello.create_board(@config[:board_name].to_s, 'Auto Generated by ToTrello Gem')
|
42
24
|
end
|
43
25
|
|
44
26
|
def create_trello_card(board, list, todo, filename)
|
@@ -48,52 +30,32 @@ module Totrello
|
|
48
30
|
|
49
31
|
def gen_description(file, todo, project_name)
|
50
32
|
out = "TODO item found by the [ToTrello](https://rubygems.org/gems/totrello) gem\n"
|
51
|
-
out += "===========================\n"
|
52
33
|
out += "**Project name:** #{project_name}\n"
|
53
34
|
out += "**Filename**: #{file}\n"
|
54
35
|
out += "**Action item**: #{todo[:todo]}\n"
|
55
36
|
out += "**Location (at or near) line**: #{todo[:location]}\n"
|
56
37
|
end
|
57
38
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
todos = get_todos
|
64
|
-
|
65
|
-
puts 'Talking to Trello, this is the longest part...'
|
66
|
-
|
67
|
-
todos[:todo_list].each do |tdl|
|
68
|
-
tdl[:todos].each do |td|
|
69
|
-
unless td == ''
|
70
|
-
processes.append(fork {create_trello_card(board, @config[:default_list], td, tdl[:file])})
|
71
|
-
#create_trello_card(board, @config[:default_list], td, tdl[:file])
|
72
|
-
|
73
|
-
end
|
39
|
+
def create_cards(board, todos)
|
40
|
+
todos[:todo_list].each do |tdl|
|
41
|
+
tdl[:todos].each do |td|
|
42
|
+
unless td == ''
|
43
|
+
create_trello_card(board, @config[:default_list], td, tdl[:file])
|
74
44
|
end
|
75
45
|
end
|
76
|
-
|
77
|
-
process_manager(processes)
|
78
46
|
end
|
47
|
+
end
|
79
48
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
Array( @config[:excludes]),
|
89
|
-
Array( @config[:todo_types]),
|
90
|
-
Array( @config[:file_types]),
|
91
|
-
Array( @config[:comment_style]))
|
92
|
-
puts "Woot! We've got'em"
|
93
|
-
todos
|
94
|
-
end
|
95
|
-
|
96
|
-
|
49
|
+
def get_todos
|
50
|
+
todo = ToDoFind.new
|
51
|
+
todos = todo.search(@directory,
|
52
|
+
Array( @config[:excludes]),
|
53
|
+
Array( @config[:todo_types]),
|
54
|
+
Array( @config[:file_types]),
|
55
|
+
Array( @config[:comment_style]))
|
56
|
+
todos
|
97
57
|
end
|
98
58
|
|
59
|
+
end
|
60
|
+
|
99
61
|
end
|
data/lib/totrello/version.rb
CHANGED
data/lib/totrello_config.rb
CHANGED
@@ -33,7 +33,6 @@ class TotrelloConfig
|
|
33
33
|
trello_yml = Dir.glob(totrello_config_file)[0]
|
34
34
|
|
35
35
|
unless trello_yml.nil?
|
36
|
-
puts "Found yml file file: #{trello_yml}"
|
37
36
|
config = YAML.load_file(trello_yml )
|
38
37
|
config['totrello'].each { |key, value| instance_variable_set("@#{key}", value) }
|
39
38
|
end
|
data/test/totrello_spec.rb
CHANGED
@@ -20,7 +20,7 @@ describe 'Totrello' do
|
|
20
20
|
directory = "#{Dir.pwd}/test/test_data"
|
21
21
|
|
22
22
|
t = Totrello::Trelloize.new(directory)
|
23
|
-
board = t.create_or_gen_board
|
23
|
+
board = t.create_or_gen_board
|
24
24
|
|
25
25
|
expect(board.name.downcase).to eq(directory.split('/').last.downcase)
|
26
26
|
|
@@ -35,7 +35,7 @@ describe 'Totrello' do
|
|
35
35
|
directory = "#{Dir.pwd}/test/test_data"
|
36
36
|
|
37
37
|
t = Totrello::Trelloize.new(directory)
|
38
|
-
board = t.create_or_gen_board
|
38
|
+
board = t.create_or_gen_board
|
39
39
|
|
40
40
|
card_name = Digest::SHA1.hexdigest Time.now.to_s
|
41
41
|
|
@@ -47,5 +47,21 @@ describe 'Totrello' do
|
|
47
47
|
|
48
48
|
end
|
49
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
|
+
|
50
66
|
end
|
51
67
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: totrello
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.04
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Teeter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.4.
|
131
|
+
rubygems_version: 2.4.5
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: Turns todo items into trello cards.
|