ravioli 0.1.8 → 0.2.1

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: e56ab68185fd144f082af7ecf11f18725ad872ffab08684d72c1bdff8a4d3672
4
- data.tar.gz: a304ea94ee11385fad332140b8b521ca1d2f3fb1ba71e8baf0c46a3e73054b89
3
+ metadata.gz: 319a36e063b7926065d63a7bad7284f2e997ecc161000cea2a0583c8fb5a68ce
4
+ data.tar.gz: cc085fc7660369588072aa59abd5aacfb4658ca2438c2f1544d26436bb17dcc0
5
5
  SHA512:
6
- metadata.gz: 307d77cdd70599a9c81d19eec6fc8206fb4a524a05e42d0a2a20edac514b4287be510be6708aefb5b18c61444f1e21e5816aca58355693c801a8fd627d00cd39
7
- data.tar.gz: 3436f7252744290a5cc7242d501c1751b79c0ca7e9266b5d39c5e11efbf57269c81822819e77d2760ad8957a85f83cdaec24c4a6ebdec4c790bd8e3154c4d0ab
6
+ metadata.gz: a4c13002dc24f8faab15a1d3d329bd626b93e8c2290744a01f5da7fd8fc71e2ebc1fa835886418070014603295c31f722dc8e88d6ead711115f18edbf1a6e373
7
+ data.tar.gz: 7cdf9515b01290c85f61ea7292daf7a63c8b870736455d2ffe0eba7e4f5749ecd1bdf331ac40206afa735a5cea774e8028f0b52f72b91c6e9fbc7359d5a870f3
@@ -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
@@ -137,19 +140,19 @@ module Ravioli
137
140
  end
138
141
 
139
142
  # Load a file either with a given path or by name (e.g. `config/whatever.yml` or `:whatever`)
140
- def load_file(path, options = {})
141
- config = parse_config_file(path, options)
143
+ def load_file(path, **options)
144
+ config = parse_config_file(path, **options)
142
145
  configuration.append(config) if config.present?
143
146
  rescue => error
144
147
  warn "Could not load config file #{path}", error
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
@@ -218,10 +221,9 @@ module Ravioli
218
221
  # rubocop:enable Style/MissingRespondToMissing
219
222
  # rubocop:enable Style/MethodMissingSuper
220
223
 
221
- def parse_config_file(path, options = {})
224
+ def parse_config_file(path, **options)
222
225
  # Stash a reference to the file we're parsing, so we can reload it later if it tries to use
223
226
  # the configuration object
224
- @current_path = path
225
227
  path = path_to_config_file_path(path)
226
228
 
227
229
  config = case path.extname.downcase
@@ -262,14 +264,14 @@ module Ravioli
262
264
  env_name.match?(/^RAILS_/) ? env_name : "RAILS_#{env_name.upcase}_KEY"
263
265
  end
264
266
 
265
- def parse_credentials(path, key_path: path, env_name: path.split("/").last)
267
+ def parse_credentials(path, key_path: path, env_name: path.split("/").last, quiet: false)
266
268
  @current_credentials = path
267
269
  env_name = parse_env_name(env_name)
268
270
  key_path = path_to_config_file_path(key_path, extnames: "key", quiet: true)
269
271
  options = {key_path: key_path.to_s}
270
272
  options[:env_key] = ENV[env_name].present? ? env_name : "__RAVIOLI__#{SecureRandom.hex(6)}"
271
273
 
272
- path = path_to_config_file_path(path, extnames: "yml.enc")
274
+ path = path_to_config_file_path(path, extnames: "yml.enc", quiet: quiet)
273
275
  (Rails.application.encrypted(path, **options)&.config || {}).tap do
274
276
  @current_credentials = nil
275
277
  end
@@ -283,7 +285,7 @@ module Ravioli
283
285
  def parse_yaml_config_file(path)
284
286
  contents = File.read(path)
285
287
  erb = ERB.new(contents).tap { |renderer| renderer.filename = path.to_s }
286
- YAML.safe_load(erb.result, [Symbol], aliases: true)
288
+ YAML.safe_load(erb.result, permitted_classes: [Symbol], aliases: true)
287
289
  end
288
290
 
289
291
  def path_to_config_file_path(path, extnames: EXTNAMES, quiet: false)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ravioli
4
- VERSION = "0.1.8"
4
+ VERSION = "0.2.1"
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.8
4
+ version: 0.2.1
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-05-04 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