anyway_config 2.4.1 → 2.4.2

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: dd660b7594fd85e041d4f00a4abbadef72085256e250df638cd239a3512db58c
4
- data.tar.gz: 94fa4463eaf4bf2d64cddba05ba1fac18e635f62ff89620f8a460c9cf0162535
3
+ metadata.gz: 822e17fb52f85c3f3066322083d1d2d30265bb58fbce6f50e88590ebea140ba4
4
+ data.tar.gz: c3cfd97af9fe5de290b8a378517b3f11a7a020e550929c7e3765e34411988246
5
5
  SHA512:
6
- metadata.gz: a1585d343611b50d1ca021dfbd2dfb49f92b8aad835c7f3c48aabeab4d5cc905877db4ef57a86e51b59c53f9b1192f69c7b58af4ec6c1b182447b146e19b4a3b
7
- data.tar.gz: 983a3079303037e6cda97057ad51ef2479000baa1e975d481a7c2f4cd2510605fd36227d3692b1a82f7a85db333a7909e5610515286e1c10adc0aeb0e11f3006
6
+ metadata.gz: 8fabe569de72f9a65d22a4a69a8b2b4cad0d97ef2dc62f245133352b142402ec2eb2b6f9492c713aceaac6518ca1453e1527855e6eaf5b4adb12ec0b2c2c1b50
7
+ data.tar.gz: 2fe2eef92329925f2626a501bd34c0081170e507f30214b9199710e509f208b0f3df7bfda163b304304e1fda58c8b4f757f527e748afd21708514877e4a1765c
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 2.4.2 (2023-06-07)
6
+
7
+ - Use ANYWAY_ENV as the current environment if defined. ([@palkan][])
8
+
9
+ It can be used to specify environment for configs independently of Rails environment.
10
+
5
11
  ## 2.4.1 (2023-05-04)
6
12
 
7
13
  - Add custom namespace support via `ejson_namespace` ([@bessey])
data/README.md CHANGED
@@ -367,6 +367,8 @@ development:
367
367
  port: 3000
368
368
  ```
369
369
 
370
+ **NOTE:** You can override the environment name for configuration files via the `ANYWAY_ENV` environment variable or by setting it explicitly in the code: `Anyway::Settings.current_environment = "some_other_env"`.
371
+
370
372
  ### Multi-env configuration
371
373
 
372
374
  _⚡️ This feature will be turned on by default in the future releases. You can turn it on now via `config.anyway_config.future.use :unwrap_known_environments`._
@@ -559,6 +561,8 @@ If you want to enable this feature you must specify `Anyway::Settings.current_en
559
561
  Anyway::Settings.current_environment = "development"
560
562
  ```
561
563
 
564
+ You can also specify the `ANYWAY_ENV=development` environment variable to set the current environment for configuration.
565
+
562
566
  YAML files should be in this format:
563
567
 
564
568
  ```yml
@@ -96,8 +96,11 @@ module Anyway
96
96
  end
97
97
  end
98
98
 
99
+ # By default, use ANYWAY_ENV
100
+ self.current_environment = ENV["ANYWAY_ENV"]
101
+
99
102
  # By default, use local files only in development (that's the purpose if the local files)
100
- self.use_local_files = (ENV["RACK_ENV"] == "development" || ENV["RAILS_ENV"] == "development")
103
+ self.use_local_files = (ENV["ANYWAY_ENV"] == "development" || ENV["RACK_ENV"] == "development" || ENV["RAILS_ENV"] == "development")
101
104
 
102
105
  # By default, consider configs are stored in the ./config folder
103
106
  self.default_config_path = ->(name) { "./config/#{name}.yml" }
@@ -66,7 +66,7 @@ module Anyway
66
66
  end
67
67
 
68
68
  def current_environment
69
- ::Rails.env.to_s
69
+ @current_environment || ::Rails.env.to_s
70
70
  end
71
71
 
72
72
  def app_root
@@ -76,6 +76,7 @@ module Anyway
76
76
 
77
77
  self.default_config_path = ->(name) { ::Rails.root.join("config", "#{name}.yml") }
78
78
  self.known_environments = %w[test development production]
79
+ self.use_local_files ||= ::Rails.env.development?
79
80
  # Don't try read defaults when no key defined
80
81
  self.default_environmental_key = nil
81
82
  end
@@ -96,8 +96,11 @@ module Anyway
96
96
  end
97
97
  end
98
98
 
99
+ # By default, use ANYWAY_ENV
100
+ self.current_environment = ENV["ANYWAY_ENV"]
101
+
99
102
  # By default, use local files only in development (that's the purpose if the local files)
100
- self.use_local_files = (ENV["RACK_ENV"] == "development" || ENV["RAILS_ENV"] == "development")
103
+ self.use_local_files = (ENV["ANYWAY_ENV"] == "development" || ENV["RACK_ENV"] == "development" || ENV["RAILS_ENV"] == "development")
101
104
 
102
105
  # By default, consider configs are stored in the ./config folder
103
106
  self.default_config_path = ->(name) { "./config/#{name}.yml" }
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "anyway/testing/helpers"
4
4
 
5
- if defined?(RSpec::Core)
5
+ if defined?(RSpec::Core) && RSpec.respond_to?(:configure)
6
6
  RSpec.configure do |config|
7
7
  config.include(
8
8
  Anyway::Testing::Helpers,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anyway # :nodoc:
4
- VERSION = "2.4.1"
4
+ VERSION = "2.4.2"
5
5
  end
data/sig/manifest.yml CHANGED
@@ -4,4 +4,3 @@ dependencies:
4
4
  - name: pathname
5
5
  - name: date
6
6
  - name: time
7
- - name: set
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anyway_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Dementyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-04 00:00:00.000000000 Z
11
+ date: 2023-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-next-core