eac_ruby_utils 0.128.0 → 0.128.1
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/boolean.rb +2 -2
- data/lib/eac_ruby_utils/enum.rb +1 -1
- data/lib/eac_ruby_utils/envs/command.rb +1 -1
- data/lib/eac_ruby_utils/gems_registry/gem/dependencies.rb +1 -1
- data/lib/eac_ruby_utils/patch_module.rb +4 -0
- data/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +1 -1
- data/lib/eac_ruby_utils/patches/module/patch_self.rb +1 -1
- data/lib/eac_ruby_utils/patches/module/simple_cache.rb +2 -2
- data/lib/eac_ruby_utils/root_module_setup/ignore.rb +56 -0
- data/lib/eac_ruby_utils/root_module_setup.rb +10 -23
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b94935e750593c0ab19c4a7dd5a7c9706b59a92c42c0be89daee54f88f236a0
|
4
|
+
data.tar.gz: 9f71b5d9ed0c45d0c8338288a19487693de100a1fa1b23787ee03fff63d5aa94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40951b5b3c354a75e30cfbe82c614289da2c7b4564b3f65d61c8f327949f5443954bfd11561d790faf6bd1596a85ba9722f86a33aeddec330fc136f9fcf8a4a4
|
7
|
+
data.tar.gz: bd9eb72941c5eb09ce73a3b4e337f324d254a6d33c845eb67dca62abd67a046674dbaae4fb0cbf9b5c9b2ed52fadc1d88311d0e4b35a459997c925d297e93a00
|
@@ -13,11 +13,11 @@ module EacRubyUtils
|
|
13
13
|
|
14
14
|
private
|
15
15
|
|
16
|
-
def parse_string(value)
|
16
|
+
def parse_string(value) # rubocop:disable Naming/PredicateMethod
|
17
17
|
['', 'n', 'no', 'f', 'false'].exclude?(value.strip.downcase)
|
18
18
|
end
|
19
19
|
|
20
|
-
def parse_number(value)
|
20
|
+
def parse_number(value) # rubocop:disable Naming/PredicateMethod
|
21
21
|
value.zero?
|
22
22
|
end
|
23
23
|
end
|
data/lib/eac_ruby_utils/enum.rb
CHANGED
@@ -13,7 +13,7 @@ module EacRubyUtils
|
|
13
13
|
# @param command [Array]
|
14
14
|
# @return [Array]
|
15
15
|
def sanitize_initialize_arguments(arguments)
|
16
|
-
if arguments.
|
16
|
+
if arguments.one? && arguments.first.is_a?(Array)
|
17
17
|
arguments.first
|
18
18
|
elsif arguments.is_a?(Array)
|
19
19
|
arguments
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_ruby_utils/
|
3
|
+
require 'eac_ruby_utils/patches/module/patch_self'
|
4
4
|
require 'eac_ruby_utils/simple_cache'
|
5
5
|
|
6
6
|
class Module
|
7
7
|
def enable_simple_cache
|
8
|
-
|
8
|
+
patch_self(::EacRubyUtils::SimpleCache)
|
9
9
|
end
|
10
10
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/patches/module/acts_as_instance_method'
|
4
|
+
require 'eac_ruby_utils/patches/object/to_pathname'
|
5
|
+
require 'eac_ruby_utils/patches/module/simple_cache'
|
6
|
+
require 'eac_ruby_utils/patches/pathname/basename_sub'
|
7
|
+
|
8
|
+
module EacRubyUtils
|
9
|
+
class RootModuleSetup
|
10
|
+
class Ignore
|
11
|
+
acts_as_instance_method
|
12
|
+
enable_simple_cache
|
13
|
+
common_constructor :setup, :path do
|
14
|
+
self.path = path.to_pathname
|
15
|
+
end
|
16
|
+
delegate :loader, :root_module_directory, to: :setup
|
17
|
+
|
18
|
+
# @return [Set]
|
19
|
+
def result
|
20
|
+
target_paths.each do |target_path|
|
21
|
+
expect_count_increment { loader.ignore target_path }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
# @return [Pathname]
|
28
|
+
def absolute_path_uncached
|
29
|
+
path.expand_path(root_module_directory)
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [Set]
|
33
|
+
def expect_count_increment
|
34
|
+
count_before = loader.send(:ignored_paths).count
|
35
|
+
result = yield
|
36
|
+
return result if result.count > count_before
|
37
|
+
|
38
|
+
raise ::ArgumentError, [
|
39
|
+
"Trying to ignore path \"#{path}\" did not increase the ignored paths.",
|
40
|
+
"Argument path: \"#{path}\"", "Target path: \"#{target_path}\"",
|
41
|
+
"Ignored paths: #{result}"
|
42
|
+
].join("\n")
|
43
|
+
end
|
44
|
+
|
45
|
+
# @return [Pathname]
|
46
|
+
def target_paths_uncached
|
47
|
+
return [absolute_path] if %w[* ?].any? { |e| absolute_path.to_path.include?(e) }
|
48
|
+
|
49
|
+
r = []
|
50
|
+
r << absolute_path if absolute_path.directory?
|
51
|
+
r << [absolute_path.basename_sub { |b| "#{b.basename('.*')}.rb" }]
|
52
|
+
r
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,12 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_support/inflector'
|
4
|
-
require 'eac_ruby_utils/patches/
|
5
|
-
require 'eac_ruby_utils/patches/object/to_pathname'
|
4
|
+
require 'eac_ruby_utils/patches/module/require_sub'
|
6
5
|
require 'zeitwerk'
|
7
6
|
|
8
7
|
module EacRubyUtils
|
9
8
|
class RootModuleSetup
|
9
|
+
require_sub __FILE__, require_mode: :kernel
|
10
|
+
|
10
11
|
DEFAULT_NAMESPACE = ::Object
|
11
12
|
LIB_DIRECTORY_BASENAME = 'lib'
|
12
13
|
|
@@ -34,18 +35,13 @@ module EacRubyUtils
|
|
34
35
|
::ActiveSupport::Inflector.constantize(dirname.classify)
|
35
36
|
end
|
36
37
|
|
37
|
-
# @
|
38
|
-
def
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
raise ::ArgumentError, [
|
46
|
-
"Trying to ignore path \"#{path}\" did not increase the ignored paths.",
|
47
|
-
"Argument path: \"#{path}\"", "Target path: \"#{target_path}\"", "Ignored paths: #{result}"
|
48
|
-
].join("\n")
|
38
|
+
# @return [Zeitwerk::GemLoader]
|
39
|
+
def loader
|
40
|
+
@loader ||= ::Zeitwerk::Registry.loader_for_gem(
|
41
|
+
root_module_file,
|
42
|
+
namespace: namespace,
|
43
|
+
warn_on_extra_files: true
|
44
|
+
)
|
49
45
|
end
|
50
46
|
|
51
47
|
# @return [Module]
|
@@ -94,14 +90,5 @@ module EacRubyUtils
|
|
94
90
|
def perform_zeitwerk
|
95
91
|
loader.setup
|
96
92
|
end
|
97
|
-
|
98
|
-
# @return [Zeitwerk::GemLoader]
|
99
|
-
def loader
|
100
|
-
@loader ||= ::Zeitwerk::Registry.loader_for_gem(
|
101
|
-
root_module_file,
|
102
|
-
namespace: namespace,
|
103
|
-
warn_on_extra_files: true
|
104
|
-
)
|
105
|
-
end
|
106
93
|
end
|
107
94
|
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.128.
|
4
|
+
version: 0.128.1
|
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: 2025-06-
|
11
|
+
date: 2025-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -333,6 +333,7 @@ files:
|
|
333
333
|
- lib/eac_ruby_utils/require_sub/base.rb
|
334
334
|
- lib/eac_ruby_utils/require_sub/sub_file.rb
|
335
335
|
- lib/eac_ruby_utils/root_module_setup.rb
|
336
|
+
- lib/eac_ruby_utils/root_module_setup/ignore.rb
|
336
337
|
- lib/eac_ruby_utils/rspec.rb
|
337
338
|
- lib/eac_ruby_utils/rspec/default_setup.rb
|
338
339
|
- lib/eac_ruby_utils/rspec/setup.rb
|