confg 3.0.1 → 3.2.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/.github/dependabot.yml +24 -0
- data/.github/workflows/build.yml +22 -0
- data/.gitignore +2 -2
- data/.ruby-version +1 -1
- data/confg.gemspec +9 -2
- data/lib/confg/version.rb +5 -1
- metadata +10 -18
- data/test/confg_test.rb +0 -95
- data/test/example.yml +0 -10
- data/test/example_with_symbols.yml +0 -10
- data/test/test_helper.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5414d73decd949b0890219558f5bf68dfa0508330dc23c01359f10d4b3b5d79
|
4
|
+
data.tar.gz: 1aa9a65e7565c4cff14621279548500db41205e345152eb2ef0aa9a5f3783137
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfebb4875f179c75bac7cffe6f0793b2a102276736d50dee5cd9af18141f2ff78ad61c88441e2c4365330fde1c86aa1b51a08e65eee7088c19821d85f187167e
|
7
|
+
data.tar.gz: 9000af2c11b86868d862ea1d0a9c016e28b7f55387ff64348349e3f033170bf0b6f866d2adb48f4c2af4a30c0d071c14bc204ea0626c88416ac8fa276fa5b7be
|
@@ -0,0 +1,24 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
- package-ecosystem: "github-actions"
|
4
|
+
directory: "/"
|
5
|
+
open-pull-requests-limit: 20
|
6
|
+
schedule:
|
7
|
+
interval: "daily"
|
8
|
+
time: "09:00"
|
9
|
+
timezone: "America/New_York"
|
10
|
+
commit-message:
|
11
|
+
prefix: "[github-actions] "
|
12
|
+
- package-ecosystem: "bundler"
|
13
|
+
directory: "/"
|
14
|
+
schedule:
|
15
|
+
interval: "daily"
|
16
|
+
time: "08:30"
|
17
|
+
timezone: "America/New_York"
|
18
|
+
versioning-strategy: increase
|
19
|
+
open-pull-requests-limit: 20
|
20
|
+
insecure-external-code-execution: deny
|
21
|
+
allow:
|
22
|
+
- dependency-type: "all"
|
23
|
+
commit-message:
|
24
|
+
prefix: "[bundler] "
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: build
|
2
|
+
on:
|
3
|
+
pull_request:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
ruby-version: [3.2, 3.3, 3.4]
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v4
|
16
|
+
with:
|
17
|
+
show-progress: 'false'
|
18
|
+
- uses: ruby/setup-ruby@v1
|
19
|
+
with:
|
20
|
+
ruby-version: ${{ matrix.ruby-version }}
|
21
|
+
bundler-cache: true # runs `bundle install` and caches installed gems automatically
|
22
|
+
- run: bundle exec rake
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.3.7
|
data/confg.gemspec
CHANGED
@@ -11,9 +11,14 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ["mike@mnelson.io"]
|
12
12
|
spec.description = "Config the pipes"
|
13
13
|
spec.summary = "Sets shared variables for applications"
|
14
|
-
spec.homepage = ""
|
14
|
+
spec.homepage = "https://github.com/guideline-tech/confg"
|
15
|
+
spec.license = "MIT"
|
15
16
|
|
16
|
-
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test)/}) }
|
21
|
+
end
|
17
22
|
spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
18
23
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
24
|
spec.require_paths = ["lib"]
|
@@ -22,4 +27,6 @@ Gem::Specification.new do |spec|
|
|
22
27
|
spec.add_development_dependency "byebug"
|
23
28
|
spec.add_development_dependency "minitest", "~> 5.0"
|
24
29
|
spec.add_development_dependency "rake"
|
30
|
+
|
31
|
+
spec.required_ruby_version = ">= 3.2.0"
|
25
32
|
end
|
data/lib/confg/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Nelson
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: bundler
|
@@ -73,6 +72,8 @@ executables: []
|
|
73
72
|
extensions: []
|
74
73
|
extra_rdoc_files: []
|
75
74
|
files:
|
75
|
+
- ".github/dependabot.yml"
|
76
|
+
- ".github/workflows/build.yml"
|
76
77
|
- ".gitignore"
|
77
78
|
- ".ruby-version"
|
78
79
|
- Gemfile
|
@@ -83,14 +84,10 @@ files:
|
|
83
84
|
- lib/confg/configuration.rb
|
84
85
|
- lib/confg/erb_context.rb
|
85
86
|
- lib/confg/version.rb
|
86
|
-
|
87
|
-
|
88
|
-
-
|
89
|
-
- test/test_helper.rb
|
90
|
-
homepage: ''
|
91
|
-
licenses: []
|
87
|
+
homepage: https://github.com/guideline-tech/confg
|
88
|
+
licenses:
|
89
|
+
- MIT
|
92
90
|
metadata: {}
|
93
|
-
post_install_message:
|
94
91
|
rdoc_options: []
|
95
92
|
require_paths:
|
96
93
|
- lib
|
@@ -98,19 +95,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
95
|
requirements:
|
99
96
|
- - ">="
|
100
97
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
98
|
+
version: 3.2.0
|
102
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
100
|
requirements:
|
104
101
|
- - ">="
|
105
102
|
- !ruby/object:Gem::Version
|
106
103
|
version: '0'
|
107
104
|
requirements: []
|
108
|
-
rubygems_version: 3.
|
109
|
-
signing_key:
|
105
|
+
rubygems_version: 3.6.7
|
110
106
|
specification_version: 4
|
111
107
|
summary: Sets shared variables for applications
|
112
|
-
test_files:
|
113
|
-
- test/confg_test.rb
|
114
|
-
- test/example.yml
|
115
|
-
- test/example_with_symbols.yml
|
116
|
-
- test/test_helper.rb
|
108
|
+
test_files: []
|
data/test/confg_test.rb
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "test_helper"
|
4
|
-
|
5
|
-
class ConfgTest < Minitest::Test
|
6
|
-
|
7
|
-
def config
|
8
|
-
@config ||= ::Confg::Configuration.new(root: __dir__, env: "test")
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_simple_keys_can_be_assigned
|
12
|
-
config.foo = "bar"
|
13
|
-
assert_equal "bar", config.foo
|
14
|
-
assert_equal({ "foo" => "bar" }, config.to_h)
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_a_child_block_can_be_opened
|
18
|
-
config.open :foo do |child|
|
19
|
-
child.bar = "baz"
|
20
|
-
end
|
21
|
-
|
22
|
-
assert_equal "baz", config.foo.bar
|
23
|
-
assert_equal({ "foo" => { "bar" => "baz" } }, config.to_h)
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_a_child_block_can_be_merged_by_assigning_a_hash
|
27
|
-
config.foo = { "bar" => "baz" }
|
28
|
-
assert_equal "baz", config.foo.bar
|
29
|
-
assert_equal({ "foo" => { "bar" => "baz" } }, config.to_h)
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_an_error_is_raised_for_a_missing_key
|
33
|
-
assert_raises KeyError do
|
34
|
-
config.foo
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_hash_methods_are_accessible
|
39
|
-
config.foo = "foo_value"
|
40
|
-
config.bar = "bar_value"
|
41
|
-
|
42
|
-
assert_equal(%w[foo bar], config.keys)
|
43
|
-
assert_equal(%w[foo_value bar_value], config.values)
|
44
|
-
|
45
|
-
ikeys = []
|
46
|
-
config.each_key { |k| ikeys << k }
|
47
|
-
assert_equal(%w[foo bar], ikeys)
|
48
|
-
|
49
|
-
ivalues = []
|
50
|
-
config.each_value { |v| ivalues << v }
|
51
|
-
assert_equal(%w[foo_value bar_value], ivalues)
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_a_yml_file_can_be_loaded_by_env
|
55
|
-
config.load_yaml("example.yml")
|
56
|
-
assert_equal({ "foo" => "foo", "env_setting" => "setting_test" }, config.to_h)
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_a_yml_file_can_be_loaded_by_raw
|
60
|
-
config.load_yaml("example.yml", ignore_env: true)
|
61
|
-
assert_equal({
|
62
|
-
"shared" => { "foo" => "foo" },
|
63
|
-
"production" => { "env_setting" => "setting_prod", "foo" => "foo" },
|
64
|
-
"test" => { "env_setting" => "setting_test", "foo" => "foo" },
|
65
|
-
}, config.to_h)
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_a_yml_file_doesnt_load_with_additional_permitted_classes
|
69
|
-
assert_raises "Psych::DisallowedClass: Tried to load unspecified class: Symbol" do
|
70
|
-
config.load_yaml("example_with_symbols.yml", ignore_env: true)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_a_yml_file_can_be_loaded_with_additional_permitted_classes
|
75
|
-
config.load_yaml("example_with_symbols.yml", { permitted_classes: [Symbol] }, ignore_env: true)
|
76
|
-
assert_equal({
|
77
|
-
"shared" => { "foo" => :foo },
|
78
|
-
"production" => { "env_setting" => :setting_prod, "foo" => :foo },
|
79
|
-
"test" => { "env_setting" => :setting_test, "foo" => :foo },
|
80
|
-
}, config.to_h)
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_top_level_configs_are_cached_in_root_namespace
|
84
|
-
::Confg.send :reset!
|
85
|
-
assert_equal({}, ::Confg.cache)
|
86
|
-
|
87
|
-
default_config = ::Confg.config(env: "test", root: "/")
|
88
|
-
custom_config = ::Confg.config(env: "foobar", root: "/Users/x/")
|
89
|
-
|
90
|
-
refute_equal default_config.object_id, custom_config.object_id
|
91
|
-
assert_equal 2, ::Confg.cache.size
|
92
|
-
assert_equal %w[test--/ foobar--/Users/x/], ::Confg.cache.keys
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
data/test/example.yml
DELETED