code_lister 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -10
- data/code_lister.gemspec +5 -5
- data/lib/code_lister/cli.rb +0 -1
- data/lib/code_lister/code_lister.rb +0 -4
- data/lib/code_lister/version.rb +1 -1
- data/spec/code_lister/code_lister_spec.rb +0 -1
- metadata +10 -11
- data/lib/code_lister/core_ext/hash.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7730af28692faa190358541a214fddd204ee3b02
|
4
|
+
data.tar.gz: 11cdf45d4c2e7cbdef17fa58615e87c35d65530b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee0b6456754105423da9c3d3be83b2dfb4123404c718842c532ff9a243fbd82cf5930910fd0539864c30c4c35ee962c584ffe04c0d0340ad86725d870e1f9c07
|
7
|
+
data.tar.gz: 712d3aaf85c96bea23d3656105e0e9f9839a08e4042411915a0b2ab7ab49dcb36981b4a8cebfa4e22c251824dbd8ba7b32c6a98de50eac9a1023070f3d98eb02
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
## code_lister
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/code_lister.svg)](http://badge.fury.io/rb/code_lister)
|
4
|
+
[![Dependency Status](https://gemnasium.com/agilecreativity/code_lister.png)](https://gemnasium.com/agilecreativity/code_lister)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/agilecreativity/code_lister.png)](https://codeclimate.com/github/agilecreativity/code_lister)
|
4
6
|
|
5
7
|
Find/filter files based on simple criteria like `extension`, include/exclude some words in the name.
|
6
8
|
It provides the functionality similar to subset of `find | grep` command in Linux/Unix system.
|
@@ -83,15 +85,12 @@ spec/fixtures/demo2.xxx.rb
|
|
83
85
|
spec/fixtures/java/demo3.xxx.java
|
84
86
|
spec/fixtures/java/demo4.xxx.java
|
85
87
|
```
|
86
|
-
|
87
88
|
- Same as previous step, but filter out result that contain the word `demo3` or `demo4`
|
88
|
-
|
89
89
|
```ruby
|
90
90
|
# ./bin/code_lister find -b spec/fixtures/ -e rb java -n xxx -x demo3 demo4
|
91
91
|
spec/fixtures/demo1.xxx.rb
|
92
92
|
spec/fixtures/demo2.xxx.rb
|
93
93
|
```
|
94
|
-
|
95
94
|
#### Using as ruby library
|
96
95
|
|
97
96
|
This is probably the proper way to utilize the library as the CLI only serve to
|
@@ -110,11 +109,9 @@ file_list = CodeLister.files base_dir: "spec/fixtures",
|
|
110
109
|
puts file_list
|
111
110
|
|
112
111
|
# To filter out the result you may do so with the `CodeLister.filter` method
|
113
|
-
|
114
112
|
new_list = CodeLister.filter(file_list, inc_words: %w(some list of word),
|
115
113
|
exc_words: %w(other text to excluded),
|
116
114
|
ignore_case: false)
|
117
|
-
|
118
115
|
```
|
119
116
|
|
120
117
|
### Development/Testing
|
@@ -141,33 +138,37 @@ puts list1
|
|
141
138
|
list2 = CodeLister.filter(list1, inc_words: %w(final complete), exc_words: %w(demo test))
|
142
139
|
```
|
143
140
|
|
144
|
-
###
|
141
|
+
### Changelogs
|
145
142
|
|
146
|
-
|
147
|
-
the compatibility as the result. Please let me know if you find any problem. Pull request is
|
148
|
-
always welcome.
|
143
|
+
#### 0.0.8
|
149
144
|
|
150
|
-
|
145
|
+
- Update dependencies
|
151
146
|
|
152
147
|
#### 0.0.7
|
148
|
+
|
153
149
|
- Make use of the 'agile_utils' gem for better code re-use
|
154
150
|
|
155
151
|
#### 0.0.6
|
152
|
+
|
156
153
|
- Add `--non-exts` option that make it possible to include files without extension.
|
157
154
|
|
158
155
|
#### 0.0.5
|
156
|
+
|
159
157
|
- Refactoring the CLI options to make it easy for re-use in other library.
|
160
158
|
|
161
159
|
#### 0.0.4
|
160
|
+
|
162
161
|
- Add `ignore-case` option
|
163
162
|
- Use `-n' for `--include-words` and use `-i` for `--ignore-case`.
|
164
163
|
- Make the `--recursive` the default option
|
165
164
|
- Make the `--ignore-case` the default option
|
166
165
|
|
167
166
|
#### 0.0.3
|
167
|
+
|
168
168
|
- Update README.md to include better sample usage, and misc cleanup.
|
169
169
|
|
170
170
|
#### 0.0.2
|
171
|
+
|
171
172
|
- initial release
|
172
173
|
|
173
174
|
## Contributing
|
data/code_lister.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = CodeLister::VERSION
|
9
9
|
spec.authors = ['Burin Choomnuan']
|
10
10
|
spec.email = ['agilecreativity@gmail.com']
|
11
|
-
spec.summary = %q{List/filter files like 'find
|
12
|
-
spec.description = %q{List/filter files similar to 'find
|
11
|
+
spec.summary = %q{List/filter files like 'find then grep' command in Linux/Unix based system}
|
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
15
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -17,9 +17,9 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
spec.add_runtime_dependency 'thor', '~> 0.19'
|
20
|
-
spec.add_runtime_dependency 'agile_utils', '~> 0.0.
|
21
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
22
|
-
spec.add_development_dependency 'rake', '~> 10.
|
20
|
+
spec.add_runtime_dependency 'agile_utils', '~> 0.0.8'
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.3'
|
23
23
|
spec.add_development_dependency 'rspec', '~> 2.14'
|
24
24
|
spec.add_development_dependency 'guard-rspec', '~> 4.2'
|
25
25
|
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
data/lib/code_lister/cli.rb
CHANGED
data/lib/code_lister/version.rb
CHANGED
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.8
|
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-04-
|
11
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.0.
|
33
|
+
version: 0.0.8
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.0.
|
40
|
+
version: 0.0.8
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
47
|
+
version: '1.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
54
|
+
version: '1.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '10.
|
61
|
+
version: '10.3'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '10.
|
68
|
+
version: '10.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,7 +136,7 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '1.3'
|
139
|
-
description: List/filter files similar to 'find
|
139
|
+
description: List/filter files similar to 'find then grep' command in Linux/Unix based
|
140
140
|
system
|
141
141
|
email:
|
142
142
|
- agilecreativity@gmail.com
|
@@ -158,7 +158,6 @@ files:
|
|
158
158
|
- lib/code_lister.rb
|
159
159
|
- lib/code_lister/cli.rb
|
160
160
|
- lib/code_lister/code_lister.rb
|
161
|
-
- lib/code_lister/core_ext/hash.rb
|
162
161
|
- lib/code_lister/logger.rb
|
163
162
|
- lib/code_lister/main.rb
|
164
163
|
- lib/code_lister/version.rb
|
@@ -198,7 +197,7 @@ rubyforge_project:
|
|
198
197
|
rubygems_version: 2.2.2
|
199
198
|
signing_key:
|
200
199
|
specification_version: 4
|
201
|
-
summary: List/filter files like 'find
|
200
|
+
summary: List/filter files like 'find then grep' command in Linux/Unix based system
|
202
201
|
test_files:
|
203
202
|
- spec/code_lister/code_lister_spec.rb
|
204
203
|
- spec/code_lister/main_spec.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
|
3
|
-
# File activesupport/lib/active_support/core_ext/hash/keys.rb
|
4
|
-
#
|
5
|
-
# hash = { name: 'Rob', age: '28' }
|
6
|
-
# hash.transform_keys{ |key| key.to_s.upcase }
|
7
|
-
# => { "NAME" => "Rob", "AGE" => "28" }
|
8
|
-
def transform_keys
|
9
|
-
result = {}
|
10
|
-
each_key do |key|
|
11
|
-
result[yield(key)] = self[key]
|
12
|
-
end
|
13
|
-
result
|
14
|
-
end
|
15
|
-
|
16
|
-
def transform_keys!(&block)
|
17
|
-
keys.each do |key|
|
18
|
-
value = delete(key)
|
19
|
-
self[yield(key)] = value.is_a?(Hash) ? value.transform_keys!(&block) : value
|
20
|
-
end
|
21
|
-
self
|
22
|
-
end
|
23
|
-
|
24
|
-
# hash = { 'name' => 'Rob', 'age' => '28' }
|
25
|
-
# hash.symbolize_keys
|
26
|
-
# => { name: "Rob", age: "28" }
|
27
|
-
def symbolize_keys
|
28
|
-
transform_keys{ |key| key.to_sym rescue key }
|
29
|
-
end
|
30
|
-
|
31
|
-
# File activesupport/lib/active_support/core_ext/hash/keys.rb, line 135
|
32
|
-
def symbolize_keys!
|
33
|
-
transform_keys!{ |key| key.to_sym rescue key }
|
34
|
-
end
|
35
|
-
end
|