what_now 0.0.2 → 0.0.3

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: 7bda060f1e69ee13c7863be908c04c2989b9953f
4
- data.tar.gz: 684fab111d73886ed178aaf1a0f28d84d9854250
3
+ metadata.gz: 7a13ab4077826fea72978ebdc4df7590224becb4
4
+ data.tar.gz: 4cbc448fe9fed549a45158f1e958490783b42827
5
5
  SHA512:
6
- metadata.gz: f969b650b7a3b9fe07e207d731cefc7182122b67a165b09e4385bf7e56701588d92455aec1fb4009f958cbc38d699fb81c90a29566d3527011ab223b81b6152f
7
- data.tar.gz: 18818e1895703b3274cc474751149245bc557d00ffed62626360342320fecac3f78da537aaf3c1a336221c6de75aa349c11cc02d8ab68ffdd8e3669e71cbb300
6
+ metadata.gz: 7f845892a4cae2342b01ff3e31b8ae8efba71b57551b396c8c88bb2aea35a7529a3db13eebc17436210f471f10f9956d0701a2db902a5a15905e80dae81f1be2
7
+ data.tar.gz: c5dccc5be39cade9d1f0ae61af352ed70a8da55fea24d29c030c39d60100d5afcda1f5ba5448a1ea7e6e70b0c31c273acef6c89f0b8f11fe3611840e8ddc34d1
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Edgar Cabrera
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ what_now
2
+ ========
3
+
4
+ Executable (packed as a ruby gem) for finding TODO comments inside code
5
+ Requires Ruby 1.9.* and above
6
+
7
+
8
+ Installation
9
+ ---------
10
+ If you use rbenv or RVM:
11
+ ```
12
+ gem install what_now
13
+ ```
14
+ Otherwise you might need
15
+ ```
16
+ sudo gem install what_now
17
+ ```
18
+
19
+
20
+ Usage
21
+ -----
22
+ ```
23
+ $ wnow
24
+ ```
25
+ Will return all the todos in the following format inside files:
26
+
27
+ * TODO this is the text
28
+
29
+ Where 'this is the text' will be returned, together with the path and line number
30
+
31
+ You can also use the options *--dir, -d*, in order to specify the directory in which
32
+ todos are going to be looked for, and *--ext -e* for checking only certain file extension
33
+ (without prepending the '.', this means, call *--ext rb* instead of *--ext .rb*).
data/lib/what_now.rb CHANGED
@@ -7,7 +7,7 @@ Todo = Struct.new :text, :path, :line
7
7
  module WhatNow
8
8
  class << self
9
9
  def search_line(line, line_number, path)
10
- text = /TODO[:\s]*\s(.+)$/.match(line)
10
+ text = /TODO:?\s*(.+)$/i.match(line)
11
11
  Todo.new(text[1], line_number, path) if text
12
12
  end
13
13
 
@@ -0,0 +1,5 @@
1
+ This is a normal line
2
+ TODO this is a todo
3
+ this is another line
4
+ and this is another
5
+ TODO: but this is also a todo
@@ -0,0 +1,10 @@
1
+ require 'bundler/setup'
2
+ require 'minitest/autorun'
3
+ require 'minitest/spec'
4
+ require 'minitest/reporters'
5
+
6
+ Minitest::Reporters.use!
7
+
8
+ Dir[File.dirname(__FILE__) + '/../lib/**/*.rb'].each do |rb_file|
9
+ require rb_file
10
+ end
@@ -0,0 +1,57 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe Todo do
4
+ describe 'public interface' do
5
+ subject { Todo.new('do stuff', './stuff', 10) }
6
+ it { subject.must_respond_to :text }
7
+ it { subject.must_respond_to :path }
8
+ it { subject.must_respond_to :line }
9
+ end
10
+ end
11
+
12
+ describe WhatNow do
13
+ describe '#search_line' do
14
+ subject do
15
+ WhatNow.search_line('TODO this is a todo', 1, '.')
16
+ end
17
+
18
+ it 'correctly extracts text from todo' do
19
+ subject.text.must_match 'this is a todo'
20
+ end
21
+
22
+ it 'returns nil with a non todo line' do
23
+ WhatNow.search_line('this is not a todo', 1, '.')
24
+ .must_be_nil
25
+ end
26
+ end
27
+
28
+ describe '#search_file' do
29
+ subject do
30
+ path = File.dirname(__FILE__) + '/example_file.txt'
31
+ WhatNow.search_file(path)
32
+ end
33
+
34
+ it 'found 2 todos' do
35
+ subject.length.must_equal 2
36
+ end
37
+
38
+ it 'found the correct todos' do
39
+ subject[0].text.must_match 'this is a todo'
40
+ subject[0].line.must_equal 2
41
+ subject[1].text.must_match 'but this is also a todo'
42
+ subject[1].line.must_equal 5
43
+ end
44
+ end
45
+
46
+ describe '#search_directory' do
47
+ it 'considers only specified pattern' do
48
+ results = WhatNow.search_directory(File.dirname(__FILE__)+'/**/*.txt')
49
+ results.length.must_equal 2
50
+ end
51
+
52
+ it 'returns empty array if nothing was found' do
53
+ results = WhatNow.search_directory(File.dirname(__FILE__)+'/**/*.mooo')
54
+ results.must_equal []
55
+ end
56
+ end
57
+ end
data/what_now.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'what_now'
3
+ s.version = '0.0.3'
4
+ s.date = '2014-02-27'
5
+ s.summary = 'Find todo comments in your code'
6
+ s.description = 'Executable for finding todo comments on directories'
7
+ s.authors = ['Edgar Cabrera']
8
+ s.email = 'edgar@cafeinacode.com'
9
+ s.license = 'MIT'
10
+ s.homepage = 'https://github.com/aleandros/what_now'
11
+ s.files = %w(what_now.gemspec LICENSE README.md)
12
+ s.files += Dir['lib/*.rb'] + Dir['bin/*']
13
+ s.test_files = Dir['spec/*']
14
+ s.executables << 'wnow'
15
+
16
+ s.add_dependency 'thor'
17
+ s.add_dependency 'colorize'
18
+ s.add_dependency 'ptools'
19
+
20
+ s.add_development_dependency 'minitest-reporters'
21
+ s.add_development_dependency 'rake'
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: what_now
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgar Cabrera
@@ -9,7 +9,77 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-02-27 00:00:00.000000000 Z
12
- dependencies: []
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: colorize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ptools
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest-reporters
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
13
83
  description: Executable for finding todo comments on directories
14
84
  email: edgar@cafeinacode.com
15
85
  executables:
@@ -17,8 +87,14 @@ executables:
17
87
  extensions: []
18
88
  extra_rdoc_files: []
19
89
  files:
20
- - lib/what_now.rb
90
+ - LICENSE
91
+ - README.md
21
92
  - bin/wnow
93
+ - lib/what_now.rb
94
+ - spec/example_file.txt
95
+ - spec/spec_helper.rb
96
+ - spec/what_now_spec.rb
97
+ - what_now.gemspec
22
98
  homepage: https://github.com/aleandros/what_now
23
99
  licenses:
24
100
  - MIT
@@ -29,19 +105,21 @@ require_paths:
29
105
  - lib
30
106
  required_ruby_version: !ruby/object:Gem::Requirement
31
107
  requirements:
32
- - - '>='
108
+ - - ">="
33
109
  - !ruby/object:Gem::Version
34
110
  version: '0'
35
111
  required_rubygems_version: !ruby/object:Gem::Requirement
36
112
  requirements:
37
- - - '>='
113
+ - - ">="
38
114
  - !ruby/object:Gem::Version
39
115
  version: '0'
40
116
  requirements: []
41
117
  rubyforge_project:
42
- rubygems_version: 2.0.6
118
+ rubygems_version: 2.2.2
43
119
  signing_key:
44
120
  specification_version: 4
45
121
  summary: Find todo comments in your code
46
- test_files: []
47
- has_rdoc:
122
+ test_files:
123
+ - spec/spec_helper.rb
124
+ - spec/what_now_spec.rb
125
+ - spec/example_file.txt