code_lister 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +10 -0
- data/CHANGELOGS.md +40 -0
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +16 -47
- data/Rakefile +2 -2
- data/code_lister.gemspec +13 -1
- data/lib/code_lister/cli.rb +2 -2
- data/lib/code_lister/code_lister.rb +26 -24
- data/lib/code_lister/version.rb +1 -1
- data/rubocop-todo.yml +67 -0
- metadata +21 -33
- data/.rspec +0 -3
- data/.ruby-version +0 -1
- data/Guardfile +0 -8
- data/spec/code_lister/code_lister_spec.rb +0 -55
- data/spec/code_lister/main_spec.rb +0 -12
- data/spec/fixtures/demo1.xxx.rb +0 -1
- data/spec/fixtures/demo1.yyy.rb +0 -1
- data/spec/fixtures/demo2.xxx.rb +0 -1
- data/spec/fixtures/demo2.yyy.rb +0 -1
- data/spec/fixtures/java/demo3.xxx.java +0 -1
- data/spec/fixtures/java/demo3.yyy.java +0 -1
- data/spec/fixtures/java/demo4.xxx.java +0 -1
- data/spec/fixtures/java/demo4.yyy.java +0 -1
- data/spec/fixtures/noexts1_zzz +0 -1
- data/spec/fixtures/noexts2_zzz +0 -1
- data/spec/spec_helper.rb +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 936444628fc21d7dd4d8b9e4210282c5cf8af848
|
4
|
+
data.tar.gz: 46675cb934ccf424498be589b995405be7a4b5c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c39417058af18792eb70cfd8084343a6bd7ae31697dad866d7fa7f14226f397f6a1e9dd06c9bd17970d35d421a8ca42c46a7e499858f04137f3e97b35912f8ee
|
7
|
+
data.tar.gz: 65da264d9b5a06848190890df95d9bb2925057e28aac3427d96bbcbef6651c84cbfe318d70047b4ca30bfbe9a8b68b3d0cfc0642631ecb7b2cc6a6cb61216d23
|
data/.rubocop.yml
ADDED
data/CHANGELOGS.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
### Changelogs
|
2
|
+
|
3
|
+
#### 0.0.9
|
4
|
+
|
5
|
+
- Consistencely replace the `base_dir` with `.` in the result:w
|
6
|
+
- Move changelogs section from README.md to CHANGELOGS.md
|
7
|
+
- Minor code refactoring
|
8
|
+
- Fix style with rubocop
|
9
|
+
- Add rubocop gem and simple rules
|
10
|
+
|
11
|
+
#### 0.0.8
|
12
|
+
|
13
|
+
- Update dependencies
|
14
|
+
|
15
|
+
#### 0.0.7
|
16
|
+
|
17
|
+
- Make use of the 'agile_utils' gem for better code re-use
|
18
|
+
|
19
|
+
#### 0.0.6
|
20
|
+
|
21
|
+
- Add `--non-exts` option that make it possible to include files without extension.
|
22
|
+
|
23
|
+
#### 0.0.5
|
24
|
+
|
25
|
+
- Refactoring the CLI options to make it easy for re-use in other library.
|
26
|
+
|
27
|
+
#### 0.0.4
|
28
|
+
|
29
|
+
- Add `ignore-case` option
|
30
|
+
- Use `-n' for `--include-words` and use `-i` for `--ignore-case`.
|
31
|
+
- Make the `--recursive` the default option
|
32
|
+
- Make the `--ignore-case` the default option
|
33
|
+
|
34
|
+
#### 0.0.3
|
35
|
+
|
36
|
+
- Update README.md to include better sample usage, and misc cleanup.
|
37
|
+
|
38
|
+
#### 0.0.2
|
39
|
+
|
40
|
+
- initial release
|
data/{LICENSE.txt → LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -66,30 +66,32 @@ Example Usage:
|
|
66
66
|
#
|
67
67
|
# ./bin/code_lister find -b spec/fixtures/ -e rb java
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
```
|
70
|
+
./demo1.xxx.rb
|
71
|
+
./demo1.yyy.rb
|
72
|
+
./demo2.xxx.rb
|
73
|
+
./demo2.yyy.rb
|
74
|
+
./java/demo3.xxx.java
|
75
|
+
./java/demo3.yyy.java
|
76
|
+
./java/demo4.xxx.java
|
77
|
+
./java/demo4.yyy.java
|
77
78
|
```
|
78
79
|
|
79
80
|
- Find all java java and ruby files but include only the files that contain the word `xxx`
|
80
81
|
|
81
82
|
```ruby
|
82
83
|
# ./bin/code_lister find -b spec/fixtures/ -e rb java -n xxx
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
|
85
|
+
./demo1.xxx.rb
|
86
|
+
./demo2.xxx.rb
|
87
|
+
./java/demo3.xxx.java
|
88
|
+
./java/demo4.xxx.java
|
87
89
|
```
|
88
90
|
- Same as previous step, but filter out result that contain the word `demo3` or `demo4`
|
89
91
|
```ruby
|
90
92
|
# ./bin/code_lister find -b spec/fixtures/ -e rb java -n xxx -x demo3 demo4
|
91
|
-
|
92
|
-
|
93
|
+
./demo1.xxx.rb
|
94
|
+
./demo2.xxx.rb
|
93
95
|
```
|
94
96
|
#### Using as ruby library
|
95
97
|
|
@@ -138,39 +140,6 @@ puts list1
|
|
138
140
|
list2 = CodeLister.filter(list1, inc_words: %w(final complete), exc_words: %w(demo test))
|
139
141
|
```
|
140
142
|
|
141
|
-
### Changelogs
|
142
|
-
|
143
|
-
#### 0.0.8
|
144
|
-
|
145
|
-
- Update dependencies
|
146
|
-
|
147
|
-
#### 0.0.7
|
148
|
-
|
149
|
-
- Make use of the 'agile_utils' gem for better code re-use
|
150
|
-
|
151
|
-
#### 0.0.6
|
152
|
-
|
153
|
-
- Add `--non-exts` option that make it possible to include files without extension.
|
154
|
-
|
155
|
-
#### 0.0.5
|
156
|
-
|
157
|
-
- Refactoring the CLI options to make it easy for re-use in other library.
|
158
|
-
|
159
|
-
#### 0.0.4
|
160
|
-
|
161
|
-
- Add `ignore-case` option
|
162
|
-
- Use `-n' for `--include-words` and use `-i` for `--ignore-case`.
|
163
|
-
- Make the `--recursive` the default option
|
164
|
-
- Make the `--ignore-case` the default option
|
165
|
-
|
166
|
-
#### 0.0.3
|
167
|
-
|
168
|
-
- Update README.md to include better sample usage, and misc cleanup.
|
169
|
-
|
170
|
-
#### 0.0.2
|
171
|
-
|
172
|
-
- initial release
|
173
|
-
|
174
143
|
## Contributing
|
175
144
|
|
176
145
|
1. Fork it ( http://github.com/<my-github-username>/code_lister/fork )
|
data/Rakefile
CHANGED
data/code_lister.gemspec
CHANGED
@@ -12,7 +12,18 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = %q{List/filter files similar to 'find then grep' command in Linux/Unix based system}
|
13
13
|
spec.homepage = 'https://github.com/agilecreativity/code_lister'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
# spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
# spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
# spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.files = Dir.glob("{bin,lib}/**/*") + %w(Gemfile
|
19
|
+
Rakefile
|
20
|
+
code_lister.gemspec
|
21
|
+
README.md
|
22
|
+
CHANGELOGS.md
|
23
|
+
LICENSE
|
24
|
+
.rubocop.yml
|
25
|
+
.gitignore
|
26
|
+
rubocop-todo.yml)
|
16
27
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
28
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
29
|
spec.require_paths = ['lib']
|
@@ -25,4 +36,5 @@ Gem::Specification.new do |spec|
|
|
25
36
|
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
26
37
|
spec.add_development_dependency 'pry', '~> 0.9'
|
27
38
|
spec.add_development_dependency 'fuubar', '~> 1.3'
|
39
|
+
spec.add_development_dependency 'rubocop', '~> 0.20.1'
|
28
40
|
end
|
data/lib/code_lister/cli.rb
CHANGED
@@ -2,7 +2,7 @@ require 'thor'
|
|
2
2
|
require 'agile_utils'
|
3
3
|
module CodeLister
|
4
4
|
class CLI < Thor
|
5
|
-
desc
|
5
|
+
desc 'find', 'List files by extensions, patterns, and simple criteria'
|
6
6
|
method_option *AgileUtils::Options::BASE_DIR
|
7
7
|
method_option *AgileUtils::Options::EXTS
|
8
8
|
method_option *AgileUtils::Options::NON_EXTS
|
@@ -22,7 +22,7 @@ module CodeLister
|
|
22
22
|
|
23
23
|
# Note: we don't use help so that we can run :r !./bin/code_lister help find
|
24
24
|
# to see the update help if we have to without commenting out
|
25
|
-
desc
|
25
|
+
desc 'usage', 'Display help screen'
|
26
26
|
def usage
|
27
27
|
puts <<-EOS
|
28
28
|
Usage:
|
@@ -10,18 +10,22 @@ module CodeLister
|
|
10
10
|
non_exts: []
|
11
11
|
}.merge(args)
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
# always expand the path
|
14
|
+
base_dir = File.expand_path(opts[:base_dir])
|
15
|
+
# base_dir = opts[:base_dir]
|
16
|
+
fail CustomError, "The directory #{base_dir} is not valid or or not readable!" unless File.exist?(base_dir)
|
15
17
|
|
16
18
|
wildcard = opts[:recursive] ? '**' : ''
|
17
19
|
exts = opts[:exts]
|
18
20
|
non_exts = opts[:non_exts]
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
files_with_extension = Dir.glob(File.join(base_dir, wildcard, "*.{#{exts.join(',')}}"))
|
23
|
+
files_without_extension = no_extension_files(base_dir, wildcard, non_exts)
|
24
|
+
# remove the 'base_dir' with .
|
25
|
+
files_with_extension.each { |f| f.gsub!(base_dir, '.') }
|
26
|
+
files_without_extension.each { |f| f.gsub!(base_dir, '.') }
|
23
27
|
# combine the result
|
24
|
-
(
|
28
|
+
(files_with_extension + files_without_extension).sort
|
25
29
|
end
|
26
30
|
|
27
31
|
# Filter out the list based on given list of words
|
@@ -56,14 +60,8 @@ module CodeLister
|
|
56
60
|
ignore_case = args[:ignore_case]
|
57
61
|
|
58
62
|
unless words.empty?
|
59
|
-
file_list.select! do |
|
60
|
-
words
|
61
|
-
if ignore_case
|
62
|
-
/#{w}/i =~ File.basename(f)
|
63
|
-
else
|
64
|
-
/#{w}/ =~ File.basename(f)
|
65
|
-
end
|
66
|
-
end
|
63
|
+
file_list.select! do |file|
|
64
|
+
matched_any?(words, file, ignore_case)
|
67
65
|
end
|
68
66
|
end
|
69
67
|
|
@@ -73,20 +71,24 @@ module CodeLister
|
|
73
71
|
def drop_any!(file_list, args = {})
|
74
72
|
words = args[:exc_words]
|
75
73
|
ignore_case = args[:ignore_case]
|
76
|
-
|
77
74
|
unless words.empty?
|
78
|
-
file_list.delete_if do |
|
79
|
-
words
|
80
|
-
if ignore_case
|
81
|
-
/#{w}/i =~ File.basename(f)
|
82
|
-
else
|
83
|
-
/#{w}/ =~ File.basename(f)
|
84
|
-
end
|
85
|
-
end
|
75
|
+
file_list.delete_if do |file|
|
76
|
+
matched_any?(words, file, ignore_case)
|
86
77
|
end
|
87
78
|
end
|
88
|
-
|
89
79
|
file_list
|
90
80
|
end
|
81
|
+
|
82
|
+
def matched_any?(words, file, ignore_case)
|
83
|
+
words.any? { |word| matched?(ignore_case, word, file) }
|
84
|
+
end
|
85
|
+
|
86
|
+
def matched?(ignore_case, word, file)
|
87
|
+
if ignore_case
|
88
|
+
/#{word}/i =~ File.basename(file)
|
89
|
+
else
|
90
|
+
/#{word}/ =~ File.basename(file)
|
91
|
+
end
|
92
|
+
end
|
91
93
|
end
|
92
94
|
end
|
data/lib/code_lister/version.rb
CHANGED
data/rubocop-todo.yml
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-05-09 23:31:10 +1000 using RuboCop version 0.21.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 8
|
9
|
+
AmbiguousOperator:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Offense count: 1
|
13
|
+
# Cop supports --auto-correct.
|
14
|
+
Blocks:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
# Cop supports --auto-correct.
|
19
|
+
DeprecatedClassMethods:
|
20
|
+
Enabled: true
|
21
|
+
|
22
|
+
# Offense count: 5
|
23
|
+
Documentation:
|
24
|
+
Enabled: false
|
25
|
+
|
26
|
+
# Offense count: 1
|
27
|
+
# Cop supports --auto-correct.
|
28
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
29
|
+
HashSyntax:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# Offense count: 1
|
33
|
+
# Cop supports --auto-correct.
|
34
|
+
LeadingCommentSpace:
|
35
|
+
Enabled: true
|
36
|
+
|
37
|
+
# Offense count: 22
|
38
|
+
LineLength:
|
39
|
+
Max: 124
|
40
|
+
|
41
|
+
# Offense count: 2
|
42
|
+
# Configuration parameters: CountComments.
|
43
|
+
MethodLength:
|
44
|
+
Max: 20
|
45
|
+
|
46
|
+
# Offense count: 1
|
47
|
+
# Cop supports --auto-correct.
|
48
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
49
|
+
SignalException:
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
# Offense count: 1
|
53
|
+
# Cop supports --auto-correct.
|
54
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
55
|
+
SpaceBeforeBlockBraces:
|
56
|
+
Enabled: true
|
57
|
+
|
58
|
+
# Offense count: 1
|
59
|
+
# Cop supports --auto-correct.
|
60
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
61
|
+
SpaceInsideBlockBraces:
|
62
|
+
Enabled: true
|
63
|
+
|
64
|
+
# Offense count: 1
|
65
|
+
# Cop supports --auto-correct.
|
66
|
+
SpaceInsideBrackets:
|
67
|
+
Enabled: true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_lister
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burin Choomnuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '1.3'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.20.1
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.20.1
|
139
153
|
description: List/filter files similar to 'find then grep' command in Linux/Unix based
|
140
154
|
system
|
141
155
|
email:
|
@@ -146,11 +160,10 @@ extensions: []
|
|
146
160
|
extra_rdoc_files: []
|
147
161
|
files:
|
148
162
|
- ".gitignore"
|
149
|
-
- ".
|
150
|
-
-
|
163
|
+
- ".rubocop.yml"
|
164
|
+
- CHANGELOGS.md
|
151
165
|
- Gemfile
|
152
|
-
-
|
153
|
-
- LICENSE.txt
|
166
|
+
- LICENSE
|
154
167
|
- README.md
|
155
168
|
- Rakefile
|
156
169
|
- bin/code_lister
|
@@ -161,19 +174,7 @@ files:
|
|
161
174
|
- lib/code_lister/logger.rb
|
162
175
|
- lib/code_lister/main.rb
|
163
176
|
- lib/code_lister/version.rb
|
164
|
-
-
|
165
|
-
- spec/code_lister/main_spec.rb
|
166
|
-
- spec/fixtures/demo1.xxx.rb
|
167
|
-
- spec/fixtures/demo1.yyy.rb
|
168
|
-
- spec/fixtures/demo2.xxx.rb
|
169
|
-
- spec/fixtures/demo2.yyy.rb
|
170
|
-
- spec/fixtures/java/demo3.xxx.java
|
171
|
-
- spec/fixtures/java/demo3.yyy.java
|
172
|
-
- spec/fixtures/java/demo4.xxx.java
|
173
|
-
- spec/fixtures/java/demo4.yyy.java
|
174
|
-
- spec/fixtures/noexts1_zzz
|
175
|
-
- spec/fixtures/noexts2_zzz
|
176
|
-
- spec/spec_helper.rb
|
177
|
+
- rubocop-todo.yml
|
177
178
|
homepage: https://github.com/agilecreativity/code_lister
|
178
179
|
licenses:
|
179
180
|
- MIT
|
@@ -198,18 +199,5 @@ rubygems_version: 2.2.2
|
|
198
199
|
signing_key:
|
199
200
|
specification_version: 4
|
200
201
|
summary: List/filter files like 'find then grep' command in Linux/Unix based system
|
201
|
-
test_files:
|
202
|
-
- spec/code_lister/code_lister_spec.rb
|
203
|
-
- spec/code_lister/main_spec.rb
|
204
|
-
- spec/fixtures/demo1.xxx.rb
|
205
|
-
- spec/fixtures/demo1.yyy.rb
|
206
|
-
- spec/fixtures/demo2.xxx.rb
|
207
|
-
- spec/fixtures/demo2.yyy.rb
|
208
|
-
- spec/fixtures/java/demo3.xxx.java
|
209
|
-
- spec/fixtures/java/demo3.yyy.java
|
210
|
-
- spec/fixtures/java/demo4.xxx.java
|
211
|
-
- spec/fixtures/java/demo4.yyy.java
|
212
|
-
- spec/fixtures/noexts1_zzz
|
213
|
-
- spec/fixtures/noexts2_zzz
|
214
|
-
- spec/spec_helper.rb
|
202
|
+
test_files: []
|
215
203
|
has_rdoc:
|
data/.rspec
DELETED
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.1
|
data/Guardfile
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
guard :rspec do
|
4
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
5
|
-
watch(%r{^spec/.+_spec\.rb$})
|
6
|
-
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
7
|
-
watch('spec/spec_helper.rb') { "spec" }
|
8
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
require_relative '../spec_helper'
|
2
|
-
describe CodeLister do
|
3
|
-
let(:file_list) {
|
4
|
-
CodeLister.files(base_dir: 'spec/fixtures', exts: %w(xxx.rb), recursive: true)
|
5
|
-
}
|
6
|
-
|
7
|
-
context "#files" do
|
8
|
-
it 'works with invalid input' do
|
9
|
-
expect{ CodeLister.files('bad-args')}.to raise_error
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'works with valid input' do
|
13
|
-
expect(CodeLister.files(base_dir: 'spec/fixtures', exts: %w(xxx.rb))).to eq ['spec/fixtures/demo1.xxx.rb',
|
14
|
-
'spec/fixtures/demo2.xxx.rb']
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'returns empty result if no match found' do
|
18
|
-
expect(CodeLister.files(base_dir: 'spec/fixtures', exts: %w(invalid-extension))).to eq []
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
context "#filter" do
|
23
|
-
it "works with empty filter inputs" do
|
24
|
-
expect(CodeLister.filter(file_list, inc_words: [], exc_words: [])).to eq file_list
|
25
|
-
end
|
26
|
-
|
27
|
-
it "works with unique match" do
|
28
|
-
expect(CodeLister.filter(file_list, inc_words: %w(demo1))).to eq ["spec/fixtures/demo1.xxx.rb"]
|
29
|
-
end
|
30
|
-
|
31
|
-
it "works with multiples matches" do
|
32
|
-
expect(CodeLister.filter(file_list, inc_words: %w(demo))).to eq ["spec/fixtures/demo1.xxx.rb",
|
33
|
-
"spec/fixtures/demo2.xxx.rb"]
|
34
|
-
|
35
|
-
expect(CodeLister.filter(file_list, inc_words: %w(xxx))).to eq ["spec/fixtures/demo1.xxx.rb",
|
36
|
-
"spec/fixtures/demo2.xxx.rb"]
|
37
|
-
end
|
38
|
-
|
39
|
-
it "filters out the words that we don't want" do
|
40
|
-
expect(CodeLister.filter(file_list, exc_words: %w(demo1))).to eq ["spec/fixtures/demo2.xxx.rb"]
|
41
|
-
expect(CodeLister.filter(file_list, exc_words: %w(xxx))).to eq []
|
42
|
-
end
|
43
|
-
|
44
|
-
context 'with ignore_case' do
|
45
|
-
it 'ignores case by default' do
|
46
|
-
expect(CodeLister.filter(file_list, exc_words: %w(DeMo1))).to eq CodeLister.filter(file_list, exc_words: %w(demo1))
|
47
|
-
expect(CodeLister.filter(file_list, exc_words: %w(DeMo1))).to eq ["spec/fixtures/demo2.xxx.rb"]
|
48
|
-
end
|
49
|
-
it 'does not ignore case if specified' do
|
50
|
-
expect(CodeLister.filter(file_list, exc_words: %w(DeMo1), ignore_case: false)).to eq ["spec/fixtures/demo1.xxx.rb",
|
51
|
-
"spec/fixtures/demo2.xxx.rb" ]
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
require_relative '../spec_helper'
|
2
|
-
describe CodeLister do
|
3
|
-
context '#files' do
|
4
|
-
it 'works with non_exts option' do
|
5
|
-
list = CodeLister::Main.run base_dir: 'spec/fixtures/',
|
6
|
-
recursive: true,
|
7
|
-
non_exts: %w(noexts1_zzz noexts2_zzz)
|
8
|
-
expect(list).to eq ['spec/fixtures/noexts1_zzz',
|
9
|
-
'spec/fixtures/noexts2_zzz']
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/spec/fixtures/demo1.xxx.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/demo1.xxx.rb
|
data/spec/fixtures/demo1.yyy.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/demo1.yyy.rb
|
data/spec/fixtures/demo2.xxx.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/demo2.xxx.rb
|
data/spec/fixtures/demo2.yyy.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/demo2.yyy.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
// file: test/fixtures/java/demo3.xxx.java
|
@@ -1 +0,0 @@
|
|
1
|
-
// file: test/fixtures/java/demo3.yyy.java
|
@@ -1 +0,0 @@
|
|
1
|
-
// file: test/fixtures/java/demo4.xxx.java
|
@@ -1 +0,0 @@
|
|
1
|
-
// file: test/fixtures/java/demo4.yyy.java
|
data/spec/fixtures/noexts1_zzz
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/noexts1_zzz
|
data/spec/fixtures/noexts2_zzz
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/noexts2_zzz
|
data/spec/spec_helper.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
-
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
-
# loaded once.
|
5
|
-
#
|
6
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
-
RSpec.configure do |config|
|
8
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
-
config.run_all_when_everything_filtered = true
|
10
|
-
config.filter_run :focus
|
11
|
-
|
12
|
-
# Run specs in random order to surface order dependencies. If you find an
|
13
|
-
# order dependency and want to debug it, you can fix the order by providing
|
14
|
-
# the seed, which is printed after each run.
|
15
|
-
# --seed 1234
|
16
|
-
config.order = 'random'
|
17
|
-
end
|
18
|
-
|
19
|
-
require_relative '../lib/code_lister'
|
20
|
-
include CodeLister
|