ultra_config 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +33 -0
- data/lib/ultra_config/namespace.rb +31 -0
- data/ultra_config.gemspec +4 -3
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0fdcef2c29aaf00fdacd4189c1b156e7308083d50061b58ec11ab26dd5f1aaf2
|
4
|
+
data.tar.gz: 52ecb944f849b9cc33e7913cc72e13e6802bfb34e77c64cd5876627f9bd3fb5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89e667c687f45e8db12dcf5bfb2da6a1d03a2240adc337e5ab97f07d8256f00835a1bd1612738a25d89bca891e7259ea7243f70a8f6a39a2214a10c1ad88516e
|
7
|
+
data.tar.gz: 72b0d0d90766f0234e030f34bd44db68fcf9a45f5c2d257db5c1baa208fef8d5bf1990b818357e857570aafa97b067335970663575e6cf7e9fd375022c55efab
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
- name: Set up Ruby
|
24
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
25
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
26
|
+
# uses: ruby/setup-ruby@v1
|
27
|
+
uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
28
|
+
with:
|
29
|
+
ruby-version: 2.6
|
30
|
+
- name: Install dependencies
|
31
|
+
run: bundle install
|
32
|
+
- name: Run tests
|
33
|
+
run: bundle exec rake
|
@@ -1,9 +1,12 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
1
3
|
require_relative 'config'
|
2
4
|
|
3
5
|
module UltraConfig
|
4
6
|
class Namespace
|
5
7
|
class ObjectNotFoundError < StandardError; end
|
6
8
|
|
9
|
+
attr_accessor :logger
|
7
10
|
attr_reader :objects
|
8
11
|
|
9
12
|
def initialize(parents = [], &block)
|
@@ -55,6 +58,21 @@ module UltraConfig
|
|
55
58
|
hash
|
56
59
|
end
|
57
60
|
|
61
|
+
def merge_hash!(hash, parents = [])
|
62
|
+
hash.each do |k, v|
|
63
|
+
options = send_chain(parents)
|
64
|
+
if options.objects[k.to_sym].is_a?(Config)
|
65
|
+
options.send("#{k}=", v)
|
66
|
+
elsif options.objects[k.to_sym].is_a?(Namespace)
|
67
|
+
merge_hash!(v, parents + [k])
|
68
|
+
else
|
69
|
+
logger.warn { "received an unknown config #{k} with value #{v} and parents: #{parents}" }
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
self
|
74
|
+
end
|
75
|
+
|
58
76
|
def to_sanitized_h
|
59
77
|
hash = {}
|
60
78
|
@objects.each do |name, object|
|
@@ -75,5 +93,18 @@ module UltraConfig
|
|
75
93
|
def method_missing(m)
|
76
94
|
raise ObjectNotFoundError
|
77
95
|
end
|
96
|
+
|
97
|
+
private
|
98
|
+
|
99
|
+
# Send a chain of methods to an object
|
100
|
+
# @param arr [Array] list of methods to send to object
|
101
|
+
# @return [Object] result of method chain
|
102
|
+
def send_chain(arr)
|
103
|
+
arr.inject(self) {|obj, arr| obj.send(arr) }
|
104
|
+
end
|
105
|
+
|
106
|
+
def logger
|
107
|
+
@logger ||= (logger || Logger.new(IO::NULL))
|
108
|
+
end
|
78
109
|
end
|
79
110
|
end
|
data/ultra_config.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'ultra_config'
|
7
|
-
spec.version = '0.
|
7
|
+
spec.version = '0.14.0'
|
8
8
|
spec.authors = ['Gregory Kuruc']
|
9
9
|
spec.email = ['gjk910327@gmail.com']
|
10
10
|
|
@@ -19,7 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_development_dependency "
|
23
|
-
spec.add_development_dependency "
|
22
|
+
spec.add_development_dependency "bump", "~> 0.1"
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
24
|
+
spec.add_development_dependency "rake", ">= 12.3.3"
|
24
25
|
spec.add_development_dependency "rspec", "~> 3.0"
|
25
26
|
end
|
metadata
CHANGED
@@ -1,43 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultra_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregory Kuruc
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: bump
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '0.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
26
|
+
version: '0.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
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: '
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 12.3.3
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 12.3.3
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,13 +66,14 @@ dependencies:
|
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '3.0'
|
55
|
-
description:
|
69
|
+
description:
|
56
70
|
email:
|
57
71
|
- gjk910327@gmail.com
|
58
72
|
executables: []
|
59
73
|
extensions: []
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
76
|
+
- ".github/workflows/ruby.yml"
|
62
77
|
- ".gitignore"
|
63
78
|
- Gemfile
|
64
79
|
- LICENSE.txt
|
@@ -75,7 +90,7 @@ homepage: https://github.com/SpyMachine/UltraConfig
|
|
75
90
|
licenses:
|
76
91
|
- MIT
|
77
92
|
metadata: {}
|
78
|
-
post_install_message:
|
93
|
+
post_install_message:
|
79
94
|
rdoc_options: []
|
80
95
|
require_paths:
|
81
96
|
- lib
|
@@ -90,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
105
|
- !ruby/object:Gem::Version
|
91
106
|
version: '0'
|
92
107
|
requirements: []
|
93
|
-
|
94
|
-
|
95
|
-
signing_key:
|
108
|
+
rubygems_version: 3.0.3
|
109
|
+
signing_key:
|
96
110
|
specification_version: 4
|
97
111
|
summary: Provides a simple way to define a configuration with validation
|
98
112
|
test_files: []
|