todos_export 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f36981156d36cad19a3d55766de5c8267418ca6
4
- data.tar.gz: 36bcaf1faff87dc59f5716abfe9e8fa52b1562d7
3
+ metadata.gz: c6e43464ddd7a06ed854ad261d4629aae23e494e
4
+ data.tar.gz: e5721d8587619ab581c7d03ec9e65892a6ba8333
5
5
  SHA512:
6
- metadata.gz: 0c635d5445c0129d1ed9492af3f890d2649017fb1e9594133f08fd61a0c3cc7007dfefd6b4586f63a1cffe3e617dd2d7c8aa12843cd199e0dfdf7733586a1ff2
7
- data.tar.gz: e245140008257934ad4b5ce6fd7d0665277d2517ef33dba9173f5c415d96b4d5b85dcba5c50489ffb1c91bf075a18b19560d39a7d5e2f7a4eb9d0871060556da
6
+ metadata.gz: 080b421499ebbe742f754b2472d03dc28bc9512be5df8e169e946352a4a91c4996134bcd7de52a8acd95534cb18f35e617bed6e23c489d95300d4a1867360b74
7
+ data.tar.gz: f9c45454750915624c808355a196c64310ff5f30431cc5c2c04bd15416d693fac12f21407d038afd01ac257ad02def30249caae80ee0a7b847bd04e3ad7b35d3
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
@@ -0,0 +1,72 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ todos_export (0.3.1)
5
+ highline
6
+ json
7
+ octokit
8
+ rugged
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ addressable (2.3.6)
14
+ awesome_print (1.2.0)
15
+ coveralls (0.7.0)
16
+ multi_json (~> 1.3)
17
+ rest-client
18
+ simplecov (>= 0.7)
19
+ term-ansicolor
20
+ thor
21
+ diff-lcs (1.2.5)
22
+ docile (1.1.5)
23
+ faraday (0.9.0)
24
+ multipart-post (>= 1.2, < 3)
25
+ highline (1.6.21)
26
+ json (1.8.1)
27
+ mime-types (2.3)
28
+ multi_json (1.10.1)
29
+ multipart-post (2.0.0)
30
+ netrc (0.7.7)
31
+ octokit (3.2.0)
32
+ sawyer (~> 0.5.3)
33
+ rake (10.3.2)
34
+ rest-client (1.7.2)
35
+ mime-types (>= 1.16, < 3.0)
36
+ netrc (~> 0.7)
37
+ rspec (3.0.0)
38
+ rspec-core (~> 3.0.0)
39
+ rspec-expectations (~> 3.0.0)
40
+ rspec-mocks (~> 3.0.0)
41
+ rspec-core (3.0.3)
42
+ rspec-support (~> 3.0.0)
43
+ rspec-expectations (3.0.3)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.0.0)
46
+ rspec-mocks (3.0.3)
47
+ rspec-support (~> 3.0.0)
48
+ rspec-support (3.0.3)
49
+ rugged (0.21.0)
50
+ sawyer (0.5.4)
51
+ addressable (~> 2.3.5)
52
+ faraday (~> 0.8, < 0.10)
53
+ simplecov (0.9.0)
54
+ docile (~> 1.1.0)
55
+ multi_json
56
+ simplecov-html (~> 0.8.0)
57
+ simplecov-html (0.8.0)
58
+ term-ansicolor (1.3.0)
59
+ tins (~> 1.0)
60
+ thor (0.19.1)
61
+ tins (1.3.0)
62
+
63
+ PLATFORMS
64
+ ruby
65
+
66
+ DEPENDENCIES
67
+ awesome_print
68
+ bundler (~> 1.3)
69
+ coveralls
70
+ rake
71
+ rspec
72
+ todos_export!
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require "todos_export/version"
2
4
  require 'todos_export/github_issues'
3
5
  require 'todos_export/std_out'
@@ -38,13 +40,16 @@ module TodosExport
38
40
  f.each_with_index do |line, number|
39
41
  search = line.scan(/((?:#)(?:| )(TODO|FIXME|BUG):?(.*)$)/i)
40
42
  if !search.empty?
43
+ line = number + 1
44
+
41
45
  self.exportables << {
42
46
  :type => search[0][1].upcase,
43
47
  :content => search[0][2].strip,
44
48
  :original_content => search[0][0],
45
49
  :file => file.gsub(/^(.\/)/, ''),
46
50
  :original_file => file,
47
- :line => number + 1
51
+ :line => line,
52
+ :line_peek => File.readlines(file)[line].strip
48
53
  }
49
54
  end
50
55
  end
@@ -63,7 +68,7 @@ module TodosExport
63
68
 
64
69
  def git_head_sha
65
70
  if git_directory?
66
- Rugged::Repository.new(self.target).head.target
71
+ Rugged::Repository.new(self.target).head.target.oid
67
72
  else
68
73
  nil
69
74
  end
@@ -11,17 +11,35 @@ module TodosExport
11
11
  end
12
12
 
13
13
  def output
14
- out = "Todos\n====="
15
- self.main.exportable_todos.each do |ex|
16
- out += "\n- #{ex[:content]}"
14
+ out = ''
15
+ todos = self.main.exportable_todos
16
+
17
+ if todos.size > 0
18
+ out = "Todos\n====="
19
+ todos.each do |ex|
20
+ out += "\n- #{ex[:content]}"
21
+ out += "\n <%= color(\"#{ex[:original_file]}:#{ex[:line]}\", :green) %>"
22
+ end
17
23
  end
18
- out += "\n\nFixmes\n======"
19
- self.main.exportable_fixmes.each do |ex|
20
- out += "\n- #{ex[:content]}"
24
+
25
+ fixmes = self.main.exportable_fixmes
26
+
27
+ if fixmes.size > 0
28
+ out += "\n\nFixmes\n======"
29
+ fixmes.each do |ex|
30
+ out += "\n- #{ex[:content]}"
31
+ out += "\n <%= color(\"#{ex[:original_file]}:#{ex[:line]}\", :green) %>"
32
+ end
21
33
  end
22
- out += "\n\nBugs\n===="
23
- self.main.exportable_bugs.each do |ex|
24
- out += "\n- #{ex[:content]}"
34
+
35
+ bugs = self.main.exportable_bugs
36
+
37
+ if bugs.size > 0
38
+ out += "\n\nBugs\n===="
39
+ bugs.each do |ex|
40
+ out += "\n- #{ex[:content]}"
41
+ out += "\n <%= color(\"#{ex[:original_file]}:#{ex[:line]}\", :green) %>"
42
+ end
25
43
  end
26
44
 
27
45
  return out
@@ -1,3 +1,3 @@
1
1
  module TodosExport
2
- VERSION = "0.3.1"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
  require 'todos_export/github_issues'
3
5
 
@@ -1,30 +1,58 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
  require 'todos_export/std_out'
3
5
 
4
6
  describe TodosExport::StdOut do
5
- it '#output' do
6
- main = TodosExport::Main.new('spec/resources')
7
- main.find_exportables
7
+ context '#output' do
8
+ it 'normal' do
9
+ input = StringIO.new
10
+ output = StringIO.new
11
+ terminal = HighLine.new(input, output)
12
+
13
+ main = TodosExport::Main.new('spec/resources')
14
+ main.find_exportables
8
15
 
9
- s = TodosExport::StdOut.new(main)
10
- s.output.should ==
16
+ s = TodosExport::StdOut.new(main)
17
+ terminal.say(s.output)
18
+ output.string.gsub("\e[32m", '').gsub("\e[0m", '').should ==
11
19
  "Todos
12
20
  =====
13
21
  - Find a kinder message
22
+ spec/resources/ruby_file_with_todos.rb:12
14
23
  - Make a list
24
+ spec/resources/ruby_file_with_todos.rb:18
15
25
  - Add more cheese types
26
+ spec/resources/ruby_file_with_todos.rb:26
16
27
  - Add more region cheeses
28
+ spec/resources/ruby_file_with_todos.rb:35
17
29
  - Personalize the class to your taste
30
+ spec/resources/ruby_file_with_todos.rb:41
18
31
  - Be a better Ruby file
32
+ spec/resources/sub_directory/another_ruby_file_with_todos.rb:1
19
33
 
20
34
  Fixmes
21
35
  ======
22
36
  - This is a useless class, what we really need to do is sit down and eat some cheese
37
+ spec/resources/ruby_file_with_todos.rb:2
23
38
  - Use case statement
39
+ spec/resources/ruby_file_with_todos.rb:22
24
40
 
25
41
  Bugs
26
42
  ====
27
43
  - This should be false
28
- - This should say it's a Ruby file"
44
+ spec/resources/ruby_file_with_todos.rb:46
45
+ - This should say it's a Ruby file
46
+ spec/resources/sub_directory/another_ruby_file_with_todos.rb:2
47
+ "
48
+ end
49
+
50
+ it 'none' do
51
+ main = TodosExport::Main.new('spec/spec_helper.rb')
52
+ main.find_exportables
53
+
54
+ s = TodosExport::StdOut.new(main)
55
+ s.output.should == ''
56
+ end
29
57
  end
30
58
  end
@@ -36,8 +36,8 @@ describe TodosExport::Main do
36
36
  end
37
37
 
38
38
  it '#git_directory?' do
39
- TodosExport::Main.new('./').git_directory?.should be_true
40
- TodosExport::Main.new(Dir.tmpdir).git_directory?.should be_false
39
+ TodosExport::Main.new('./').git_directory?.should be true
40
+ TodosExport::Main.new(Dir.tmpdir).git_directory?.should be false
41
41
  end
42
42
 
43
43
  it '#git_head_sha' do
@@ -82,89 +82,7 @@ describe TodosExport::Main do
82
82
 
83
83
  it '#exportables' do
84
84
  subject.find_exportables
85
- exportables = [
86
- {
87
- :type => "FIXME",
88
- :content => "This is a useless class, what we really need to do is sit down and eat some cheese",
89
- :original_content => "# fixme: This is a useless class, what we really need to do is sit down and eat some cheese",
90
- :file => 'spec/resources/ruby_file_with_todos.rb',
91
- :original_file => "spec/resources/ruby_file_with_todos.rb",
92
- :line => 2
93
- },
94
- {
95
- :type => "TODO",
96
- :content => "Find a kinder message",
97
- :original_content => "#TODO: Find a kinder message",
98
- :file => 'spec/resources/ruby_file_with_todos.rb',
99
- :original_file => "spec/resources/ruby_file_with_todos.rb",
100
- :line => 12
101
- },
102
- {
103
- :type => "TODO",
104
- :content => "Make a list",
105
- :original_content => "# TODO: Make a list",
106
- :file => 'spec/resources/ruby_file_with_todos.rb',
107
- :original_file => "spec/resources/ruby_file_with_todos.rb",
108
- :line => 18
109
- },
110
- {
111
- :type => "FIXME",
112
- :content => "Use case statement",
113
- :original_content => "#FIXME: Use case statement",
114
- :file => 'spec/resources/ruby_file_with_todos.rb',
115
- :original_file => "spec/resources/ruby_file_with_todos.rb",
116
- :line => 22
117
- },
118
- {
119
- :type => "TODO",
120
- :content => "Add more cheese types",
121
- :original_content => "#todo: Add more cheese types",
122
- :file => 'spec/resources/ruby_file_with_todos.rb',
123
- :original_file => "spec/resources/ruby_file_with_todos.rb",
124
- :line => 26
125
- },
126
- {
127
- :type => "TODO",
128
- :content => "Add more region cheeses",
129
- :original_content => "#todo Add more region cheeses",
130
- :file => 'spec/resources/ruby_file_with_todos.rb',
131
- :original_file => "spec/resources/ruby_file_with_todos.rb",
132
- :line => 35
133
- },
134
- {
135
- :type => "TODO",
136
- :content => "Personalize the class to your taste",
137
- :original_content => "# TODO Personalize the class to your taste",
138
- :file => 'spec/resources/ruby_file_with_todos.rb',
139
- :original_file => "spec/resources/ruby_file_with_todos.rb",
140
- :line => 41
141
- },
142
- {
143
- :type => "BUG",
144
- :content => "This should be false",
145
- :original_content => "# BUG: This should be false",
146
- :file => 'spec/resources/ruby_file_with_todos.rb',
147
- :original_file => "spec/resources/ruby_file_with_todos.rb",
148
- :line => 46
149
- },
150
- {
151
- :type => "TODO",
152
- :content => "Be a better Ruby file",
153
- :original_content => "# TODO: Be a better Ruby file",
154
- :file => 'spec/resources/sub_directory/another_ruby_file_with_todos.rb',
155
- :original_file => "spec/resources/sub_directory/another_ruby_file_with_todos.rb",
156
- :line => 1
157
- },
158
- {
159
- :type => "BUG",
160
- :content => "This should say it's a Ruby file",
161
- :original_content => "# BUG: This should say it's a Ruby file",
162
- :file => 'spec/resources/sub_directory/another_ruby_file_with_todos.rb',
163
- :original_file => "spec/resources/sub_directory/another_ruby_file_with_todos.rb",
164
- :line => 2
165
- }
166
- ]
167
- exportables.each do |e|
85
+ subject.exportable_todos + subject.exportable_fixmes + subject.exportable_bugs.each do |e|
168
86
  subject.exportables.should include e
169
87
  end
170
88
  end
@@ -178,7 +96,8 @@ describe TodosExport::Main do
178
96
  :original_content => "#TODO: Find a kinder message",
179
97
  :file => 'spec/resources/ruby_file_with_todos.rb',
180
98
  :original_file => "spec/resources/ruby_file_with_todos.rb",
181
- :line => 12
99
+ :line => 12,
100
+ :line_peek => 'puts "Pick a tasty cheese dammit"'
182
101
  },
183
102
  {
184
103
  :type => "TODO",
@@ -186,7 +105,8 @@ describe TodosExport::Main do
186
105
  :original_content => "# TODO: Make a list",
187
106
  :file => 'spec/resources/ruby_file_with_todos.rb',
188
107
  :original_file => "spec/resources/ruby_file_with_todos.rb",
189
- :line => 18
108
+ :line => 18,
109
+ :line_peek => 'end' # This can be better
190
110
  },
191
111
  {
192
112
  :type => "TODO",
@@ -194,7 +114,8 @@ describe TodosExport::Main do
194
114
  :original_content => "#todo: Add more cheese types",
195
115
  :file => 'spec/resources/ruby_file_with_todos.rb',
196
116
  :original_file => "spec/resources/ruby_file_with_todos.rb",
197
- :line => 26
117
+ :line => 26,
118
+ :line_peek => 'return true'
198
119
  },
199
120
  {
200
121
  :type => "TODO",
@@ -202,7 +123,8 @@ describe TodosExport::Main do
202
123
  :original_content => "#todo Add more region cheeses",
203
124
  :file => 'spec/resources/ruby_file_with_todos.rb',
204
125
  :original_file => "spec/resources/ruby_file_with_todos.rb",
205
- :line => 35
126
+ :line => 35,
127
+ :line_peek => 'return false'
206
128
  },
207
129
  {
208
130
  :type => "TODO",
@@ -210,7 +132,8 @@ describe TodosExport::Main do
210
132
  :original_content => "# TODO Personalize the class to your taste",
211
133
  :file => 'spec/resources/ruby_file_with_todos.rb',
212
134
  :original_file => "spec/resources/ruby_file_with_todos.rb",
213
- :line => 41
135
+ :line => 41,
136
+ :line_peek => 'return true'
214
137
  },
215
138
  {
216
139
  :type => "TODO",
@@ -218,7 +141,8 @@ describe TodosExport::Main do
218
141
  :original_content => "# TODO: Be a better Ruby file",
219
142
  :file => 'spec/resources/sub_directory/another_ruby_file_with_todos.rb',
220
143
  :original_file => "spec/resources/sub_directory/another_ruby_file_with_todos.rb",
221
- :line => 1
144
+ :line => 1,
145
+ :line_peek => '# BUG: This should say it\'s a Ruby file' # this can be better
222
146
  }
223
147
  ]
224
148
 
@@ -236,7 +160,8 @@ describe TodosExport::Main do
236
160
  :original_content => "# fixme: This is a useless class, what we really need to do is sit down and eat some cheese",
237
161
  :file => 'spec/resources/ruby_file_with_todos.rb',
238
162
  :original_file => 'spec/resources/ruby_file_with_todos.rb',
239
- :line => 2
163
+ :line => 2,
164
+ :line_peek => '# This is a class for cheeses'
240
165
  },
241
166
  {
242
167
  :type => "FIXME",
@@ -244,7 +169,8 @@ describe TodosExport::Main do
244
169
  :original_content => "#FIXME: Use case statement",
245
170
  :file => 'spec/resources/ruby_file_with_todos.rb',
246
171
  :original_file => 'spec/resources/ruby_file_with_todos.rb',
247
- :line => 22
172
+ :line => 22,
173
+ :line_peek => "if self.cheese == 'chedar'"
248
174
  }
249
175
  ]
250
176
 
@@ -262,7 +188,8 @@ describe TodosExport::Main do
262
188
  :original_content => "# BUG: This should be false",
263
189
  :file => 'spec/resources/ruby_file_with_todos.rb',
264
190
  :original_file => 'spec/resources/ruby_file_with_todos.rb',
265
- :line => 46
191
+ :line => 46,
192
+ :line_peek => 'return true'
266
193
  },
267
194
  {
268
195
  :type => "BUG",
@@ -270,7 +197,8 @@ describe TodosExport::Main do
270
197
  :original_content => "# BUG: This should say it's a Ruby file",
271
198
  :file => 'spec/resources/sub_directory/another_ruby_file_with_todos.rb',
272
199
  :original_file => 'spec/resources/sub_directory/another_ruby_file_with_todos.rb',
273
- :line => 2
200
+ :line => 2,
201
+ :line_peek => 'puts "I\'m a Perl file"'
274
202
  }
275
203
  ]
276
204
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: todos_export
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Caught
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-21 00:00:00.000000000 Z
11
+ date: 2014-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,6 +147,7 @@ files:
147
147
  - .gitignore
148
148
  - .rspec
149
149
  - Gemfile
150
+ - Gemfile.lock
150
151
  - LICENSE.txt
151
152
  - README.md
152
153
  - Rakefile