confidante 0.24.0 → 0.28.0.pre.4

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: fe9a513f9fdcb08619d3986c004dcee9c02c3d5e78a2bae0a51495697d4d9810
4
- data.tar.gz: 89e336a3bc74d822bf53345f811fb8c55f016fc670f58560fdb87ced7e57ba48
3
+ metadata.gz: f8ac46c68d6bfd2a11cdf7f45c28bacb2f884fb376f6eb584083cc38d7be68d1
4
+ data.tar.gz: 549b7e47f1e9029c5d985ef3e12afab203a3a213922b0f265d59d280b7011842
5
5
  SHA512:
6
- metadata.gz: 8651168a0765fd5bb60d1d861d3889ff2b45a252e871e6656b8280cc6606329c9933356bbb309393106248c0e141e8b913e560a18db1404e6afa5d95b22d7e6b
7
- data.tar.gz: 43a13833566e56cdc0563af23793c0906ae75c1565544e27c51cb812d2d434c11f88fc3637f5de7a2471078d3ed7e060c419a51bb0d059fe9c4f27767b1c4863
6
+ metadata.gz: e807811a10780eaa47d1905ee289b27cd70de564b5c9219b3d4162f36c78d278a693f611c6e06ffb42d53ece2b2fa69cc24d24ce01488f87afd2c5064fd72f05
7
+ data.tar.gz: d2efc39f1d98d0493b0e88c40f4617a742b05da2a7363000ec02d7d39bd986c7e667ece9e5286c59187220c40b00f499e77d8ef9873880f1d5a480e71c523ee0
data/CODE_OF_CONDUCT.md CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at tobyclemson@gmail.com. All
58
+ reported by contacting the project team at maintainers@infrablocks.io. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify dependencies in lino.gemspec
data/Gemfile.lock CHANGED
@@ -1,118 +1,165 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- confidante (0.24.0)
4
+ confidante (0.28.0.pre.4)
5
5
  activesupport (>= 4)
6
- hiera (~> 3.3, >= 3.3.1)
7
- shikashi (~> 0.6)
6
+ hiera (>= 3.3, < 4)
7
+ shikashi (>= 0.6, < 1)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (6.0.3.1)
12
+ activesupport (6.1.3.2)
13
13
  concurrent-ruby (~> 1.0, >= 1.0.2)
14
- i18n (>= 0.7, < 2)
15
- minitest (~> 5.1)
16
- tzinfo (~> 1.1)
17
- zeitwerk (~> 2.2, >= 2.2.2)
14
+ i18n (>= 1.6, < 2)
15
+ minitest (>= 5.1)
16
+ tzinfo (~> 2.0)
17
+ zeitwerk (~> 2.3)
18
18
  addressable (2.7.0)
19
19
  public_suffix (>= 2.0.2, < 5.0)
20
+ ast (2.4.2)
20
21
  colored2 (3.1.2)
21
- concurrent-ruby (1.1.6)
22
- diff-lcs (1.3)
22
+ concurrent-ruby (1.1.8)
23
+ diff-lcs (1.4.4)
24
+ docile (1.4.0)
23
25
  evalhook (0.6.0)
24
26
  partialruby (~> 0.3)
25
27
  sexp_processor (~> 4.0)
26
- excon (0.73.0)
27
- faraday (1.0.1)
28
+ excon (0.82.0)
29
+ faraday (1.4.2)
30
+ faraday-em_http (~> 1.0)
31
+ faraday-em_synchrony (~> 1.0)
32
+ faraday-excon (~> 1.1)
33
+ faraday-net_http (~> 1.0)
34
+ faraday-net_http_persistent (~> 1.1)
28
35
  multipart-post (>= 1.2, < 3)
29
- gem-release (2.1.1)
36
+ ruby2_keywords (>= 0.0.4)
37
+ faraday-em_http (1.0.0)
38
+ faraday-em_synchrony (1.0.0)
39
+ faraday-excon (1.1.0)
40
+ faraday-net_http (1.0.1)
41
+ faraday-net_http_persistent (1.1.0)
42
+ gem-release (2.2.1)
30
43
  getsource (0.2.2)
31
44
  hamster (3.0.0)
32
45
  concurrent-ruby (~> 1.0)
33
- hiera (3.6.0)
34
- i18n (1.8.2)
46
+ hiera (3.7.0)
47
+ i18n (1.8.10)
35
48
  concurrent-ruby (~> 1.0)
36
- lino (1.5.0)
49
+ lino (3.0.0)
37
50
  hamster (~> 3.0)
38
51
  open4 (~> 1.3)
39
- minitest (5.14.1)
52
+ minitest (5.14.4)
40
53
  multipart-post (2.1.1)
41
- octokit (4.18.0)
54
+ octokit (4.21.0)
42
55
  faraday (>= 0.9)
43
56
  sawyer (~> 0.8.0, >= 0.5.3)
44
57
  open4 (1.3.4)
58
+ parallel (1.20.1)
59
+ parser (3.0.1.1)
60
+ ast (~> 2.4.1)
45
61
  partialruby (0.3.0)
46
62
  ruby2ruby (~> 2)
47
63
  ruby_parser (~> 3)
48
- public_suffix (4.0.5)
49
- rake (13.0.1)
50
- rake_circle_ci (0.7.0)
64
+ public_suffix (4.0.6)
65
+ rainbow (3.0.0)
66
+ rake (13.0.3)
67
+ rake_circle_ci (0.9.0)
51
68
  colored2 (~> 3.1)
52
69
  excon (~> 0.72)
53
70
  rake_factory (~> 0.23)
54
71
  sshkey (~> 2.0)
55
- rake_factory (0.27.0)
72
+ rake_factory (0.29.0)
56
73
  activesupport (>= 4)
57
74
  rake (~> 13.0)
58
- rake_github (0.5.0)
75
+ rake_github (0.7.0)
59
76
  colored2 (~> 3.1)
60
77
  octokit (~> 4.16)
61
78
  rake_factory (~> 0.23)
62
79
  sshkey (~> 2.0)
63
- rake_gpg (0.12.0)
80
+ rake_gpg (0.16.0)
64
81
  rake_factory (>= 0.23, < 1)
65
82
  ruby_gpg2 (>= 0.6, < 1)
66
- rake_ssh (0.4.0)
83
+ rake_ssh (0.6.0)
67
84
  colored2 (~> 3.1)
68
85
  rake_factory (~> 0.23)
69
86
  sshkey (~> 2.0)
70
- rspec (3.9.0)
71
- rspec-core (~> 3.9.0)
72
- rspec-expectations (~> 3.9.0)
73
- rspec-mocks (~> 3.9.0)
74
- rspec-core (3.9.2)
75
- rspec-support (~> 3.9.3)
76
- rspec-expectations (3.9.2)
87
+ regexp_parser (2.1.1)
88
+ rexml (3.2.5)
89
+ rspec (3.10.0)
90
+ rspec-core (~> 3.10.0)
91
+ rspec-expectations (~> 3.10.0)
92
+ rspec-mocks (~> 3.10.0)
93
+ rspec-core (3.10.1)
94
+ rspec-support (~> 3.10.0)
95
+ rspec-expectations (3.10.1)
77
96
  diff-lcs (>= 1.2.0, < 2.0)
78
- rspec-support (~> 3.9.0)
79
- rspec-mocks (3.9.1)
97
+ rspec-support (~> 3.10.0)
98
+ rspec-mocks (3.10.2)
80
99
  diff-lcs (>= 1.2.0, < 2.0)
81
- rspec-support (~> 3.9.0)
82
- rspec-support (3.9.3)
100
+ rspec-support (~> 3.10.0)
101
+ rspec-support (3.10.2)
102
+ rubocop (1.15.0)
103
+ parallel (~> 1.10)
104
+ parser (>= 3.0.0.0)
105
+ rainbow (>= 2.2.2, < 4.0)
106
+ regexp_parser (>= 1.8, < 3.0)
107
+ rexml
108
+ rubocop-ast (>= 1.5.0, < 2.0)
109
+ ruby-progressbar (~> 1.7)
110
+ unicode-display_width (>= 1.4.0, < 3.0)
111
+ rubocop-ast (1.7.0)
112
+ parser (>= 3.0.1.1)
113
+ rubocop-rake (0.5.1)
114
+ rubocop
115
+ rubocop-rspec (2.3.0)
116
+ rubocop (~> 1.0)
117
+ rubocop-ast (>= 1.1.0)
118
+ ruby-progressbar (1.11.0)
119
+ ruby2_keywords (0.0.4)
83
120
  ruby2ruby (2.4.4)
84
121
  ruby_parser (~> 3.1)
85
122
  sexp_processor (~> 4.6)
86
- ruby_gpg2 (0.6.0)
123
+ ruby_gpg2 (0.8.0)
87
124
  lino (>= 1.5)
88
- ruby_parser (3.14.2)
89
- sexp_processor (~> 4.9)
125
+ ruby_parser (3.16.0)
126
+ sexp_processor (~> 4.15, >= 4.15.1)
90
127
  sawyer (0.8.2)
91
128
  addressable (>= 2.3.5)
92
129
  faraday (> 0.8, < 2.0)
93
- sexp_processor (4.14.1)
130
+ sexp_processor (4.15.3)
94
131
  shikashi (0.6.0)
95
132
  evalhook (>= 0.6.0)
96
133
  getsource (>= 0.1.0)
134
+ simplecov (0.21.2)
135
+ docile (~> 1.1)
136
+ simplecov-html (~> 0.11)
137
+ simplecov_json_formatter (~> 0.1)
138
+ simplecov-html (0.12.3)
139
+ simplecov_json_formatter (0.1.3)
97
140
  sshkey (2.0.0)
98
- thread_safe (0.3.6)
99
- tzinfo (1.2.7)
100
- thread_safe (~> 0.1)
101
- zeitwerk (2.3.0)
141
+ tzinfo (2.0.4)
142
+ concurrent-ruby (~> 1.0)
143
+ unicode-display_width (2.0.0)
144
+ zeitwerk (2.4.2)
102
145
 
103
146
  PLATFORMS
104
147
  ruby
105
148
 
106
149
  DEPENDENCIES
107
- bundler (~> 2.0)
150
+ bundler
108
151
  confidante!
109
- gem-release (~> 2.0)
110
- rake (~> 13.0)
111
- rake_circle_ci (~> 0.3)
112
- rake_github (~> 0.3)
113
- rake_gpg (~> 0.12)
114
- rake_ssh (~> 0.2)
115
- rspec (~> 3.9)
152
+ gem-release
153
+ rake
154
+ rake_circle_ci
155
+ rake_github
156
+ rake_gpg
157
+ rake_ssh
158
+ rspec
159
+ rubocop
160
+ rubocop-rake
161
+ rubocop-rspec
162
+ simplecov
116
163
 
117
164
  BUNDLED WITH
118
- 2.2.3
165
+ 2.2.18
data/README.md CHANGED
@@ -71,7 +71,7 @@ openssl aes-256-cbc \
71
71
  ## Contributing
72
72
 
73
73
  Bug reports and pull requests are welcome on GitHub at
74
- https://github.com/tobyclemson/confidante. This project is intended to be a
74
+ https://github.com/infrablocks/confidante. This project is intended to be a
75
75
  safe, welcoming space for collaboration, and contributors are expected to adhere
76
76
  to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
77
77
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require 'rake_circle_ci'
3
5
  require 'rake_github'
@@ -5,13 +7,16 @@ require 'rake_ssh'
5
7
  require 'rake_gpg'
6
8
  require 'securerandom'
7
9
  require 'rspec/core/rake_task'
10
+ require 'rubocop/rake_task'
8
11
 
9
- task :default => :spec
10
-
11
- RSpec::Core::RakeTask.new(:spec)
12
+ task default: %i[
13
+ library:fix
14
+ test:unit
15
+ ]
12
16
 
13
17
  namespace :encryption do
14
18
  namespace :passphrase do
19
+ desc 'Generate encryption passphrase for CI GPG key'
15
20
  task :generate do
16
21
  File.open('config/secrets/ci/encryption.passphrase', 'w') do |f|
17
22
  f.write(SecureRandom.base64(36))
@@ -23,81 +28,100 @@ end
23
28
  namespace :keys do
24
29
  namespace :deploy do
25
30
  RakeSSH.define_key_tasks(
26
- path: 'config/secrets/ci/',
27
- comment: 'maintainers@infrablocks.io')
31
+ path: 'config/secrets/ci/',
32
+ comment: 'maintainers@infrablocks.io'
33
+ )
28
34
  end
29
35
 
30
36
  namespace :gpg do
31
37
  RakeGPG.define_generate_key_task(
32
- output_directory: 'config/secrets/ci',
33
- name_prefix: 'gpg',
34
- owner_name: 'InfraBlocks Maintainers',
35
- owner_email: 'maintainers@infrablocks.io',
36
- owner_comment: 'confidante CI Key')
38
+ output_directory: 'config/secrets/ci',
39
+ name_prefix: 'gpg',
40
+ owner_name: 'InfraBlocks Maintainers',
41
+ owner_email: 'maintainers@infrablocks.io',
42
+ owner_comment: 'confidante CI Key'
43
+ )
37
44
  end
38
45
  end
39
46
 
47
+ RuboCop::RakeTask.new
48
+
49
+ namespace :library do
50
+ desc 'Run all checks of the library'
51
+ task check: [:rubocop]
52
+
53
+ desc 'Attempt to automatically fix issues with the library'
54
+ task fix: [:'rubocop:auto_correct']
55
+ end
56
+
57
+ namespace :test do
58
+ RSpec::Core::RakeTask.new(:unit)
59
+ end
60
+
40
61
  RakeCircleCI.define_project_tasks(
41
- namespace: :circle_ci,
42
- project_slug: 'github/infrablocks/confidante'
62
+ namespace: :circle_ci,
63
+ project_slug: 'github/infrablocks/confidante'
43
64
  ) do |t|
44
65
  circle_ci_config =
45
- YAML.load_file('config/secrets/circle_ci/config.yaml')
66
+ YAML.load_file('config/secrets/circle_ci/config.yaml')
46
67
 
47
- t.api_token = circle_ci_config["circle_ci_api_token"]
68
+ t.api_token = circle_ci_config['circle_ci_api_token']
48
69
  t.environment_variables = {
49
- ENCRYPTION_PASSPHRASE:
50
- File.read('config/secrets/ci/encryption.passphrase')
51
- .chomp
70
+ ENCRYPTION_PASSPHRASE:
71
+ File.read('config/secrets/ci/encryption.passphrase')
72
+ .chomp
52
73
  }
74
+ t.checkout_keys = []
53
75
  t.ssh_keys = [
54
- {
55
- hostname: "github.com",
56
- private_key: File.read('config/secrets/ci/ssh.private')
57
- }
76
+ {
77
+ hostname: 'github.com',
78
+ private_key: File.read('config/secrets/ci/ssh.private')
79
+ }
58
80
  ]
59
81
  end
60
82
 
61
83
  RakeGithub.define_repository_tasks(
62
- namespace: :github,
63
- repository: 'infrablocks/confidante',
84
+ namespace: :github,
85
+ repository: 'infrablocks/confidante'
64
86
  ) do |t|
65
87
  github_config =
66
- YAML.load_file('config/secrets/github/config.yaml')
88
+ YAML.load_file('config/secrets/github/config.yaml')
67
89
 
68
- t.access_token = github_config["github_personal_access_token"]
90
+ t.access_token = github_config['github_personal_access_token']
69
91
  t.deploy_keys = [
70
- {
71
- title: 'CircleCI',
72
- public_key: File.read('config/secrets/ci/ssh.public')
73
- }
92
+ {
93
+ title: 'CircleCI',
94
+ public_key: File.read('config/secrets/ci/ssh.public')
95
+ }
74
96
  ]
75
97
  end
76
98
 
77
99
  namespace :pipeline do
78
- task :prepare => [
79
- :'circle_ci:project:follow',
80
- :'circle_ci:env_vars:ensure',
81
- :'circle_ci:ssh_keys:ensure',
82
- :'github:deploy_keys:ensure'
100
+ desc 'Prepare CircleCI Pipeline'
101
+ task prepare: %i[
102
+ circle_ci:project:follow
103
+ circle_ci:env_vars:ensure
104
+ circle_ci:checkout_keys:ensure
105
+ circle_ci:ssh_keys:ensure
106
+ github:deploy_keys:ensure
83
107
  ]
84
108
  end
85
109
 
86
110
  namespace :version do
87
- desc "Bump version for specified type (pre, major, minor, patch)"
111
+ desc 'Bump version for specified type (pre, major, minor, patch)'
88
112
  task :bump, [:type] do |_, args|
89
113
  bump_version_for(args.type)
90
114
  end
91
115
  end
92
116
 
93
- desc "Release gem"
117
+ desc 'Release gem'
94
118
  task :release do
95
- sh "gem release --tag --push"
119
+ sh 'gem release --tag --push'
96
120
  end
97
121
 
98
122
  def bump_version_for(version_type)
99
- sh "gem bump --version #{version_type} " +
100
- "&& bundle install " +
101
- "&& export LAST_MESSAGE=\"$(git log -1 --pretty=%B)\" " +
102
- "&& git commit -a --amend -m \"${LAST_MESSAGE} [ci skip]\""
123
+ sh "gem bump --version #{version_type} " \
124
+ '&& bundle install ' \
125
+ '&& export LAST_MESSAGE="$(git log -1 --pretty=%B)" ' \
126
+ '&& git commit -a --amend -m "${LAST_MESSAGE} [ci skip]"'
103
127
  end
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'confidante'
data/confidante.gemspec CHANGED
@@ -1,25 +1,36 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'confidante/version'
5
6
  require 'date'
6
7
 
8
+ files = %w[
9
+ bin
10
+ lib
11
+ CODE_OF_CONDUCT.md
12
+ confidante.gemspec
13
+ Gemfile
14
+ LICENSE.txt
15
+ Rakefile
16
+ README.md
17
+ ]
18
+
7
19
  Gem::Specification.new do |spec|
8
20
  spec.name = 'confidante'
9
21
  spec.version = Confidante::VERSION
10
- spec.authors = ['Toby Clemson']
11
- spec.email = ['tobyclemson@gmail.com']
22
+ spec.authors = ['InfraBlocks Maintainers']
23
+ spec.email = ['maintainers@infrablocks.io']
12
24
 
13
- spec.date = Date.today.to_s
14
25
  spec.summary = 'A configuration engine over hiera.'
15
26
  spec.description =
16
- 'A configuration engine combining environment variables, programmatic ' +
17
- 'overrides and the power of hiera.'
27
+ 'A configuration engine combining environment variables, programmatic ' \
28
+ 'overrides and the power of hiera.'
18
29
  spec.homepage = 'https://github.com/infrablocks/confidante'
19
30
  spec.license = 'MIT'
20
31
 
21
32
  spec.files = `git ls-files -z`.split("\x0").select do |f|
22
- f.match(%r{^(bin|lib|CODE_OF_CONDUCT\.md|confidante\.gemspec|Gemfile|LICENSE\.txt|Rakefile|README\.md)})
33
+ f.match(/^(#{files.map { |g| Regexp.escape(g) }.join('|')})/)
23
34
  end
24
35
  spec.bindir = 'exe'
25
36
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -27,16 +38,20 @@ Gem::Specification.new do |spec|
27
38
 
28
39
  spec.required_ruby_version = '>= 2.6.0'
29
40
 
30
- spec.add_dependency 'hiera', '~> 3.3', '>= 3.3.1'
31
41
  spec.add_dependency 'activesupport', '>= 4'
32
- spec.add_dependency 'shikashi', '~> 0.6'
33
-
34
- spec.add_development_dependency 'bundler', '~> 2.0'
35
- spec.add_development_dependency 'rake', '~> 13.0'
36
- spec.add_development_dependency 'rake_circle_ci', '~> 0.3'
37
- spec.add_development_dependency 'rake_github', '~> 0.3'
38
- spec.add_development_dependency 'rake_ssh', '~> 0.2'
39
- spec.add_development_dependency 'rake_gpg', '~> 0.12'
40
- spec.add_development_dependency 'rspec', '~> 3.9'
41
- spec.add_development_dependency 'gem-release', '~> 2.0'
42
+ spec.add_dependency 'hiera', '>= 3.3', '< 4'
43
+ spec.add_dependency 'shikashi', '>= 0.6', '< 1'
44
+
45
+ spec.add_development_dependency 'bundler'
46
+ spec.add_development_dependency 'gem-release'
47
+ spec.add_development_dependency 'rake'
48
+ spec.add_development_dependency 'rake_circle_ci'
49
+ spec.add_development_dependency 'rake_github'
50
+ spec.add_development_dependency 'rake_gpg'
51
+ spec.add_development_dependency 'rake_ssh'
52
+ spec.add_development_dependency 'rspec'
53
+ spec.add_development_dependency 'rubocop'
54
+ spec.add_development_dependency 'rubocop-rake'
55
+ spec.add_development_dependency 'rubocop-rspec'
56
+ spec.add_development_dependency 'simplecov'
42
57
  end
data/lib/confidante.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'confidante/version'
2
4
  require_relative 'confidante/converters'
3
5
  require_relative 'confidante/configuration'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hiera'
2
4
  require 'active_support'
3
5
  require 'active_support/core_ext/hash/keys'
@@ -7,50 +9,62 @@ require_relative 'converters'
7
9
  module Confidante
8
10
  class Configuration
9
11
  def initialize(opts = {})
10
- options = {
11
- overrides: {},
12
- scope: {},
13
- }.merge(opts.to_options)
14
-
15
- unless options[:hiera]
16
- options[:hiera] = Hiera.new(config: 'config/hiera.yaml')
17
- end
18
-
19
- unless options[:converters]
20
- options[:converters] =
21
- [Confidante::Converters::EvaluatingConverter.new]
22
- end
12
+ options = opts.to_options
23
13
 
24
- @overrides = options[:overrides]
25
- @scope = options[:scope]
26
- @hiera = options[:hiera]
27
- @converters = options[:converters]
14
+ @overrides = default_overrides(options[:overrides])
15
+ @scope = default_scope(options[:scope])
16
+ @hiera = default_hiera(options[:hiera])
17
+ @converters = default_converters(options[:converters])
28
18
  end
29
19
 
30
20
  def for_overrides(overrides)
31
21
  Configuration.new(
32
- overrides: overrides,
33
- scope: @scope,
34
- hiera: @hiera,
35
- converters: @converters)
22
+ overrides: overrides,
23
+ scope: @scope,
24
+ hiera: @hiera,
25
+ converters: @converters
26
+ )
36
27
  end
37
28
 
38
29
  def for_scope(scope)
39
30
  Configuration.new(
40
- overrides: @overrides,
41
- scope: scope,
42
- hiera: @hiera,
43
- converters: @converters)
31
+ overrides: @overrides,
32
+ scope: scope,
33
+ hiera: @hiera,
34
+ converters: @converters
35
+ )
44
36
  end
45
37
 
46
- def method_missing(method, *args, &block)
38
+ def method_missing(method, *_args)
47
39
  scope =
48
- {'cwd' => Dir.pwd}
49
- .merge(@scope.stringify_keys)
50
- .merge({'overrides' => @overrides.to_h.stringify_keys})
40
+ { 'cwd' => Dir.pwd }
41
+ .merge(@scope.stringify_keys)
42
+ .merge({ 'overrides' => @overrides.to_h.stringify_keys })
51
43
  @converters.inject(@hiera.lookup(method.to_s, nil, scope)) do |v, c|
52
44
  c.convert(v)
53
45
  end
54
46
  end
47
+
48
+ def respond_to_missing?(_method_name, _include_private = false)
49
+ true
50
+ end
51
+
52
+ private
53
+
54
+ def default_overrides(overrides)
55
+ overrides || {}
56
+ end
57
+
58
+ def default_scope(scope)
59
+ scope || {}
60
+ end
61
+
62
+ def default_hiera(hiera)
63
+ hiera || Hiera.new(config: 'config/hiera.yaml')
64
+ end
65
+
66
+ def default_converters(converters)
67
+ converters || [Confidante::Converters::EvaluatingConverter.new]
68
+ end
55
69
  end
56
- end
70
+ end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'converters/evaluating_converter'
2
4
 
3
5
  module Confidante
4
6
  module Converters
5
7
  end
6
- end
8
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'shikashi'
2
4
 
3
5
  module Confidante
@@ -35,7 +37,7 @@ module Confidante
35
37
  if thing =~ /^[\[,{]/
36
38
  begin
37
39
  @sandbox.run(@privileges, thing)
38
- rescue Exception
40
+ rescue StandardError
39
41
  thing
40
42
  end
41
43
  else
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Confidante
2
- VERSION = '0.24.0'
4
+ VERSION = '0.28.0.pre.4'
3
5
  end
@@ -1,20 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hiera'
2
4
 
3
5
  class Hiera
4
6
  module Backend
7
+ # rubocop:disable Naming/ClassAndModuleCamelCase
5
8
  class Env_backend
6
9
  def initialize
7
10
  Hiera.debug('Hiera environment backend starting')
8
11
  end
9
12
 
10
- def lookup(key, scope, order_override, resolution_type, context)
13
+ def lookup(key, scope, _order_override, resolution_type, _context)
11
14
  Hiera.debug(
12
- "Looking up #{key} in environment backend with #{resolution_type}")
15
+ "Looking up #{key} in environment backend with #{resolution_type}"
16
+ )
13
17
 
14
18
  Backend.parse_answer(
15
- ENV[key.to_s.upcase] || throw(:no_such_key),
16
- scope)
19
+ ENV[key.to_s.upcase] || throw(:no_such_key),
20
+ scope
21
+ )
17
22
  end
18
23
  end
24
+ # rubocop:enable Naming/ClassAndModuleCamelCase
19
25
  end
20
- end
26
+ end
@@ -1,15 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'hiera'
2
4
 
3
5
  class Hiera
4
6
  module Backend
7
+ # rubocop:disable Naming/ClassAndModuleCamelCase
5
8
  class Overrides_backend
6
9
  def initialize
7
10
  Hiera.debug('Hiera overrides backend starting')
8
11
  end
9
12
 
10
- def lookup(key, scope, order_override, resolution_type, context)
13
+ def lookup(key, scope, _order_override, resolution_type, _context)
11
14
  Hiera.debug(
12
- "Looking up #{key} in overrides backend with #{resolution_type}")
15
+ "Looking up #{key} in overrides backend with #{resolution_type}"
16
+ )
13
17
 
14
18
  overrides = scope && scope['overrides']
15
19
  Hiera.debug("Found overrides: #{overrides}")
@@ -22,5 +26,6 @@ class Hiera
22
26
  Backend.parse_answer(override || throw(:no_such_key), scope)
23
27
  end
24
28
  end
29
+ # rubocop:enable Naming/ClassAndModuleCamelCase
25
30
  end
26
- end
31
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'shikashi'
2
4
 
3
5
  module ShikashiExtensions
metadata CHANGED
@@ -1,40 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confidante
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.24.0
4
+ version: 0.28.0.pre.4
5
5
  platform: ruby
6
6
  authors:
7
- - Toby Clemson
7
+ - InfraBlocks Maintainers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-29 00:00:00.000000000 Z
11
+ date: 2021-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: hiera
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '3.3'
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
- version: 3.3.1
19
+ version: '4'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '3.3'
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
- version: 3.3.1
26
+ version: '4'
33
27
  - !ruby/object:Gem::Dependency
34
- name: activesupport
28
+ name: hiera
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
31
  - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '3.3'
34
+ - - "<"
38
35
  - !ruby/object:Gem::Version
39
36
  version: '4'
40
37
  type: :runtime
@@ -42,138 +39,203 @@ dependencies:
42
39
  version_requirements: !ruby/object:Gem::Requirement
43
40
  requirements:
44
41
  - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '3.3'
44
+ - - "<"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '4'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: shikashi
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0.6'
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '1'
54
57
  type: :runtime
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
57
60
  requirements:
58
- - - "~>"
61
+ - - ">="
59
62
  - !ruby/object:Gem::Version
60
63
  version: '0.6'
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '1'
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: bundler
63
69
  requirement: !ruby/object:Gem::Requirement
64
70
  requirements:
65
- - - "~>"
71
+ - - ">="
66
72
  - !ruby/object:Gem::Version
67
- version: '2.0'
73
+ version: '0'
68
74
  type: :development
69
75
  prerelease: false
70
76
  version_requirements: !ruby/object:Gem::Requirement
71
77
  requirements:
72
- - - "~>"
78
+ - - ">="
73
79
  - !ruby/object:Gem::Version
74
- version: '2.0'
80
+ version: '0'
81
+ - !ruby/object:Gem::Dependency
82
+ name: gem-release
83
+ requirement: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
75
95
  - !ruby/object:Gem::Dependency
76
96
  name: rake
77
97
  requirement: !ruby/object:Gem::Requirement
78
98
  requirements:
79
- - - "~>"
99
+ - - ">="
80
100
  - !ruby/object:Gem::Version
81
- version: '13.0'
101
+ version: '0'
82
102
  type: :development
83
103
  prerelease: false
84
104
  version_requirements: !ruby/object:Gem::Requirement
85
105
  requirements:
86
- - - "~>"
106
+ - - ">="
87
107
  - !ruby/object:Gem::Version
88
- version: '13.0'
108
+ version: '0'
89
109
  - !ruby/object:Gem::Dependency
90
110
  name: rake_circle_ci
91
111
  requirement: !ruby/object:Gem::Requirement
92
112
  requirements:
93
- - - "~>"
113
+ - - ">="
94
114
  - !ruby/object:Gem::Version
95
- version: '0.3'
115
+ version: '0'
96
116
  type: :development
97
117
  prerelease: false
98
118
  version_requirements: !ruby/object:Gem::Requirement
99
119
  requirements:
100
- - - "~>"
120
+ - - ">="
101
121
  - !ruby/object:Gem::Version
102
- version: '0.3'
122
+ version: '0'
103
123
  - !ruby/object:Gem::Dependency
104
124
  name: rake_github
105
125
  requirement: !ruby/object:Gem::Requirement
106
126
  requirements:
107
- - - "~>"
127
+ - - ">="
108
128
  - !ruby/object:Gem::Version
109
- version: '0.3'
129
+ version: '0'
110
130
  type: :development
111
131
  prerelease: false
112
132
  version_requirements: !ruby/object:Gem::Requirement
113
133
  requirements:
114
- - - "~>"
134
+ - - ">="
115
135
  - !ruby/object:Gem::Version
116
- version: '0.3'
136
+ version: '0'
117
137
  - !ruby/object:Gem::Dependency
118
- name: rake_ssh
138
+ name: rake_gpg
119
139
  requirement: !ruby/object:Gem::Requirement
120
140
  requirements:
121
- - - "~>"
141
+ - - ">="
122
142
  - !ruby/object:Gem::Version
123
- version: '0.2'
143
+ version: '0'
124
144
  type: :development
125
145
  prerelease: false
126
146
  version_requirements: !ruby/object:Gem::Requirement
127
147
  requirements:
128
- - - "~>"
148
+ - - ">="
129
149
  - !ruby/object:Gem::Version
130
- version: '0.2'
150
+ version: '0'
131
151
  - !ruby/object:Gem::Dependency
132
- name: rake_gpg
152
+ name: rake_ssh
133
153
  requirement: !ruby/object:Gem::Requirement
134
154
  requirements:
135
- - - "~>"
155
+ - - ">="
136
156
  - !ruby/object:Gem::Version
137
- version: '0.12'
157
+ version: '0'
138
158
  type: :development
139
159
  prerelease: false
140
160
  version_requirements: !ruby/object:Gem::Requirement
141
161
  requirements:
142
- - - "~>"
162
+ - - ">="
143
163
  - !ruby/object:Gem::Version
144
- version: '0.12'
164
+ version: '0'
145
165
  - !ruby/object:Gem::Dependency
146
166
  name: rspec
147
167
  requirement: !ruby/object:Gem::Requirement
148
168
  requirements:
149
- - - "~>"
169
+ - - ">="
150
170
  - !ruby/object:Gem::Version
151
- version: '3.9'
171
+ version: '0'
152
172
  type: :development
153
173
  prerelease: false
154
174
  version_requirements: !ruby/object:Gem::Requirement
155
175
  requirements:
156
- - - "~>"
176
+ - - ">="
157
177
  - !ruby/object:Gem::Version
158
- version: '3.9'
178
+ version: '0'
159
179
  - !ruby/object:Gem::Dependency
160
- name: gem-release
180
+ name: rubocop
181
+ requirement: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ type: :development
187
+ prerelease: false
188
+ version_requirements: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0'
193
+ - !ruby/object:Gem::Dependency
194
+ name: rubocop-rake
195
+ requirement: !ruby/object:Gem::Requirement
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ type: :development
201
+ prerelease: false
202
+ version_requirements: !ruby/object:Gem::Requirement
203
+ requirements:
204
+ - - ">="
205
+ - !ruby/object:Gem::Version
206
+ version: '0'
207
+ - !ruby/object:Gem::Dependency
208
+ name: rubocop-rspec
161
209
  requirement: !ruby/object:Gem::Requirement
162
210
  requirements:
163
- - - "~>"
211
+ - - ">="
164
212
  - !ruby/object:Gem::Version
165
- version: '2.0'
213
+ version: '0'
166
214
  type: :development
167
215
  prerelease: false
168
216
  version_requirements: !ruby/object:Gem::Requirement
169
217
  requirements:
170
- - - "~>"
218
+ - - ">="
171
219
  - !ruby/object:Gem::Version
172
- version: '2.0'
220
+ version: '0'
221
+ - !ruby/object:Gem::Dependency
222
+ name: simplecov
223
+ requirement: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - ">="
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ type: :development
229
+ prerelease: false
230
+ version_requirements: !ruby/object:Gem::Requirement
231
+ requirements:
232
+ - - ">="
233
+ - !ruby/object:Gem::Version
234
+ version: '0'
173
235
  description: A configuration engine combining environment variables, programmatic
174
236
  overrides and the power of hiera.
175
237
  email:
176
- - tobyclemson@gmail.com
238
+ - maintainers@infrablocks.io
177
239
  executables: []
178
240
  extensions: []
179
241
  extra_rdoc_files: []
@@ -210,9 +272,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
210
272
  version: 2.6.0
211
273
  required_rubygems_version: !ruby/object:Gem::Requirement
212
274
  requirements:
213
- - - ">="
275
+ - - ">"
214
276
  - !ruby/object:Gem::Version
215
- version: '0'
277
+ version: 1.3.1
216
278
  requirements: []
217
279
  rubygems_version: 3.0.1
218
280
  signing_key: