eac_ruby_utils 0.21.0 → 0.22.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.rb +1 -0
- data/lib/eac_ruby_utils/console/docopt_runner.rb +1 -1
- data/lib/eac_ruby_utils/filesystem_traverser.rb +56 -0
- data/lib/eac_ruby_utils/listable.rb +1 -1
- data/lib/eac_ruby_utils/patches/hash.rb +1 -1
- data/lib/eac_ruby_utils/patches/object.rb +1 -1
- data/lib/eac_ruby_utils/require_sub.rb +1 -1
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b861a9c3b748b6aeb1e66d0ddbdecd38f5fecf08f14ca42a31a486ed7d7ae9b4
|
4
|
+
data.tar.gz: be84a8533d1a4fea360b9e250799724acc7f3ef3e5f4d99e9bd567dda73d5b11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29ab7e2c0c8d9aea6bf0ff222c1c0fad81fd077d5b06315186bf152e00d77b32ca121adb1c2542f8c26cb03803705caed99237046aea118ee4286e89de288bf6
|
7
|
+
data.tar.gz: 479e0d22d8ff085defebb333916ec103a681f5940a32df4ea42f892fe51b62a3bd6baac495a2ff6d6827f1e3707e846e69fd91a783c68cd13369c78e7bc25161
|
data/lib/eac_ruby_utils.rb
CHANGED
@@ -8,6 +8,7 @@ module EacRubyUtils
|
|
8
8
|
require 'eac_ruby_utils/core_ext'
|
9
9
|
require 'eac_ruby_utils/envs'
|
10
10
|
require 'eac_ruby_utils/filesystem_cache'
|
11
|
+
require 'eac_ruby_utils/filesystem_traverser'
|
11
12
|
require 'eac_ruby_utils/fs_cache'
|
12
13
|
require 'eac_ruby_utils/listable'
|
13
14
|
require 'eac_ruby_utils/options_consumer'
|
@@ -5,7 +5,7 @@ require 'active_support/core_ext/hash/slice'
|
|
5
5
|
require 'docopt'
|
6
6
|
require 'eac_ruby_utils/contextualizable'
|
7
7
|
require 'eac_ruby_utils/patches/hash/sym_keys_hash'
|
8
|
-
Dir["#{__dir__}/#{::File.basename(__FILE__, '.*')}/_*.rb"].each do |partial|
|
8
|
+
Dir["#{__dir__}/#{::File.basename(__FILE__, '.*')}/_*.rb"].sort.each do |partial|
|
9
9
|
require partial
|
10
10
|
end
|
11
11
|
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRubyUtils
|
4
|
+
class FilesystemTraverser
|
5
|
+
attr_accessor :check_directory, :check_file, :recursive, :hidden_directories
|
6
|
+
|
7
|
+
def check_path(path)
|
8
|
+
path = ::Pathname.new(path.to_s) unless path.is_a?(::Pathname)
|
9
|
+
internal_check_path(path, 0)
|
10
|
+
end
|
11
|
+
|
12
|
+
def hidden_directories?
|
13
|
+
hidden_directories ? true : false
|
14
|
+
end
|
15
|
+
|
16
|
+
def recursive?
|
17
|
+
recursive ? true : false
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def process_directory?(level)
|
23
|
+
level.zero? || recursive?
|
24
|
+
end
|
25
|
+
|
26
|
+
def inner_check_directory(dir, level)
|
27
|
+
return unless process_directory?(level)
|
28
|
+
|
29
|
+
user_check_directory(dir)
|
30
|
+
dir.each_entry do |e|
|
31
|
+
next if %(. ..).include?(e.basename.to_s)
|
32
|
+
next unless !e.basename.to_s.start_with?('.') || hidden_directories?
|
33
|
+
|
34
|
+
internal_check_path(dir.join(e), level + 1)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def internal_check_path(path, level)
|
39
|
+
if path.file?
|
40
|
+
user_check_file(path)
|
41
|
+
elsif path.directory?
|
42
|
+
inner_check_directory(path, level)
|
43
|
+
else
|
44
|
+
raise "Unknown filesystem object: #{path}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def user_check_file(path)
|
49
|
+
check_file&.call(path)
|
50
|
+
end
|
51
|
+
|
52
|
+
def user_check_directory(path)
|
53
|
+
check_directory&.call(path)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
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.22.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-
|
11
|
+
date: 2020-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.80.1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.80.1
|
111
111
|
description:
|
112
112
|
email:
|
113
113
|
executables: []
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/eac_ruby_utils/envs/process.rb
|
144
144
|
- lib/eac_ruby_utils/envs/ssh_env.rb
|
145
145
|
- lib/eac_ruby_utils/filesystem_cache.rb
|
146
|
+
- lib/eac_ruby_utils/filesystem_traverser.rb
|
146
147
|
- lib/eac_ruby_utils/fs_cache.rb
|
147
148
|
- lib/eac_ruby_utils/listable.rb
|
148
149
|
- lib/eac_ruby_utils/listable/class_methods.rb
|