ultra_settings 2.4.3 → 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: 506d4066499e83e25f6507f1911f788d2684946bdebd3832e2483fd30496284a
4
- data.tar.gz: 7c7b4a1b7728b24557ef1e4110a400b24fb0eef019a9cf16a8cdfdf62e8cf1de
3
+ metadata.gz: 0100a325a4565201a02667584d60b608a1fa0953c35a18c77ab014c205578853
4
+ data.tar.gz: 7728dd534db12acac88f7f9c23ee4cee76dddba40d7b89ba23f2873bcc873fe3
5
5
  SHA512:
6
- metadata.gz: e7d6236d8db95cf9e02c872c4ee6c65fc3a4da44981a8d7ae994ae4cb17def404271389ae467c0fcb7aa89a8b6221b4bce9bc5694496de051fe730104602bd76
7
- data.tar.gz: 2a5c5c97fb1144f3fef1cb2857322da5b090ab3e5e4ae84440a6384c212f8171d55123308e6b83fda121d07fed387ff0988a0deb8d65374c26e0ec7d2a3fb7da
6
+ metadata.gz: ae0580fb25bdad6baddec3ca0ba78bb506df187889ba976487280a850e931fbcb55d52684dfe06e46d38364432954ae87cb20e6c6fa7bcd530d7476bb9d7651e
7
+ data.tar.gz: 591b48efe616f8e288ecc1b5bdc1c116a2d4babcb0c32463eb5fe53ce1a7dffc739a762e46bdf54863e4f24dd5a245b47e515c64342e5c17916c76aab8638c93
data/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@ 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
+
13
+ ## 2.4.4
14
+
15
+ ### Changed
16
+
17
+ - Return true for `yaml_config_disabled?` if the configuration file has been set to nil.
18
+
7
19
  ## 2.4.3
8
20
 
9
21
  ### Fixed
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.3
1
+ 2.4.5
@@ -148,6 +148,7 @@ module UltraSettings
148
148
  # @param value [String, Pathname]
149
149
  # @return [void]
150
150
  def configuration_file=(value)
151
+ value = nil if value == false
151
152
  value = Pathname.new(value) if value.is_a?(String)
152
153
  @configuration_file = value
153
154
  end
@@ -157,6 +158,9 @@ module UltraSettings
157
158
  # @return [Pathname, nil]
158
159
  def configuration_file
159
160
  unless defined?(@configuration_file)
161
+ default_file = default_configuration_file
162
+ return nil if default_file.nil?
163
+
160
164
  @configuration_file = default_configuration_file
161
165
  end
162
166
  return nil? unless @configuration_file
@@ -210,7 +214,7 @@ module UltraSettings
210
214
  #
211
215
  # @return [Boolean]
212
216
  def yaml_config_disabled?
213
- get_inheritable_class_attribute(:@yaml_config_disabled, false)
217
+ get_inheritable_class_attribute(:@yaml_config_disabled, false) || configuration_file.nil?
214
218
  end
215
219
 
216
220
  # Set the environment variable delimiter used to construct the environment
@@ -382,6 +386,8 @@ module UltraSettings
382
386
  end
383
387
 
384
388
  def default_configuration_file
389
+ return nil if yaml_config_path.nil?
390
+
385
391
  path = Pathname.new(yaml_config_path)
386
392
  path.join(*"#{root_name}.yml".split("/"))
387
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.3
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