ultra_settings 2.4.4 → 2.4.5

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: 05c73bd3709ee539db4def5c1d6f5e86def7fb9704b68ae52faacb4e66eec0a6
4
- data.tar.gz: 7dab6438fdd2faac932a1b308be3ea8462369c8f71c0dc9bb796787a51e6c0f7
3
+ metadata.gz: 0100a325a4565201a02667584d60b608a1fa0953c35a18c77ab014c205578853
4
+ data.tar.gz: 7728dd534db12acac88f7f9c23ee4cee76dddba40d7b89ba23f2873bcc873fe3
5
5
  SHA512:
6
- metadata.gz: 7e303425dd2663cf4237d07263b27085c34e4ddbf8e56cbe6f6acc85edef187f3a74192662aa9264d46f1c2fc9a99154de86e4d01247fd9bc92d8d6757be4c22
7
- data.tar.gz: 85fd0209d4ed5d7271fdd5d46c24957130f7f03b42132eaad74270d7c95faa7b8d66090deddd674aa176a2afe0629c48a8a2574ada8df1afae464503598055be
6
+ metadata.gz: ae0580fb25bdad6baddec3ca0ba78bb506df187889ba976487280a850e931fbcb55d52684dfe06e46d38364432954ae87cb20e6c6fa7bcd530d7476bb9d7651e
7
+ data.tar.gz: 591b48efe616f8e288ecc1b5bdc1c116a2d4babcb0c32463eb5fe53ce1a7dffc739a762e46bdf54863e4f24dd5a245b47e515c64342e5c17916c76aab8638c93
data/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 2.4.5
8
+
9
+ ### Fixed
10
+
11
+ - Add check for nil YAML config path to avoid error loading YAML file if the path is not set.
12
+
7
13
  ## 2.4.4
8
14
 
9
15
  ### Changed
data/README.md CHANGED
@@ -261,6 +261,16 @@ While for production, the values would be the combination of `production` and `s
261
261
 
262
262
  In a Rails application, the YAML environment will be set to the Rails environment and YAML files will be assumed to exist in the `config` directory.
263
263
 
264
+ If want to use configuration objects in code that is initialized with the Rails application before initializers are run, then you'll need to setup the configuration manually.
265
+
266
+ For instance, if you want to create a `DatabaseConfiguration` class that is used in the ERB code in `database.yml`, then you'll need to setup the configuration before the Rails application is initialized in `application.rb`.
267
+
268
+ ```ruby
269
+ UltraSettings.yaml_config_env = Rails.env
270
+ UltraSettings.yaml_config_path = __dir__
271
+ require_relative '../app/configurations/database_configuration'
272
+ ```
273
+
264
274
  ### Removing The Hierarchy
265
275
 
266
276
  If you prefer not to use the default hierarchy of environment variables, runtime settings, and YAML files, you can disable it. This allows you to explicitly define which data sources should be used for each field.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.4
1
+ 2.4.5
@@ -158,6 +158,9 @@ module UltraSettings
158
158
  # @return [Pathname, nil]
159
159
  def configuration_file
160
160
  unless defined?(@configuration_file)
161
+ default_file = default_configuration_file
162
+ return nil if default_file.nil?
163
+
161
164
  @configuration_file = default_configuration_file
162
165
  end
163
166
  return nil? unless @configuration_file
@@ -383,6 +386,8 @@ module UltraSettings
383
386
  end
384
387
 
385
388
  def default_configuration_file
389
+ return nil if yaml_config_path.nil?
390
+
386
391
  path = Pathname.new(yaml_config_path)
387
392
  path.join(*"#{root_name}.yml".split("/"))
388
393
  end
@@ -9,6 +9,7 @@ module UltraSettings
9
9
  config.ultra_settings = ActiveSupport::OrderedOptions.new
10
10
  config.ultra_settings.auto_load_directories ||= [File.join("app", "configurations")]
11
11
 
12
+ # initializer "ultra_settings.before_bootstrap", before: :bootstrap_hook do
12
13
  config.before_configuration do
13
14
  UltraSettings::Configuration.yaml_config_env ||= Rails.env
14
15
  UltraSettings::Configuration.yaml_config_path ||= Rails.root.join("config")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ultra_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.4
4
+ version: 2.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-05 00:00:00.000000000 Z
11
+ date: 2024-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler