consult 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4545a86745cdd4600995f4a162cf9c3378ea61083b3670166e2e8e94a9e6103a
4
- data.tar.gz: f48258760913efbb7e44bf17c7b2ac14e4e38d9563c6cb1d4c3a94b7c7c37aed
3
+ metadata.gz: ceefd393d6806ded58ba8e26053b884ccb16be5621cfed34143b1117c621da40
4
+ data.tar.gz: a5b86a629c6c01295dc89504cc7bf37b60cba8b821df29991fe1ad2ea41d9af6
5
5
  SHA512:
6
- metadata.gz: 5fdb5ecc269d4ffd29fdef55fa315e7471089b8f68e897de6a2641415a5fb0f7bcdd56d05c7ccc7be0b58757076cd2b05f65727ebdc5c7efe32c9bfe33e36ec9
7
- data.tar.gz: 991eca37d6a392c21bab7ca620ae64608d4b6313e0048f376c84fc627234675fb79990d6c151a327c8bb53fa07b47937cb0f2782f0dd4df91762139eca6fc989
6
+ metadata.gz: 784828276c69a2f83f34a2169738f6053f4c035a3fe3b8a4b3925fed3dcb90f2a364d1e02032a1020f6e35cbbedee3eab4c833b444868d9fb9b9df2670a5df79
7
+ data.tar.gz: 1dc1fcb576c04a9a56ebd02d8af93f3e5ecf2bdf63037918cd915e7475b8bef00d901d504428dd8d8d1aba9b99c66dd020830465288d69df58ccfaa1a780f910
data/.circleci/config.yml CHANGED
@@ -7,7 +7,7 @@ jobs:
7
7
  type: string
8
8
 
9
9
  docker:
10
- - image: circleci/ruby:<< parameters.ruby_version >>
10
+ - image: cimg/ruby:<< parameters.ruby_version >>
11
11
  - image: consul:1.3.0
12
12
  - image: vault:0.11.3
13
13
  environment:
@@ -76,3 +76,4 @@ workflows:
76
76
  ruby_version:
77
77
  - '2.5'
78
78
  - '2.7'
79
+ - '3.1'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.5.3
1
+ 3.1.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  #### Unreleased
2
2
 
3
+ #### 0.11.0
4
+
5
+ * Enable support for Ruby 3.1 ([#36](https://github.com/veracross/consult/pull/36))
6
+ * Bump Diplomat version & better testing for default parameters ([#37](https://github.com/veracross/consult/pull/37) & [#39](https://github.com/veracross/consult/pull/39))
7
+ * Avoid loading Railtie if SKIP_CONSULT is truthy ([#40](https://github.com/veracross/consult/pull/40))
8
+
3
9
  #### 0.10.0
4
10
 
5
11
  * Switch from Travis to CircleCI, and set up testing for multiple Ruby versions ([#25](https://github.com/veracross/consult/pull/25) & [#34](https://github.com/veracross/consult/pull/34))
data/consult.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = ['consult']
25
25
  spec.require_paths = ['lib']
26
26
 
27
- spec.add_dependency 'diplomat', '~> 2.0.2'
27
+ spec.add_dependency 'diplomat', '~> 2.6'
28
28
  spec.add_dependency 'vault', '>= 0.10.0', '< 1.0.0'
29
29
 
30
30
  spec.add_development_dependency 'bundler'
data/lib/consult/cli.rb CHANGED
@@ -15,7 +15,7 @@ module Consult
15
15
 
16
16
  def parse(args = ARGV)
17
17
  @opts = parse_options(args)
18
- Consult.load @opts
18
+ Consult.load **@opts
19
19
  end
20
20
 
21
21
  def render
@@ -75,7 +75,7 @@ module Consult
75
75
 
76
76
  def consul_contents(location)
77
77
  [@config[location]].compact.flatten.map do |key|
78
- Diplomat::Kv.get(key, options: nil, not_found: :return, found: :return).force_encoding 'utf-8'
78
+ Diplomat::Kv.get(key, options: {}, not_found: :return, found: :return).force_encoding 'utf-8'
79
79
  end.join
80
80
  end
81
81
 
@@ -16,12 +16,12 @@ module Consult
16
16
  ############
17
17
  # Consul
18
18
  ############
19
- def service(key, scope: :all, options: nil, meta: nil)
19
+ def service(key, scope: :all, options: {}, meta: {})
20
20
  Diplomat::Service.get(key, scope, options, meta)
21
21
  end
22
22
 
23
23
  # Execute a prepared query
24
- def query(name_or_id, options: nil)
24
+ def query(name_or_id, options: {})
25
25
  Diplomat::Query.execute(name_or_id, options)
26
26
  end
27
27
 
@@ -30,7 +30,7 @@ module Consult
30
30
  query(*args)&.Nodes&.map { |node| node['Node'] }
31
31
  end
32
32
 
33
- def key(key, options: nil, not_found: :reject, found: :return)
33
+ def key(key, options: {}, not_found: :reject, found: :return)
34
34
  Diplomat::Kv.get(key, options, not_found, found)
35
35
  end
36
36
 
@@ -1,3 +1,3 @@
1
1
  module Consult
2
- VERSION = '0.10.0'
2
+ VERSION = '0.11.0'
3
3
  end
data/lib/consult.rb CHANGED
@@ -24,7 +24,15 @@ module Consult
24
24
  root directory: config_dir
25
25
  yaml = root.join('config', 'consult.yml')
26
26
 
27
- @all_config = yaml.exist? ? YAML.safe_load(ERB.new(yaml.read).result, [], [], true, symbolize_names: true).to_h : {}
27
+ @all_config = if yaml.exist?
28
+ if Gem::Version.new(YAML::VERSION) < Gem::Version.new('4.0')
29
+ YAML.safe_load(ERB.new(yaml.read).result, [], [], true, symbolize_names: true).to_h
30
+ else
31
+ YAML.safe_load(ERB.new(yaml.read).result, aliases: true, symbolize_names: true).to_h
32
+ end
33
+ end
34
+
35
+ @all_config ||= {}
28
36
 
29
37
  @config = @all_config[:shared].to_h.deep_merge @all_config[env&.to_sym].to_h
30
38
  @templates = @config[:templates]&.map { |name, config| Template.new(name, config.merge(verbose: verbose)) } || []
@@ -92,4 +100,6 @@ module Consult
92
100
  end
93
101
  end
94
102
 
95
- require 'consult/rails/engine' if defined?(Rails)
103
+ if defined?(Rails) && !%w[1 true].include?(ENV['SKIP_CONSULT'].to_s.downcase)
104
+ require 'consult/rails/engine'
105
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consult
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Fraser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diplomat
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.2
19
+ version: '2.6'
20
20
  type: :runtime
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: 2.0.2
26
+ version: '2.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: vault
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -209,8 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  requirements: []
212
- rubyforge_project:
213
- rubygems_version: 2.7.6
212
+ rubygems_version: 3.1.6
214
213
  signing_key:
215
214
  specification_version: 4
216
215
  summary: Manage consul/vault backed template files in Ruby.