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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +6 -5
- data/lib/.rbnext/2.7/anyway/loaders/yaml.rb +1 -1
- data/lib/anyway/loaders/yaml.rb +1 -1
- data/lib/anyway/rails/autoload.rb +19 -16
- data/lib/anyway/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c4d3be4fe0dc48b125dc8eb14be21611e1c9a356953f2a2bdad1444aa21eabe
|
4
|
+
data.tar.gz: 4796c3d47f70459e0732913997c9fa80ce5a0a604cb86d8d3098a9144a692326
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
- `"
|
620
|
-
- `"
|
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
|
-
|
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
|
|
data/lib/anyway/loaders/yaml.rb
CHANGED
@@ -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,
|
18
|
-
# https://github.com/
|
19
|
-
return unless event.self
|
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
|
-
|
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
|
-
|
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
|
-
|
37
|
-
|
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
|
data/lib/anyway/version.rb
CHANGED
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.
|
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-
|
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
|