confg 3.0.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a22c813a8d81e3381f37ac6a2e98863c363091fc2cca5e35d8d4b81dae51d9d7
4
- data.tar.gz: 03b2fb1a7415571f1062c0a493fa4b1bd1fa130692ee59b0e926dab1641adf4f
3
+ metadata.gz: c5414d73decd949b0890219558f5bf68dfa0508330dc23c01359f10d4b3b5d79
4
+ data.tar.gz: 1aa9a65e7565c4cff14621279548500db41205e345152eb2ef0aa9a5f3783137
5
5
  SHA512:
6
- metadata.gz: 3da4ee7440ff963e2d760e7eb342f83bef36acab2bfd286a43b4e2645afb0947f19e34c2f0b0e7d6ab6013711c00cecc99132b29468e2bfeca7b93c5ad261c7d
7
- data.tar.gz: 9b5962463d289b4872911e3c7cbad774f0d127613bc06780b6fb3102c2751f89c3bf418bb8bfeab2e9add483c8edd25c27006300361d51c5e12cd73bda18fbb5
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
@@ -1,11 +1,11 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
7
6
  /pkg/
8
7
  /spec/reports/
8
+ /Gemfile.lock
9
9
  /tmp/
10
10
  *.bundle
11
11
  *.so
@@ -14,4 +14,4 @@
14
14
  mkmf.log
15
15
  *.gem
16
16
  .byebug_history
17
- /vendor/
17
+ /vendor/
data/.ruby-version ADDED
@@ -0,0 +1 @@
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
- spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
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
@@ -71,12 +71,12 @@ module Confg
71
71
  set(key, inner)
72
72
  end
73
73
 
74
- def load_key(key)
74
+ def load_key(key,yaml_loader_options = {})
75
75
  # loads yaml file with given key
76
- load_yaml(key, key: key)
76
+ load_yaml(key, yaml_loader_options, key: key)
77
77
  end
78
78
 
79
- def load_yaml(path, key: nil, ignore_env: false)
79
+ def load_yaml(path, yaml_loader_options = {}, key: nil, ignore_env: false)
80
80
  found_path = find_config_yaml(path)
81
81
 
82
82
  raise ArgumentError, "#{path} could not be found" if found_path.nil?
@@ -84,7 +84,7 @@ module Confg
84
84
  ctxt = ::Confg::ErbContext.new
85
85
  raw_content = ::File.read(found_path)
86
86
  erb_content = ctxt.evaluate(raw_content)
87
- yaml_content = ::YAML.send :safe_load, erb_content, aliases: true # due to shared sections
87
+ yaml_content = ::YAML.safe_load(erb_content, **yaml_loader_options.merge(aliases: true)) # due to shared sections
88
88
 
89
89
  unless ignore_env
90
90
  yaml_content = yaml_content[confg_env] if confg_env && yaml_content.is_a?(::Hash) && yaml_content.key?(confg_env)
data/lib/confg/version.rb CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  module Confg
4
4
 
5
- VERSION = "3.0.0"
5
+ MAJOR = 3
6
+ MINOR = 2
7
+ PATCH = 0
8
+ PRERELEASE = nil
6
9
 
10
+ VERSION = [MAJOR, MINOR, PATCH, PRERELEASE].compact.join(".")
7
11
  end
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.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: 2023-09-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -73,7 +72,10 @@ executables: []
73
72
  extensions: []
74
73
  extra_rdoc_files: []
75
74
  files:
75
+ - ".github/dependabot.yml"
76
+ - ".github/workflows/build.yml"
76
77
  - ".gitignore"
78
+ - ".ruby-version"
77
79
  - Gemfile
78
80
  - README.md
79
81
  - Rakefile
@@ -82,13 +84,10 @@ files:
82
84
  - lib/confg/configuration.rb
83
85
  - lib/confg/erb_context.rb
84
86
  - lib/confg/version.rb
85
- - test/confg_test.rb
86
- - test/example.yml
87
- - test/test_helper.rb
88
- homepage: ''
89
- licenses: []
87
+ homepage: https://github.com/guideline-tech/confg
88
+ licenses:
89
+ - MIT
90
90
  metadata: {}
91
- post_install_message:
92
91
  rdoc_options: []
93
92
  require_paths:
94
93
  - lib
@@ -96,18 +95,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
95
  requirements:
97
96
  - - ">="
98
97
  - !ruby/object:Gem::Version
99
- version: '0'
98
+ version: 3.2.0
100
99
  required_rubygems_version: !ruby/object:Gem::Requirement
101
100
  requirements:
102
101
  - - ">="
103
102
  - !ruby/object:Gem::Version
104
103
  version: '0'
105
104
  requirements: []
106
- rubygems_version: 3.2.33
107
- signing_key:
105
+ rubygems_version: 3.6.7
108
106
  specification_version: 4
109
107
  summary: Sets shared variables for applications
110
- test_files:
111
- - test/confg_test.rb
112
- - test/example.yml
113
- - test/test_helper.rb
108
+ test_files: []
data/test/confg_test.rb DELETED
@@ -1,80 +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_top_level_configs_are_cached_in_root_namespace
69
- ::Confg.send :reset!
70
- assert_equal({}, ::Confg.cache)
71
-
72
- default_config = ::Confg.config(env: "test", root: "/")
73
- custom_config = ::Confg.config(env: "foobar", root: "/Users/x/")
74
-
75
- refute_equal default_config.object_id, custom_config.object_id
76
- assert_equal 2, ::Confg.cache.size
77
- assert_equal %w[test--/ foobar--/Users/x/], ::Confg.cache.keys
78
- end
79
-
80
- end
data/test/example.yml DELETED
@@ -1,10 +0,0 @@
1
- shared: &shared
2
- foo: "foo"
3
-
4
- production:
5
- <<: *shared
6
- env_setting: "setting_prod"
7
-
8
- test:
9
- <<: *shared
10
- env_setting: "setting_test"
data/test/test_helper.rb DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
- require "confg"
5
-
6
- require "minitest/autorun"