code_lister 0.1.7 → 0.2.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: e5802e933d268745ca6bc5c5f7f6e90cc2266b0c
4
- data.tar.gz: c4b931df8b7538838f259c3f86df8b0163276f57
3
+ metadata.gz: b19f44bf0734329009891b0b47a34ed14e5ce8bd
4
+ data.tar.gz: 96b03e12b2dc74b262a5b5dc4131f39abc8b4b87
5
5
  SHA512:
6
- metadata.gz: ddbb984454b699da9a01c65aa88ca79bebcce6cd64f7a652e59bb5c1557439c02afeb664d87fa2cc61e8f706add4d37273f21b53afeddf5976ad0bcd5fce9389
7
- data.tar.gz: 8e69327acbbc1278a14efafd6440fb2c167dacfa18dec1453e95ffc76aaaba40045affe6f5bc9744b6b08689ddd8d347259056f898246d3f9e253aa659ec90ff
6
+ metadata.gz: 75e0cd822af5458290e4e92c2e3e153e34cfef08a68006bd9c9aa59e48377296d44dc931a435b9427aa2602d451ae67f18ce6b292d7a4ee8769ba7e99fdc0554
7
+ data.tar.gz: 4ccb8dfd955f7c9a03ba6d532223feae6355cbff1dedfeb208cfdcd88f65307a0947e57495f312766259fbfd5e55bcf7f6fe7a353a13d01a12a220c795399404
data/.rubocop.yml CHANGED
@@ -29,15 +29,6 @@ CollectionMethods:
29
29
  find: 'detect'
30
30
  find_all: 'select'
31
31
 
32
- # Do not force public/protected/private keyword to be indented at the same
33
- # level as the def keyword. My personal preference is to outdent these keywords
34
- # because I think when scanning code it makes it easier to identify the
35
- # sections of code and visually separate them. When the keyword is at the same
36
- # level I think it sort of blends in with the def keywords and makes it harder
37
- # to scan the code and see where the sections are.
38
- AccessModifierIndentation:
39
- Enabled: false
40
-
41
32
  # Limit line length
42
33
  LineLength:
43
34
  Enabled: false
@@ -46,9 +37,8 @@ LineLength:
46
37
  Documentation:
47
38
  Enabled: false
48
39
 
49
- # Enforce Ruby 1.8-compatible hash syntax
50
40
  HashSyntax:
51
- Enabled: true
41
+ Enabled: false
52
42
 
53
43
  # No spaces inside hash literals
54
44
  SpaceInsideHashLiteralBraces:
@@ -62,9 +52,9 @@ DotPosition:
62
52
  Encoding:
63
53
  Enabled: false
64
54
 
65
- # Enforce outdenting of access modifiers (i.e. public, private, protected)
66
- AccessModifierIndentation:
67
- EnforcedStyle: outdent
55
+ # # Enforce outdenting of access modifiers (i.e. public, private, protected)
56
+ # AccessModifierIndentation:
57
+ # EnforcedStyle: outdent
68
58
 
69
59
  EmptyLinesAroundAccessModifier:
70
60
  Enabled: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ### Changelogs
2
2
 
3
+ #### 0.2.0
4
+
5
+ - Update to agile_utils that require refinement suppport (2.0.x+)
6
+ - Only support ruby 2.0.x+ to avoid the mokeypatch core ruby library
7
+ - Minor update to rubocop style
8
+ - Update Guardfile to make it run correctly
9
+
3
10
  #### 0.1.7
4
11
 
5
12
  - Add new api `files_from_shell` that replaces `prefix` with `.` string
data/README.md CHANGED
@@ -12,6 +12,11 @@ that I can re-use it in other project.
12
12
 
13
13
  Note: starting from version `0.1.0` this gem will follow the [Semantic Versioning] convention.
14
14
 
15
+ ### NOTES
16
+
17
+ - Starting from version 0.2.0 only ruby 2.0.x are supported
18
+ - Use version 0.1.x if you need to use with ruby 1.9.x
19
+
15
20
  ### Installation
16
21
 
17
22
  Add this line to your application's Gemfile:
@@ -157,7 +162,7 @@ list2 = CodeLister.filter(list1, inc_words: %w(final complete), exc_words: %w(de
157
162
 
158
163
  ## Contributing
159
164
 
160
- 1. Fork it ( http://github.com/<my-github-username>/code_lister/fork )
165
+ 1. Fork it (http://github.com/agilecreativity/code_lister/fork)
161
166
  2. Create your feature branch (`git checkout -b my-new-feature`)
162
167
  3. Commit your changes (`git commit -am 'Add some feature'`)
163
168
  4. Push to the branch (`git push origin my-new-feature`)
data/code_lister.gemspec CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |spec|
7
7
  spec.version = CodeLister::VERSION
8
8
  spec.authors = ["Burin Choomnuan"]
9
9
  spec.email = ["agilecreativity@gmail.com"]
10
- spec.summary = %q(List/filter files like 'find then grep' command in Linux/Unix based system)
11
- spec.description = %q(List/filter files similar to 'find then grep' command in Linux/Unix based system)
10
+ spec.summary = "List/filter files like 'find then grep' command in Linux/Unix based system"
11
+ spec.description = "List/filter files similar to 'find then grep' command in Linux/Unix based system"
12
12
  spec.homepage = "https://github.com/agilecreativity/code_lister"
13
13
  spec.license = "MIT"
14
14
  spec.files = Dir.glob("{bin,lib}/**/*") + %w[Gemfile
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
24
24
  spec.require_paths = ["lib"]
25
25
  spec.add_runtime_dependency "thor", "~> 0.19"
26
- spec.add_runtime_dependency "agile_utils", "~> 0.1.4"
26
+ spec.add_runtime_dependency "agile_utils", "~> 0.2.0"
27
27
  spec.add_development_dependency "bundler", "~> 1.6"
28
28
  spec.add_development_dependency "rake", "~> 10.3"
29
29
  spec.add_development_dependency "rspec", "~> 2.14"
@@ -2,6 +2,8 @@ require "thor"
2
2
  require "agile_utils"
3
3
  module CodeLister
4
4
  class CLI < Thor
5
+ using AgileUtils::HashExt
6
+
5
7
  # rubocop:disable AmbiguousOperator, LineLength
6
8
  desc "find", "List files by extensions, patterns, and simple criteria"
7
9
  method_option *AgileUtils::Options::BASE_DIR
@@ -12,6 +14,7 @@ module CodeLister
12
14
  method_option *AgileUtils::Options::IGNORE_CASE
13
15
  method_option *AgileUtils::Options::RECURSIVE
14
16
  method_option *AgileUtils::Options::VERSION
17
+
15
18
  def find
16
19
  opts = options.symbolize_keys
17
20
  if opts[:version]
@@ -1,6 +1,7 @@
1
- require 'agile_utils'
1
+ require "agile_utils"
2
2
  module CodeLister
3
3
  CustomError = Class.new(StandardError)
4
+
4
5
  class << self
5
6
  # Execute the command in the shell and extract the output to be used
6
7
  #
@@ -20,7 +21,7 @@ module CodeLister
20
21
  !File.exist?(file)
21
22
  end
22
23
  files
23
- rescue RuntimeError => e
24
+ rescue RuntimeError
24
25
  # return empty list for invalid command
25
26
  return []
26
27
  end
@@ -33,7 +34,7 @@ module CodeLister
33
34
  def files_from_shell(command, prefix)
34
35
  prefix = File.expand_path(prefix) if prefix
35
36
  unless prefix && File.directory?(prefix)
36
- raise "'#{prefix}' is not valid prefix directory!"
37
+ fail "'#{prefix}' is not valid prefix directory!"
37
38
  end
38
39
  files = files_from_command(command)
39
40
  files.map! { |file| file.gsub(File.expand_path(prefix), ".") }
@@ -100,12 +101,10 @@ module CodeLister
100
101
  files
101
102
  end
102
103
 
103
- private
104
-
105
104
  # List files that do not have the extension
106
105
  #
107
106
  # @return list of files that does not have any extension
108
- def no_extension_files(base_dir, wildcard, non_exts = [])
107
+ private def no_extension_files(base_dir, wildcard, non_exts = [])
109
108
  list = []
110
109
  unless non_exts.empty?
111
110
  list = Dir.glob(File.join(base_dir, wildcard, "{#{non_exts.join(",")}}"))
@@ -113,7 +112,7 @@ module CodeLister
113
112
  list
114
113
  end
115
114
 
116
- def take_any!(file_list, args = {})
115
+ private def take_any!(file_list, args = {})
117
116
  words = args[:inc_words]
118
117
  ignore_case = args[:ignore_case]
119
118
  unless words.empty?
@@ -124,7 +123,7 @@ module CodeLister
124
123
  file_list
125
124
  end
126
125
 
127
- def drop_any!(file_list, args = {})
126
+ private def drop_any!(file_list, args = {})
128
127
  words = args[:exc_words]
129
128
  ignore_case = args[:ignore_case]
130
129
  unless words.empty?
@@ -135,11 +134,11 @@ module CodeLister
135
134
  file_list
136
135
  end
137
136
 
138
- def matched_any?(words, file, ignore_case)
137
+ private def matched_any?(words, file, ignore_case)
139
138
  words.any? { |word| matched?(ignore_case, word, file) }
140
139
  end
141
140
 
142
- def matched?(ignore_case, word, file)
141
+ private def matched?(ignore_case, word, file)
143
142
  if ignore_case
144
143
  /#{word}/i =~ File.basename(file)
145
144
  else
@@ -12,16 +12,16 @@ module CodeLister
12
12
  files
13
13
  end
14
14
 
15
- private
16
-
17
- def default_options
18
- { base_dir: Dir.pwd,
15
+ private def default_options
16
+ {
17
+ base_dir: Dir.pwd,
19
18
  recursive: true,
20
19
  ignore_case: true,
21
20
  inc_words: [],
22
21
  exc_words: [],
23
22
  exts: [],
24
- non_exts: [] }
23
+ non_exts: []
24
+ }
25
25
  end
26
26
  end
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module CodeLister
2
- VERSION = "0.1.7"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.7
4
+ version: 0.2.0
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-06-21 00:00:00.000000000 Z
11
+ date: 2014-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.4
33
+ version: 0.2.0
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.1.4
40
+ version: 0.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement