anyway_config 2.5.0 → 2.5.1

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: 29fe2702743a353cb8d7d793d59278dea2cfef4075e17204181ffdab9b594274
4
- data.tar.gz: dd34c9bf703b5b93b4e5c4a1cce3e9ede85af1666d5de484005e13f217d897bd
3
+ metadata.gz: 2b7d08d5b962854362876ef57a33cb5a7db900a2b116cfc55e6a111fe67a6908
4
+ data.tar.gz: 8330ecf2804805dc40fd4966e5f0da06a8e46d87a9f01d1d377f5687b61cbdff
5
5
  SHA512:
6
- metadata.gz: 3f1d05c31f97864f64b2ace127636d15535ed18c50f44f11e90949d784df40d437e48d9cd37a0bc2b8ccab0c5b17dd6a25062cbf25669f51e654fb1a5b356b2d
7
- data.tar.gz: 6a7ceda8a770887e3775d5c75e6d8e5a6afa98f49851926d40d131c4ca0034f60b1739868d142029b35fe44b4bf39205e68d84fe97f65c89c146cbe74a4750aa
6
+ metadata.gz: 5af5f14653ba282b7c4e89d88c85dc3908d693fa7dc93c0436dba5044c1a8d98cae12284b97bfae9c3b9415dea5b745ac3bb9ee3639fc7880c61b3c3f6bf7465
7
+ data.tar.gz: b6d44f0500203371beaa12cdc47a24a9e9a66d66305491649e0961a9285d5280692cf5828736fa79afbd8fdd1459e26bf0a2715415c44188604c90616b880242
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 2.5.1 (2023-08-04)
6
+
7
+ - Fix Rails detection. ([@palkan][])
8
+
9
+ Fixes [#134](https://github.com/palkan/anyway_config/issues/134).
10
+
5
11
  ## 2.5.0 (2023-07-24)
6
12
 
7
13
  - Generators: Add `config_name` to generated classes if name contains underscore. ([@palkan][])
@@ -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,24 @@ 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))
34
+ @tracer = TracePoint.new(:end, &method(:tracepoint_class_callback))
37
35
  @tracer.enable
36
+ # Use `Module#name` instead of `self.name` to handle overwritten `name` method
37
+ @name_method = Module.instance_method(:name)
38
38
  end
39
39
  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.1"
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.1
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-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-next-core