anyway_config 2.5.0 → 2.5.2

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: 29fe2702743a353cb8d7d793d59278dea2cfef4075e17204181ffdab9b594274
4
- data.tar.gz: dd34c9bf703b5b93b4e5c4a1cce3e9ede85af1666d5de484005e13f217d897bd
3
+ metadata.gz: 3c4d3be4fe0dc48b125dc8eb14be21611e1c9a356953f2a2bdad1444aa21eabe
4
+ data.tar.gz: 4796c3d47f70459e0732913997c9fa80ce5a0a604cb86d8d3098a9144a692326
5
5
  SHA512:
6
- metadata.gz: 3f1d05c31f97864f64b2ace127636d15535ed18c50f44f11e90949d784df40d437e48d9cd37a0bc2b8ccab0c5b17dd6a25062cbf25669f51e654fb1a5b356b2d
7
- data.tar.gz: 6a7ceda8a770887e3775d5c75e6d8e5a6afa98f49851926d40d131c4ca0034f60b1739868d142029b35fe44b4bf39205e68d84fe97f65c89c146cbe74a4750aa
6
+ metadata.gz: 7892284a2c1f50287dada83b90be86b11c557a0ec5e5d457a672d9d1db6ba6603299cf5060ca2134dc391f2aa02e3f17f8bcd221b0e8473a55dc99e0bea06ec8
7
+ data.tar.gz: f4f276d19c6a8a25ebcf46c1e55f176070691fa7af76b15bebafdf9b36a5716e7c3e1fb5ddcba2d07e741792eff0ed46d373d2b5651ac77c58d0b4527a097e75
data/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 2.5.2 (2023-08-23)
6
+
7
+ - Disable Rails post-load detection in TruffleRuby. ([@palkan][])
8
+
9
+ ## 2.5.1 (2023-08-04)
10
+
11
+ - Fix Rails detection. ([@palkan][])
12
+
13
+ Fixes [#134](https://github.com/palkan/anyway_config/issues/134).
14
+
5
15
  ## 2.5.0 (2023-07-24)
6
16
 
7
17
  - Generators: Add `config_name` to generated classes if name contains underscore. ([@palkan][])
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![Cult Of Martians](http://cultofmartians.com/assets/badges/badge.svg)](https://cultofmartians.com/tasks/anyway-config-options-parse.html#task)
2
2
  [![Gem Version](https://badge.fury.io/rb/anyway_config.svg)](https://rubygems.org/gems/anyway_config) [![Build](https://github.com/palkan/anyway_config/workflows/Build/badge.svg)](https://github.com/palkan/anyway_config/actions)
3
3
  [![JRuby Build](https://github.com/palkan/anyway_config/workflows/JRuby%20Build/badge.svg)](https://github.com/palkan/anyway_config/actions)
4
+ [![TruffleRuby Build](https://github.com/palkan/anyway_config/workflows/TruffleRuby%20Build/badge.svg)](https://github.com/palkan/anyway_config/actions)
4
5
 
5
6
  # Anyway Config
6
7
 
@@ -614,14 +615,14 @@ Environmental variables for your config should start with your config name, uppe
614
615
 
615
616
  For example, if your config name is "mycoolgem", then the env var "MYCOOLGEM_PASSWORD" is used as `config.password`.
616
617
 
617
- By default, environment variables are automatically type cast\*:
618
+ By default, environment variables are automatically type cast (rules are case-insensitive):
618
619
 
619
- - `"True"`, `"t"` and `"yes"` to `true`;
620
- - `"False"`, `"f"` and `"no"` to `false`;
620
+ - `"true"`, `"t"`, `"yes"` and `"y"` to `true`;
621
+ - `"false"`, `"f"`, `"no"` and `"n"` to `false`;
621
622
  - `"nil"` and `"null"` to `nil` (do you really need it?);
622
- - `"123"` to 123 and `"3.14"` to 3.14.
623
+ - `"123"` to `123` and `"3.14"` to `3.14`.
623
624
 
624
- \* See below for coercion customization.
625
+ Type coercion can be [customized or disabled](#type-coercion).
625
626
 
626
627
  *Anyway Config* supports nested (_hashed_) env variables—just separate keys with double-underscore.
627
628
 
@@ -70,7 +70,7 @@ module Anyway
70
70
  alias_method :load_local_yml, :parse_yml
71
71
 
72
72
  def local_config_path(path)
73
- path.sub(/\.yml/, ".local.yml")
73
+ path.sub(".yml", ".local.yml")
74
74
  end
75
75
 
76
76
  def relative_config_path(path)
@@ -70,7 +70,7 @@ module Anyway
70
70
  alias_method :load_local_yml, :parse_yml
71
71
 
72
72
  def local_config_path(path)
73
- path.sub(/\.yml/, ".local.yml")
73
+ path.sub(".yml", ".local.yml")
74
74
  end
75
75
 
76
76
  def relative_config_path(path)
@@ -4,8 +4,10 @@
4
4
  # when Anyway Config is loaded before Rails (e.g., in config/puma.rb).
5
5
  module Anyway
6
6
  module Rails
7
+ using RubyNext
8
+
7
9
  class << self
8
- attr_reader :tracer
10
+ attr_reader :tracer, :name_method
9
11
  attr_accessor :disable_postponed_load_warning
10
12
 
11
13
  private
@@ -14,26 +16,27 @@ module Anyway
14
16
  # Ignore singletons
15
17
  return if event.self.singleton_class?
16
18
 
17
- # We wait till `rails` has been loaded, which is enough to add a railtie
18
- # https://github.com/rails/rails/blob/main/railties/lib/rails.rb
19
- return unless event.self.name == "Rails"
20
-
21
- # We must check for methods defined in `rails.rb` to distinguish events
22
- # happening when we open the `Rails` module in other files.
23
- if defined?(::Rails.env)
24
- tracer.disable
19
+ # We wait till `rails/application/configuration.rb` has been loaded, since we rely on it
20
+ # See https://github.com/palkan/anyway_config/issues/134
21
+ return unless name_method.bind_call(event.self) == "Rails::Application::Configuration"
25
22
 
26
- unless disable_postponed_load_warning
27
- warn "Anyway Config was loaded before Rails. Activating Anyway Config Rails plugins now.\n" \
28
- "NOTE: Already loaded configs were provisioned without Rails-specific sources."
29
- end
23
+ tracer.disable
30
24
 
31
- require "anyway/rails"
25
+ unless disable_postponed_load_warning
26
+ warn "Anyway Config was loaded before Rails. Activating Anyway Config Rails plugins now.\n" \
27
+ "NOTE: Already loaded configs were provisioned without Rails-specific sources."
32
28
  end
29
+
30
+ require "anyway/rails"
33
31
  end
34
32
  end
35
33
 
36
- @tracer = TracePoint.new(:class, &method(:tracepoint_class_callback))
37
- @tracer.enable
34
+ # TruffleRuby doesn't support TracePoint's end event
35
+ unless defined?(::TruffleRuby)
36
+ @tracer = TracePoint.new(:end, &method(:tracepoint_class_callback))
37
+ @tracer.enable
38
+ # Use `Module#name` instead of `self.name` to handle overwritten `name` method
39
+ @name_method = Module.instance_method(:name)
40
+ end
38
41
  end
39
42
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Anyway # :nodoc:
4
- VERSION = "2.5.0"
4
+ VERSION = "2.5.2"
5
5
  end
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.5.0
4
+ version: 2.5.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-07-25 00:00:00.000000000 Z
11
+ date: 2023-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-next-core