figjam 2.2.0 → 3.0.0
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 +4 -4
- data/README.md +11 -14
- data/lib/figjam/application.rb +8 -18
- data/lib/figjam/rails/engine.rb +2 -0
- data/lib/figjam/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f35d4e26ae4c3164769faf39273f258a55dcfee745eedf07923c6af345bee8fc
|
4
|
+
data.tar.gz: f8201735431e49c46eebd988e048684cd0d2f98f15c841c8e12696176fd88248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adea20bf2faf8f66087f76b9e746bb0537e56221a2e4361136cae4b1fbf53841e3817d31ccfad89597e4dbfb5065bd72d96598c92570d29aee07a4c17145e237
|
7
|
+
data.tar.gz: 9a0b6469cc6278164d2bc07875c178fcc50629b0cb7af37326cebe12230707dabb0163e2173f3ebc522d2829c75185b6437af777a33c1346491e6a807f4126cc
|
data/README.md
CHANGED
@@ -62,15 +62,13 @@ they can be loaded independently or in addition of the main application. To do t
|
|
62
62
|
you can create a `config/application.yml` file in your engine, and add this to the `Rails::Engine`:
|
63
63
|
|
64
64
|
```ruby
|
65
|
-
|
66
|
-
class Engine < ::Rails::Engine
|
67
|
-
Figjam::Rails::Engine.configure(self)
|
68
|
-
end
|
69
|
-
end
|
65
|
+
require "figjam/rails/engine"
|
70
66
|
|
71
|
-
# Or if you wish to pass in a specific value for the environment:
|
72
67
|
module MyEngine
|
73
68
|
class Engine < ::Rails::Engine
|
69
|
+
Figjam::Rails::Engine.configure(self)
|
70
|
+
|
71
|
+
# Or if you wish to pass in a specific value for the environment:
|
74
72
|
Figjam::Rails::Engine.configure(self, "my_engine_environment")
|
75
73
|
end
|
76
74
|
end
|
@@ -86,6 +84,8 @@ do this as many times as you like. If you have multiple internal gems, they can
|
|
86
84
|
all use `figjam` to load their own configuration independently.
|
87
85
|
|
88
86
|
```ruby
|
87
|
+
require "figjam/application"
|
88
|
+
|
89
89
|
Figjam::Application.new(
|
90
90
|
environment: "some_environment_key",
|
91
91
|
path: "#{__dir__}/application.yml"
|
@@ -131,7 +131,7 @@ Note, secrets are not to be provided by figjam, so do not add them to your `appl
|
|
131
131
|
|
132
132
|
Deeply nested configuration structures are not possible.
|
133
133
|
|
134
|
-
##
|
134
|
+
## Debugging Figjam
|
135
135
|
|
136
136
|
Remember that `ENV` in ruby is a simple key/value store. All values will always be strings.
|
137
137
|
This means that the following code will produce string values:
|
@@ -142,21 +142,18 @@ SOME_BOOLEAN: true
|
|
142
142
|
```
|
143
143
|
|
144
144
|
```ruby
|
145
|
-
# WARNING: Use strings for Figjam configuration. 3 was converted to "3"
|
146
|
-
# WARNING: Use strings for Figjam configuration. true was converted to "true"
|
147
|
-
|
148
145
|
ENV["SOME_NUMBER"] == 3 # => false
|
149
146
|
ENV["SOME_NUMBER"] == "3" # => true
|
150
147
|
ENV["SOME_BOOLEAN"] == true # => false
|
151
148
|
ENV["SOME_BOOLEAN"] == "true" # => true
|
152
149
|
```
|
153
150
|
|
154
|
-
|
155
|
-
|
156
|
-
to
|
151
|
+
If you are unsure about how figjam is loading your configuration, you can enable warnings
|
152
|
+
about type conversion and pre-existing ENV by setting the `FIGJAM_DEBUG` environment variable
|
153
|
+
to `true`.
|
157
154
|
|
158
155
|
```yaml
|
159
|
-
|
156
|
+
FIGJAM_DEBUG: true
|
160
157
|
```
|
161
158
|
|
162
159
|
### Using `Figjam.env`
|
data/lib/figjam/application.rb
CHANGED
@@ -8,11 +8,6 @@ module Figjam
|
|
8
8
|
# :reek:TooManyMethods
|
9
9
|
class Application
|
10
10
|
FIGARO_ENV_PREFIX = "_FIGARO_".freeze
|
11
|
-
SILENCE_STRING_WARNINGS_KEYS = %i[
|
12
|
-
FIGARO_SILENCE_STRING_WARNINGS
|
13
|
-
FIGJAM_SILENCE_STRING_WARNINGS
|
14
|
-
].freeze
|
15
|
-
|
16
11
|
include Enumerable
|
17
12
|
|
18
13
|
def initialize(options = {})
|
@@ -93,10 +88,8 @@ module Figjam
|
|
93
88
|
end
|
94
89
|
|
95
90
|
private def set(key, value)
|
96
|
-
unless
|
97
|
-
|
98
|
-
non_string_configuration(value) unless value.is_a?(String) || value.nil?
|
99
|
-
end
|
91
|
+
non_string_configuration(key) unless key.is_a?(String)
|
92
|
+
non_string_configuration(value) unless value.is_a?(String) || value.nil?
|
100
93
|
|
101
94
|
::ENV[key.to_s] = value&.to_s
|
102
95
|
::ENV[FIGARO_ENV_PREFIX + key.to_s] = value&.to_s
|
@@ -106,19 +99,16 @@ module Figjam
|
|
106
99
|
::ENV.key?(key.to_s) && !::ENV.key?(FIGARO_ENV_PREFIX + key.to_s)
|
107
100
|
end
|
108
101
|
|
109
|
-
private def non_string_warnings_silenced?
|
110
|
-
SILENCE_STRING_WARNINGS_KEYS.any? { |key|
|
111
|
-
# Allow the silence configuration itself to use non-string keys/values.
|
112
|
-
configuration.values_at(key.to_s, key).any? { |cv| cv.to_s == "true" }
|
113
|
-
}
|
114
|
-
end
|
115
|
-
|
116
102
|
private def non_string_configuration(value)
|
117
|
-
|
103
|
+
return unless ::ENV["FIGJAM_DEBUG"] == "true"
|
104
|
+
|
105
|
+
warn "FIGJAM: Use strings for Figjam configuration. #{value.inspect} was converted to #{value.to_s.inspect}." # rubocop:disable Layout/LineLength
|
118
106
|
end
|
119
107
|
|
120
108
|
private def key_skipped(key)
|
121
|
-
|
109
|
+
return unless ::ENV["FIGJAM_DEBUG"] == "true"
|
110
|
+
|
111
|
+
puts "FIGJAM: Skipping key #{key.inspect}. Already set in ENV."
|
122
112
|
end
|
123
113
|
|
124
114
|
private def valid_key_name?(key)
|
data/lib/figjam/rails/engine.rb
CHANGED
data/lib/figjam/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: figjam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Lascelles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -86,6 +86,20 @@ dependencies:
|
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: climate_control
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
104
|
name: combustion
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|