eac_ruby_utils 0.128.0 → 0.128.2
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 +11 -24
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +5 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42b195bbe300f5bd15bcc1f5d645ea2bb89eac36497699e8159260cc15847b37
|
4
|
+
data.tar.gz: '0258a205a382fbda8bdf07668c151295d3a7b7faff7a3d17d14ca34db645b69c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1f683ade95ea597de564103ca148f17d31e9918a7cfcaa6d0095b8b23496d0faec1d0582f687709576353d0a7c0d15dee8613d416896bf05150a219ce0027b8
|
7
|
+
data.tar.gz: 41d54aea9d7411f665c2f3c6582984fff91c91dfa4045f3829d5a54d01a2b88c9a61b897c20845792e679dbc78c60673e30c4248e9a3ba7c2c7680f2fd797be8
|
@@ -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
|
|
@@ -31,21 +32,16 @@ module EacRubyUtils
|
|
31
32
|
return nil if ['.', '/', ''].include?(dirname)
|
32
33
|
|
33
34
|
require dirname
|
34
|
-
::ActiveSupport::Inflector.constantize(dirname.
|
35
|
+
::ActiveSupport::Inflector.constantize(dirname.camelize)
|
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.2
|
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-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -138,20 +138,14 @@ dependencies:
|
|
138
138
|
requirements:
|
139
139
|
- - "~>"
|
140
140
|
- !ruby/object:Gem::Version
|
141
|
-
version: '0.
|
142
|
-
- - ">="
|
143
|
-
- !ruby/object:Gem::Version
|
144
|
-
version: 0.11.1
|
141
|
+
version: '0.12'
|
145
142
|
type: :development
|
146
143
|
prerelease: false
|
147
144
|
version_requirements: !ruby/object:Gem::Requirement
|
148
145
|
requirements:
|
149
146
|
- - "~>"
|
150
147
|
- !ruby/object:Gem::Version
|
151
|
-
version: '0.
|
152
|
-
- - ">="
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
version: 0.11.1
|
148
|
+
version: '0.12'
|
155
149
|
description:
|
156
150
|
email:
|
157
151
|
executables: []
|
@@ -333,6 +327,7 @@ files:
|
|
333
327
|
- lib/eac_ruby_utils/require_sub/base.rb
|
334
328
|
- lib/eac_ruby_utils/require_sub/sub_file.rb
|
335
329
|
- lib/eac_ruby_utils/root_module_setup.rb
|
330
|
+
- lib/eac_ruby_utils/root_module_setup/ignore.rb
|
336
331
|
- lib/eac_ruby_utils/rspec.rb
|
337
332
|
- lib/eac_ruby_utils/rspec/default_setup.rb
|
338
333
|
- lib/eac_ruby_utils/rspec/setup.rb
|