ravioli 0.1.6 → 0.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: a0f1dc00885f0dfdf291b2e81d158f093808d5200c062ebec79a534332b88f9b
4
- data.tar.gz: 6cf7a6e99487f216c3ca1ca0de08d57e7b2b0b2b7a2a5b69c7a23ee58912297b
3
+ metadata.gz: db780ea4e1fbb555cd42fd3c40f9102a18459a35d917cc214c998372b9599425
4
+ data.tar.gz: f4f7aa3bcd938fc48127be91f686263019e64728530e0591f687f465f2c63384
5
5
  SHA512:
6
- metadata.gz: 32c99eb0bd607e0ea8a700397edf49db62079b03c5e54684e4f53302abafdbbb368a0cfc014ccffd2e67f2a2beff2b6110c65cda437c620267be3af8e0389587
7
- data.tar.gz: aa552b5b5f826d14fb483b9af2c56de0003fca8d7500dcc97ba842568c91be7b01dfe77bea53ef5775b278ca338913a855a08d0c5a84fb8b4f1a663ea9aa5ee9
6
+ metadata.gz: 2f6ddf167319edf2337b0f52d4bcf3211c7aaa5062404b834245ac31b0e1e1311ef45a992149b77c04050d6c4d94152d4556cab2f708f4f3706044725a4c2b0d
7
+ data.tar.gz: d9a6c2ea272073e80182318d8c112ea1a57f44ad85e352e560495c6a216a0f515bdc675c6f0e3a2f54a3a482177316b434989bfa3b191d4e7746186244eb4e67
@@ -99,6 +99,7 @@ module Ravioli
99
99
  load_credentials(
100
100
  key_path: "config/master.key",
101
101
  env_names: %w[master root],
102
+ quiet: true,
102
103
  )
103
104
 
104
105
  # Load any environment-specific configuration on top of it. Since Rails will try
@@ -107,6 +108,7 @@ module Ravioli
107
108
  "config/credentials/#{Rails.env}",
108
109
  key_path: "config/credentials/#{Rails.env}.key",
109
110
  env_names: ["master"],
111
+ quiet: true,
110
112
  )
111
113
 
112
114
  # Apply staging configuration on top of THAT, if need be
@@ -115,6 +117,7 @@ module Ravioli
115
117
  "config/credentials/staging",
116
118
  env_names: %w[staging master],
117
119
  key_path: "config/credentials/staging.key",
120
+ quiet: true,
118
121
  )
119
122
  end
120
123
  end
@@ -145,11 +148,11 @@ module Ravioli
145
148
  end
146
149
 
147
150
  # Load secure credentials using a key either from a file or the ENV
148
- def load_credentials(path = "credentials", key_path: path, env_names: path.split("/").last)
151
+ def load_credentials(path = "credentials", key_path: path, env_names: path.split("/").last, quiet: false)
149
152
  error = nil
150
153
  env_names = Array(env_names).map { |env_name| parse_env_name(env_name) }
151
154
  env_names.each do |env_name|
152
- credentials = parse_credentials(path, env_name: env_name, key_path: key_path)
155
+ credentials = parse_credentials(path, env_name: env_name, key_path: key_path, quiet: quiet)
153
156
  if credentials.present?
154
157
  configuration.append(credentials)
155
158
  return credentials
@@ -262,14 +265,14 @@ module Ravioli
262
265
  env_name.match?(/^RAILS_/) ? env_name : "RAILS_#{env_name.upcase}_KEY"
263
266
  end
264
267
 
265
- def parse_credentials(path, key_path: path, env_name: path.split("/").last)
268
+ def parse_credentials(path, key_path: path, env_name: path.split("/").last, quiet: false)
266
269
  @current_credentials = path
267
270
  env_name = parse_env_name(env_name)
268
271
  key_path = path_to_config_file_path(key_path, extnames: "key", quiet: true)
269
272
  options = {key_path: key_path.to_s}
270
273
  options[:env_key] = ENV[env_name].present? ? env_name : "__RAVIOLI__#{SecureRandom.hex(6)}"
271
274
 
272
- path = path_to_config_file_path(path, extnames: "yml.enc")
275
+ path = path_to_config_file_path(path, extnames: "yml.enc", quiet: quiet)
273
276
  (Rails.application.encrypted(path, **options)&.config || {}).tap do
274
277
  @current_credentials = nil
275
278
  end
@@ -92,9 +92,13 @@ module Ravioli
92
92
  # rubocop:disable Style/MethodMissingSuper
93
93
  # rubocop:disable Style/MissingRespondToMissing
94
94
  def method_missing(method, *args, &block)
95
+ return super unless args.empty?
96
+
95
97
  # Return proper booleans from query methods
96
- return send(method.to_s.chomp("?")).present? if args.empty? && method.to_s.ends_with?("?")
97
- super
98
+ return send(method.to_s.chomp("?")).present? if method.to_s.ends_with?("?")
99
+
100
+ # Try to find a matching ENV key
101
+ fetch_env_key_for(method) { super(method, *args, &block) }
98
102
  end
99
103
  # rubocop:enable Style/MissingRespondToMissing
100
104
  # rubocop:enable Style/MethodMissingSuper
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ravioli
4
- VERSION = "0.1.6"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ravioli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flip Sasser
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-11 00:00:00.000000000 Z
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '6.0'
20
- - - ">="
19
+ version: '7.0'
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: 6.0.3.1
22
+ version: '7.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '6.0'
30
- - - ">="
29
+ version: '7.0'
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: 6.0.3.1
32
+ version: '7.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: guard
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +92,20 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: '6'
95
+ version: '7'
96
+ - - "<"
97
+ - !ruby/object:Gem::Version
98
+ version: '7.1'
96
99
  type: :development
97
100
  prerelease: false
98
101
  version_requirements: !ruby/object:Gem::Requirement
99
102
  requirements:
100
103
  - - "~>"
101
104
  - !ruby/object:Gem::Version
102
- version: '6'
105
+ version: '7'
106
+ - - "<"
107
+ - !ruby/object:Gem::Version
108
+ version: '7.1'
103
109
  - !ruby/object:Gem::Dependency
104
110
  name: rspec
105
111
  requirement: !ruby/object:Gem::Requirement
@@ -294,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
294
300
  - !ruby/object:Gem::Version
295
301
  version: '0'
296
302
  requirements: []
297
- rubygems_version: 3.2.3
303
+ rubygems_version: 3.1.6
298
304
  signing_key:
299
305
  specification_version: 4
300
306
  summary: Grab a fork and twist all your configuration spaghetti into a single, delicious