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
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'totrello/trello_config'
|
3
|
+
|
4
|
+
describe TrelloConfig do
|
5
|
+
before(:all) do
|
6
|
+
@attrs =
|
7
|
+
%w(project_name board_name default_list
|
8
|
+
excludes todo_types file_types comment_style)
|
9
|
+
end
|
10
|
+
|
11
|
+
describe 'instance vars' do
|
12
|
+
before(:each) do
|
13
|
+
@config = TrelloConfig.new
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'defines attrs' do
|
17
|
+
@attrs.each do |att|
|
18
|
+
expect(@config).to respond_to(att.to_sym)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'initialize' do
|
24
|
+
it 'responds to new' do
|
25
|
+
expect(TrelloConfig).to respond_to(:new)
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'responds to new with an argument' do
|
29
|
+
expect(TrelloConfig).to respond_to(:new).with(1).argument
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'builds a hash of settings' do
|
33
|
+
asserted_config = TrelloConfig.new("#{Dir.pwd}/spec/fixtures")
|
34
|
+
expected_config = {
|
35
|
+
project_name: 'ToTrello',
|
36
|
+
board_name: 'ToTrello',
|
37
|
+
default_list: 'To Do',
|
38
|
+
todo_types: ['TODO', '#TODO', '#TODO:', 'TODO:',
|
39
|
+
'FIXME', '#FIXME', '#FIXME:', 'FIXME:'],
|
40
|
+
comment_style: ['#', '//'],
|
41
|
+
file_types: ['.rb', '.yml'],
|
42
|
+
excludes: ['pkg/', 'bin/']
|
43
|
+
}
|
44
|
+
|
45
|
+
@attrs.each do |at|
|
46
|
+
expect(asserted_config.send(at.to_sym)).to eq(
|
47
|
+
expected_config[at.to_sym]
|
48
|
+
)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'load_defaults' do
|
54
|
+
before(:each) do
|
55
|
+
@config = TrelloConfig.new
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'has a default config' do
|
59
|
+
expect(@config).to respond_to(:default_config)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'has a default config that accepts a directory' do
|
63
|
+
expect(@config).to respond_to(:default_config).with(1).argument
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'loads the default config into the attr_accessors' do
|
67
|
+
@config.default_config
|
68
|
+
@attrs.each do |at|
|
69
|
+
expect(@config.send(at.to_sym)).not_to be_nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'load_config' do
|
75
|
+
before(:each) do
|
76
|
+
@config = TrelloConfig.new
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'has a config loader' do
|
80
|
+
expect(@config).to respond_to(:load_config)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'has a config loader that accepts a file' do
|
84
|
+
expect(@config).to respond_to(:load_config).with(1).argument
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'retuns nil if no file is specified' do
|
88
|
+
expect(@config.load_config('')).to be_nil
|
89
|
+
end
|
90
|
+
|
91
|
+
it 'does not return nil if a file is specified' do
|
92
|
+
expect(
|
93
|
+
@config.load_config("#{Dir.pwd}/spec/fixtures/.totrello.yml")
|
94
|
+
).not_to be_nil
|
95
|
+
end
|
96
|
+
|
97
|
+
it 'loads the config into the attr_accessors' do
|
98
|
+
@config.load_config("#{Dir.pwd}/spec/fixtures/.totrello.yml")
|
99
|
+
|
100
|
+
@attrs.each do |at|
|
101
|
+
expect(@config.send(at.to_sym)).not_to be_nil
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'totrello/trelloize'
|
3
|
+
require 'totrello/trello_config'
|
4
|
+
require 'totrello/todos'
|
5
|
+
require 'digest/sha1'
|
6
|
+
|
7
|
+
describe Trelloize do
|
8
|
+
before(:all) do
|
9
|
+
@test_dir = "#{Dir.pwd}/spec/fixtures"
|
10
|
+
@test_file = 'fixture.rb'
|
11
|
+
@config = TrelloConfig.new
|
12
|
+
@todos = Todos.new
|
13
|
+
@todo = @todos.todos_for_file("#{@test_dir}/#{@test_file}", @config)[0]
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'description' do
|
17
|
+
before(:each) do
|
18
|
+
@trelloize = Trelloize.new
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'responds to description' do
|
22
|
+
expect(@trelloize).to respond_to(:description)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'accepts a todo and a config' do
|
26
|
+
expect(@trelloize).to respond_to(:description).with(2).arguments
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'returns a string' do
|
30
|
+
expect(@trelloize.description(@todo, @config)).to be_a(String)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'find_and_create_cards_from_todos' do
|
35
|
+
before(:each) do
|
36
|
+
@trelloize = Trelloize.new
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'responds to find_and_create_cards_from_todos' do
|
40
|
+
expect(@trelloize).to respond_to(:find_and_create_cards_from_todos)
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'find_and_create_cards_from_todos accepts two arguments' do
|
44
|
+
expect(@trelloize).to respond_to(
|
45
|
+
:find_and_create_cards_from_todos
|
46
|
+
).with(2).arguments
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/totrello.gemspec
CHANGED
@@ -21,7 +21,17 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.6"
|
22
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
23
|
spec.add_development_dependency 'rspec', '~> 3'
|
24
|
+
spec.add_development_dependency "rspec-expectations", "~> 3"
|
25
|
+
spec.add_development_dependency "rspec-nc", "~> 0.2"
|
26
|
+
spec.add_development_dependency "guard", "~> 2.12"
|
27
|
+
spec.add_development_dependency "guard-rspec", "~> 4.5"
|
28
|
+
spec.add_development_dependency "pry", "~> 0.10"
|
29
|
+
spec.add_development_dependency "pry-remote", "~> 0.1"
|
30
|
+
spec.add_development_dependency "pry-nav", "~> 0.2"
|
24
31
|
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.4'
|
32
|
+
spec.add_development_dependency 'dotenv', '~> 2.1.1'
|
33
|
+
spec.add_development_dependency 'webmock', '~> 1.24'
|
34
|
+
spec.add_development_dependency 'vcr', '~> 3.0'
|
25
35
|
|
26
36
|
spec.add_dependency 'ruby-trello', '~> 1.1'
|
27
37
|
|
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.
|
4
|
+
version: 1.0.0
|
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: 2016-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,104 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-expectations
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-nc
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.2'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.12'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.12'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.5'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.5'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.10'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.10'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pry-remote
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.1'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.1'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: pry-nav
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.2'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.2'
|
55
153
|
- !ruby/object:Gem::Dependency
|
56
154
|
name: codeclimate-test-reporter
|
57
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +164,48 @@ dependencies:
|
|
66
164
|
- - ~>
|
67
165
|
- !ruby/object:Gem::Version
|
68
166
|
version: '0.4'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: dotenv
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ~>
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 2.1.1
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ~>
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 2.1.1
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: webmock
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ~>
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '1.24'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ~>
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '1.24'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: vcr
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ~>
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '3.0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ~>
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '3.0'
|
69
209
|
- !ruby/object:Gem::Dependency
|
70
210
|
name: ruby-trello
|
71
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -89,24 +229,29 @@ extensions: []
|
|
89
229
|
extra_rdoc_files: []
|
90
230
|
files:
|
91
231
|
- .gitignore
|
232
|
+
- .hound.yml
|
92
233
|
- .totrello.yml
|
93
234
|
- .travis.yml
|
94
235
|
- Gemfile
|
236
|
+
- Guardfile
|
95
237
|
- LICENSE.txt
|
96
238
|
- README.md
|
97
239
|
- Rakefile
|
98
240
|
- bin/ToTrello
|
99
|
-
- lib/to_do_find.rb
|
100
241
|
- lib/totrello.rb
|
242
|
+
- lib/totrello/todos.rb
|
243
|
+
- lib/totrello/trello_builder.rb
|
244
|
+
- lib/totrello/trello_config.rb
|
245
|
+
- lib/totrello/trelloize.rb
|
101
246
|
- lib/totrello/version.rb
|
102
|
-
-
|
103
|
-
-
|
104
|
-
-
|
105
|
-
-
|
106
|
-
-
|
107
|
-
-
|
108
|
-
-
|
109
|
-
-
|
247
|
+
- spec/fixtures/.totrello.yml
|
248
|
+
- spec/fixtures/fixture.rb
|
249
|
+
- spec/spec_helper.rb
|
250
|
+
- spec/todos_spec.rb
|
251
|
+
- spec/totrello_spec.rb
|
252
|
+
- spec/trello_builder_spec.rb
|
253
|
+
- spec/trello_config_spec.rb
|
254
|
+
- spec/trelloize_spec.rb
|
110
255
|
- totrello.gemspec
|
111
256
|
homepage: https://github.com/whatisinternet/ToTrello
|
112
257
|
licenses:
|
@@ -128,14 +273,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
273
|
version: '0'
|
129
274
|
requirements: []
|
130
275
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.
|
276
|
+
rubygems_version: 2.5.1
|
132
277
|
signing_key:
|
133
278
|
specification_version: 4
|
134
279
|
summary: Turns todo items into trello cards.
|
135
280
|
test_files:
|
136
|
-
-
|
137
|
-
-
|
138
|
-
-
|
139
|
-
-
|
140
|
-
-
|
141
|
-
-
|
281
|
+
- spec/fixtures/.totrello.yml
|
282
|
+
- spec/fixtures/fixture.rb
|
283
|
+
- spec/spec_helper.rb
|
284
|
+
- spec/todos_spec.rb
|
285
|
+
- spec/totrello_spec.rb
|
286
|
+
- spec/trello_builder_spec.rb
|
287
|
+
- spec/trello_config_spec.rb
|
288
|
+
- spec/trelloize_spec.rb
|
data/lib/to_do_find.rb
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
class ToDoFind
|
4
|
-
|
5
|
-
# This will search a given directory
|
6
|
-
#
|
7
|
-
def search(directory, excludes_dirs, todo_styles, file_types, comment_styles)
|
8
|
-
|
9
|
-
todos= {directory: directory.split('/').last, :todo_list=>[] }
|
10
|
-
|
11
|
-
files_to_search = exclude_folders(get_folders(directory, file_types), Array(excludes_dirs))
|
12
|
-
|
13
|
-
files_to_search.each do |my_code_file|
|
14
|
-
|
15
|
-
found_todo = find_todo(my_code_file, todo_styles, comment_styles)
|
16
|
-
|
17
|
-
if found_todo
|
18
|
-
todos[:todo_list].append(
|
19
|
-
{:file=> my_code_file.gsub(directory,''),
|
20
|
-
:todos => found_todo}
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
todos
|
26
|
-
end
|
27
|
-
|
28
|
-
def get_todos(files_to_search, found_todo)
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
def get_folders(directory, file_types)
|
34
|
-
directory ||= Dir.pwd
|
35
|
-
files = get_internal_folders(directory, file_types)
|
36
|
-
end
|
37
|
-
|
38
|
-
def exclude_folders(file_array, excludes_array)
|
39
|
-
excludes_array.each do |excludes_dir|
|
40
|
-
file_array.reject! { |i| i.include? excludes_dir }
|
41
|
-
end
|
42
|
-
file_array
|
43
|
-
end
|
44
|
-
|
45
|
-
def find_todo(file, todo_styles, comment_styles)
|
46
|
-
@out = []
|
47
|
-
|
48
|
-
todo_styles.each do |tds|
|
49
|
-
@out.concat((get_code(file).find_all { |i| is_todo?(i[:todo], (tds))}))
|
50
|
-
end
|
51
|
-
|
52
|
-
clean_todos(@out, todo_styles, comment_styles).sort_by { |hsh| hsh[:todo] }
|
53
|
-
end
|
54
|
-
|
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
|
-
|
71
|
-
def clean_todos(todo_array, todo_styles, comment_styles)
|
72
|
-
todo_array.each do |found_todos|
|
73
|
-
todo_styles.each do |tds|
|
74
|
-
found_todos[:todo].gsub!(tds,'')
|
75
|
-
end
|
76
|
-
comment_styles.each do |cms|
|
77
|
-
found_todos[:todo].gsub!(cms,'')
|
78
|
-
end
|
79
|
-
found_todos[:todo].gsub!('#','')
|
80
|
-
found_todos[:todo].gsub!(':','')
|
81
|
-
found_todos[:todo].chomp!
|
82
|
-
found_todos[:todo].lstrip!
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
def is_todo?( string, test_string )
|
88
|
-
begin
|
89
|
-
location = string.split(' ').index test_string
|
90
|
-
if location.nil?
|
91
|
-
return false
|
92
|
-
else
|
93
|
-
return true
|
94
|
-
end
|
95
|
-
rescue
|
96
|
-
false
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
100
|
-
|
101
|
-
end
|