eac_ruby_utils 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/eac_ruby_utils/filesystem_traverser.rb +14 -3
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca2a6292acad5715493643a175a2760e7b3e21d4dbab227b611bd1956b997746
|
4
|
+
data.tar.gz: 0e422f58351345b5525bafb9b49c3008325d13d056c8026cc90f1ef64f21173d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9a57c3229bc90546c0153a036e95a221ca952388c49d7cbeba188f6f8e1d7756516c08c504d03f0ca941a94c9321aee822ac0bdeff745e8be80eb4305315838
|
7
|
+
data.tar.gz: c0e1597137ed6b6e96f7ae339a420db7c8d0dd141a1014180ddf7988c9e765eaf0d627883e1d4152d8b3a3a3e512b5ec33eb9f151a479057f9ca399f69a6e098
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module EacRubyUtils
|
4
4
|
class FilesystemTraverser
|
5
|
-
attr_accessor :check_directory, :check_file, :recursive, :hidden_directories
|
5
|
+
attr_accessor :check_directory, :check_file, :recursive, :hidden_directories, :sort
|
6
6
|
|
7
7
|
def check_path(path)
|
8
8
|
path = ::Pathname.new(path.to_s) unless path.is_a?(::Pathname)
|
@@ -17,8 +17,20 @@ module EacRubyUtils
|
|
17
17
|
recursive ? true : false
|
18
18
|
end
|
19
19
|
|
20
|
+
def sort?
|
21
|
+
sort ? true : false
|
22
|
+
end
|
23
|
+
|
20
24
|
private
|
21
25
|
|
26
|
+
def each_child(dir, &block)
|
27
|
+
if sort?
|
28
|
+
dir.each_child.sort_by { |p| [p.to_s] }.each(&block)
|
29
|
+
else
|
30
|
+
dir.each_child(&block)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
22
34
|
def process_directory?(level)
|
23
35
|
level.zero? || recursive?
|
24
36
|
end
|
@@ -27,8 +39,7 @@ module EacRubyUtils
|
|
27
39
|
return unless process_directory?(level)
|
28
40
|
|
29
41
|
user_check_directory(dir)
|
30
|
-
dir
|
31
|
-
next if %(. ..).include?(e.basename.to_s)
|
42
|
+
each_child(dir) do |e|
|
32
43
|
next unless !e.basename.to_s.start_with?('.') || hidden_directories?
|
33
44
|
|
34
45
|
internal_check_path(dir.join(e), level + 1)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.27.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|