eac_config 0.7.0 → 0.9.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_config/entry.rb +5 -1
- data/lib/eac_config/entry_path.rb +5 -0
- data/lib/eac_config/envvars_node/entry.rb +1 -1
- data/lib/eac_config/node.rb +6 -0
- data/lib/eac_config/node_entry.rb +4 -0
- data/lib/eac_config/paths_hash/node.rb +1 -1
- data/lib/eac_config/prefixed_path_node/entry.rb +25 -0
- data/lib/eac_config/prefixed_path_node.rb +19 -0
- data/lib/eac_config/rspec/setup.rb +8 -0
- data/lib/eac_config/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5db53702e6d4c6f65f85b26760876d5d6a6a2f0cbce94f4b51d5297ca62e37b3
|
|
4
|
+
data.tar.gz: 496941594317063a50560de0a0b570a9fbcaf6f7be33fb73a028339107f95b88
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75828d4f5c77d072e8be098fd550fd119226adafb769906dd514044251aac013fcf987df0a5a050d7b11a0a034a5bc16825348a7b3f352f91bb64aa3184afd47
|
|
7
|
+
data.tar.gz: ed10850b15eedc3e3375f06a811e54cb0c3760bb09cdcdb484e7f77c476e84301d465b83c4fedb81dca66e66a2db7c694057322f3ab2f6c55c240c585ab4f68f
|
data/lib/eac_config/entry.rb
CHANGED
|
@@ -18,6 +18,10 @@ module EacConfig
|
|
|
18
18
|
node_entry.if_present(&:node)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
def secret_value
|
|
22
|
+
node_entry.if_present(&:secret_value)
|
|
23
|
+
end
|
|
24
|
+
|
|
21
25
|
def value
|
|
22
26
|
node_entry.if_present(&:value)
|
|
23
27
|
end
|
|
@@ -38,7 +42,7 @@ module EacConfig
|
|
|
38
42
|
|
|
39
43
|
def node_entry_from_load_path_uncached
|
|
40
44
|
root_node.recursive_loaded_nodes.lazy.map { |loaded_node| loaded_node.self_entry(path) }
|
|
41
|
-
|
|
45
|
+
.find(&:found?)
|
|
42
46
|
end
|
|
43
47
|
|
|
44
48
|
def node_entry_from_root_uncached
|
|
@@ -12,7 +12,7 @@ module EacConfig
|
|
|
12
12
|
class << self
|
|
13
13
|
def entry_path_to_envvar_name(path)
|
|
14
14
|
::EacConfig::EntryPath.assert(path).parts.join('_').gsub(/[^a-z0-9_]/i, '')
|
|
15
|
-
|
|
15
|
+
.gsub(/\A_+/, '').gsub(/_+\z/, '').gsub(/_{2,}/, '_').upcase
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def from_value(string)
|
data/lib/eac_config/node.rb
CHANGED
|
@@ -58,6 +58,12 @@ module EacConfig
|
|
|
58
58
|
::EacConfig::LoadNodesSearch.new(self).result
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
+
# @return [EacConfig::PrefixedPathNode]
|
|
62
|
+
def with_prefix(path_prefix)
|
|
63
|
+
require 'eac_config/prefixed_path_node'
|
|
64
|
+
::EacConfig::PrefixedPathNode.new(self, path_prefix)
|
|
65
|
+
end
|
|
66
|
+
|
|
61
67
|
private
|
|
62
68
|
|
|
63
69
|
def load_node(node_path)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_config/node_entry'
|
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
|
5
|
+
|
|
6
|
+
module EacConfig
|
|
7
|
+
class PrefixedPathNode
|
|
8
|
+
class Entry < ::EacConfig::NodeEntry
|
|
9
|
+
enable_simple_cache
|
|
10
|
+
delegate :found?, :found_node, :secret_value, :value, :value=, :writ_node, to: :full_entry
|
|
11
|
+
|
|
12
|
+
# @return [EacConfig::EntryPath]
|
|
13
|
+
def full_path
|
|
14
|
+
node.path_prefix + path
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
# @return [EacConfig::NodeEntry]
|
|
20
|
+
def full_entry_uncached
|
|
21
|
+
node.from_node.entry(full_path)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_config/entry_path'
|
|
4
|
+
require 'eac_config/paths_hash'
|
|
5
|
+
require 'eac_ruby_utils/core_ext'
|
|
6
|
+
|
|
7
|
+
module EacConfig
|
|
8
|
+
class PrefixedPathNode
|
|
9
|
+
require_sub __FILE__
|
|
10
|
+
include ::EacConfig::Node
|
|
11
|
+
common_constructor :from_node, :path_prefix do
|
|
12
|
+
self.path_prefix = ::EacConfig::EntryPath.assert(path_prefix)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def entry(path)
|
|
16
|
+
::EacConfig::Entry.new(self, path)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -29,6 +29,14 @@ module EacConfig
|
|
|
29
29
|
::EacConfig::EnvvarsNode.new.load_path.entry
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
+
# Wraps a RSpec example in a EacConfig node using a alternative file.
|
|
33
|
+
#
|
|
34
|
+
# @param target_example [RSpec::Core::ExampleGroup] The example to wrap. If not provided,
|
|
35
|
+
# it is applied to all examples.
|
|
36
|
+
# @param target_file [Pathname] The file used by the EacConfig node. If not provided, a
|
|
37
|
+
# temporary file is used.
|
|
38
|
+
# @param node_builder [Proc] Should return the desired EacConfig node. If not provided, a
|
|
39
|
+
# EacConfig::YamlFileNode is created.
|
|
32
40
|
def stub_eac_config_node(target_example = nil, target_file = nil, &node_builder)
|
|
33
41
|
parent_self = self
|
|
34
42
|
(target_example || rspec_config).around do |example|
|
data/lib/eac_config/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eac_config
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Put here the authors
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-07-21 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -30,28 +30,28 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0.
|
|
33
|
+
version: '0.83'
|
|
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.
|
|
40
|
+
version: '0.83'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: eac_ruby_gem_support
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
47
|
+
version: 0.5.1
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
54
|
+
version: 0.5.1
|
|
55
55
|
description:
|
|
56
56
|
email:
|
|
57
57
|
executables: []
|
|
@@ -75,6 +75,8 @@ files:
|
|
|
75
75
|
- lib/eac_config/paths_hash/entry_key_error.rb
|
|
76
76
|
- lib/eac_config/paths_hash/node.rb
|
|
77
77
|
- lib/eac_config/paths_hash/path_search.rb
|
|
78
|
+
- lib/eac_config/prefixed_path_node.rb
|
|
79
|
+
- lib/eac_config/prefixed_path_node/entry.rb
|
|
78
80
|
- lib/eac_config/rspec.rb
|
|
79
81
|
- lib/eac_config/rspec/setup.rb
|
|
80
82
|
- lib/eac_config/version.rb
|