config_hound 1.4.3 → 1.5.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
- SHA1:
3
- metadata.gz: 221d83abd19025a9a2dda8abbeb87b5ac679a120
4
- data.tar.gz: 87ccb306f52f230d2b14a606169a15ebc43b024a
2
+ SHA256:
3
+ metadata.gz: 33f4e286668dbf7171c50d313cd9339cbb1ccbdc34d9b68c1e732c7a84d0acb9
4
+ data.tar.gz: 007b751b55b1b1463db129e754572e966f937a890636a16d3506d3b9ca2801b9
5
5
  SHA512:
6
- metadata.gz: ce10dc81bba78fd68ae07037e23082090019f472fc78c275da7acd21692b7b8341b6d0f05973c68a799f1d689570265d97658c5001f2d1437343c6e53f33f7d4
7
- data.tar.gz: aa4391c66ade9fc59f1c776b3750114212e61155a53d855cf08a5c2803784dfd1539704f33c0ad4c3d5c6574a130c94753737a2fbcf8a65edc4160f37ea88ebe
6
+ metadata.gz: bdaa8f5cd09e6a5aee6c35b5a9116e2f7f28b7553472c1b10ece292028d5553ffdfeda9c4358a79729589c33f565b58a4439c42f431cd1a7e9ad0878bba376e4
7
+ data.tar.gz: b084ffc0661eaf04af3ff1c22bc762158e660a5a0ab0658d9b71b89b1700cb402515c5a2ea01520b2b8d61e0cbe682e5425939e5499e45b5cf0736b600fec0f1
@@ -0,0 +1,20 @@
1
+ name: Tests
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+
8
+ strategy:
9
+ matrix:
10
+ ruby: ['2.7', '3.0', '3.1']
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - uses: actions/checkout@v3
15
+ - uses: ruby/setup-ruby@v1
16
+ with:
17
+ bundler-cache: true
18
+ ruby-version: ${{ matrix.ruby }}
19
+ - run: bundle install
20
+ - run: bundle exec rake
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ConfigHound
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/config_hound.png)](http://badge.fury.io/rb/config_hound)
4
- [![Build Status](https://travis-ci.org/mdub/config_hound.svg?branch=master)](https://travis-ci.org/mdub/config_hound)
3
+ [![Gem Version](https://badge.fury.io/rb/config_hound.svg)](http://badge.fury.io/rb/config_hound)
4
+ [![Build Status](https://github.com/mdub/config_hound/actions/workflows/test.yaml/badge.svg?branch=master)](https://github.com/mdub/config_hound/actions/workflows/test.yaml)
5
5
 
6
6
  ConfigHound makes it easy to load configuration data.
7
7
 
data/config_hound.gemspec CHANGED
@@ -19,9 +19,11 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^spec/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
+ spec.required_ruby_version = '>= 2.7'
23
+
22
24
  spec.add_runtime_dependency "dig_rb"
23
25
 
24
- spec.add_development_dependency "bundler", "~> 1.7"
25
- spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "bundler", "~> 2.2"
27
+ spec.add_development_dependency "rake", "~> 13.0"
26
28
 
27
29
  end
@@ -47,7 +47,7 @@ module ConfigHound
47
47
 
48
48
  def expand_hash(input)
49
49
  input.each_with_object({}) do |(k,v), a|
50
- a[k] = expand(v)
50
+ a[expand(k)] = expand(v)
51
51
  end
52
52
  end
53
53
 
@@ -16,7 +16,7 @@ module ConfigHound
16
16
 
17
17
  def parse_yaml(raw)
18
18
  require "yaml"
19
- YAML.safe_load(raw, [], [], true)
19
+ YAML.safe_load(raw, permitted_classes: [], permitted_symbols: [], aliases: true)
20
20
  end
21
21
 
22
22
  alias :parse_yml :parse_yaml
@@ -48,7 +48,7 @@ module ConfigHound
48
48
  end
49
49
 
50
50
  def read
51
- open(uri.scheme == "file" ? uri.path : uri.to_s) do |io|
51
+ URI.open(uri.scheme == "file" ? uri.path : uri.to_s) do |io|
52
52
  io.read
53
53
  end
54
54
  rescue Errno::ENOENT
@@ -56,7 +56,7 @@ module ConfigHound
56
56
  end
57
57
 
58
58
  def format
59
- File.extname(uri.to_s)[1..-1]
59
+ File.extname(uri.path.to_s)[1..-1]
60
60
  end
61
61
 
62
62
  def load
@@ -1,3 +1,3 @@
1
1
  module ConfigHound
2
- VERSION = "1.4.3"
2
+ VERSION = "1.5.0"
3
3
  end
@@ -16,6 +16,38 @@ describe ConfigHound, "expansion" do
16
16
  expect(config["address"]).to eq("host:5678")
17
17
  end
18
18
 
19
+ context "with key expansion" do
20
+
21
+ given_resource "config-with-key-expansion.yml", %{
22
+ var:
23
+ account_id: "123"
24
+ <(var.account_id)>: value
25
+ }
26
+
27
+ let(:config) { ConfigHound.load("config-with-key-expansion.yml", :expand_refs => true) }
28
+
29
+ it "expands key references" do
30
+ expect(config["123"]).to eq("value")
31
+ end
32
+
33
+ end
34
+
35
+ context "with key and value expansion" do
36
+
37
+ given_resource "config-with-key-and-value-expansion.yml", %{
38
+ var:
39
+ account_id: "123"
40
+ port: 5678
41
+ <(var.account_id)>: host:<(var.port)>
42
+ }
43
+ let(:config) { ConfigHound.load("config-with-key-and-value-expansion.yml", :expand_refs => true) }
44
+
45
+ it "expands key references" do
46
+ expect(config["123"]).to eq("host:5678")
47
+ end
48
+
49
+ end
50
+
19
51
  context "with overrides" do
20
52
 
21
53
  given_resource "overrides.yml", %{
@@ -20,6 +20,18 @@ describe ConfigHound, "formats" do
20
20
  )
21
21
  end
22
22
 
23
+ given_resource "s3://s3-test-bucket/config.yml?versionId=123456", %{
24
+ foo: 1
25
+ bar: 2
26
+ }
27
+
28
+ it "loads YAML from s3 with version id" do
29
+ expect(load("s3://s3-test-bucket/config.yml?versionId=123456")).to eq(
30
+ "foo" => 1,
31
+ "bar" => 2
32
+ )
33
+ end
34
+
23
35
  given_resource "config-with-aliases.yml", %{
24
36
  foo: &foo
25
37
  bar: 1
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require "open-uri"
2
+ require "uri"
3
+
1
4
  module GivenResource
2
5
 
3
6
  def inputs
@@ -10,7 +13,7 @@ module GivenResource
10
13
  end
11
14
  content = undent(content)
12
15
  before do
13
- allow_any_instance_of(ConfigHound::Resource).to receive(:open).with(path) do |_, _, &block|
16
+ allow(URI).to receive(:open).with(path) do |_, _, &block|
14
17
  block.call(StringIO.new(content.dup))
15
18
  end
16
19
  end
@@ -31,6 +34,7 @@ module GivenResource
31
34
  end
32
35
 
33
36
  RSpec.configure do |config|
37
+ config.warnings = true
34
38
 
35
39
  config.extend(GivenResource)
36
40
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config_hound
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-12 00:00:00.000000000 Z
11
+ date: 2023-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dig_rb
@@ -30,38 +30,38 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.7'
33
+ version: '2.2'
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: '1.7'
40
+ version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
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: '10.0'
55
- description:
54
+ version: '13.0'
55
+ description:
56
56
  email:
57
57
  - mdub@dogbiscuit.org
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".github/workflows/test.yaml"
62
63
  - ".gitignore"
63
64
  - ".rspec"
64
- - ".travis.yml"
65
65
  - Gemfile
66
66
  - LICENSE.txt
67
67
  - README.md
@@ -87,7 +87,7 @@ homepage: https://github.com/mdub/config_hound
87
87
  licenses:
88
88
  - MIT
89
89
  metadata: {}
90
- post_install_message:
90
+ post_install_message:
91
91
  rdoc_options: []
92
92
  require_paths:
93
93
  - lib
@@ -95,16 +95,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- version: '0'
98
+ version: '2.7'
99
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  requirements: []
105
- rubyforge_project:
106
- rubygems_version: 2.6.14.1
107
- signing_key:
105
+ rubygems_version: 3.3.7
106
+ signing_key:
108
107
  specification_version: 4
109
108
  summary: Sniffs out config, wherever it may be.
110
109
  test_files:
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2
4
- - 2.4
5
- - 2.5