figjam 1.4.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/figjam/application.rb +26 -3
- data/lib/figjam/rails.rb +1 -1
- 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: efb30c09f6e2c3d1b9dd649679dfba6dbabd5cbbc5e56c8e9f51fd18082cfa9c
|
4
|
+
data.tar.gz: b95972fc469e8bfdb651406925fc3af859c0639662fd4464c8b367de1fc23c87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba4c3648b7ed4c8f1cdc0a8e7df2a8db996511301b626f02ca0921547a996e4d21fddfbe2aabcb4643df6b14277026efa2a00c148ec25d0db93746fb3d978865
|
7
|
+
data.tar.gz: 00c61bc16d26dc502a4948d986ab528994a00a2aab51f45f0b9150ed17d8be7037660cb4d5b9990d50215c9f50dd44f49c32097af188f590b0384fe3c8c0f3da
|
data/lib/figjam/application.rb
CHANGED
@@ -5,6 +5,10 @@ require "figjam/figaro_alias"
|
|
5
5
|
module Figjam
|
6
6
|
class Application
|
7
7
|
FIGARO_ENV_PREFIX = "_FIGARO_"
|
8
|
+
SILENCE_STRING_WARNINGS_KEYS = %i[
|
9
|
+
FIGARO_SILENCE_STRING_WARNINGS
|
10
|
+
FIGJAM_SILENCE_STRING_WARNINGS
|
11
|
+
]
|
8
12
|
|
9
13
|
include Enumerable
|
10
14
|
|
@@ -58,7 +62,17 @@ module Figjam
|
|
58
62
|
end
|
59
63
|
|
60
64
|
def parse(path)
|
61
|
-
File.exist?(path) &&
|
65
|
+
File.exist?(path) && load_yaml(ERB.new(File.read(path)).result) || {}
|
66
|
+
end
|
67
|
+
|
68
|
+
def load_yaml(source)
|
69
|
+
# https://bugs.ruby-lang.org/issues/17866
|
70
|
+
# https://github.com/rails/rails/commit/179d0a1f474ada02e0030ac3bd062fc653765dbe
|
71
|
+
begin
|
72
|
+
YAML.load(source, aliases: true) || {}
|
73
|
+
rescue ArgumentError
|
74
|
+
YAML.load(source) || {}
|
75
|
+
end
|
62
76
|
end
|
63
77
|
|
64
78
|
def global_configuration
|
@@ -70,8 +84,10 @@ module Figjam
|
|
70
84
|
end
|
71
85
|
|
72
86
|
def set(key, value)
|
73
|
-
|
74
|
-
|
87
|
+
unless non_string_warnings_silenced?
|
88
|
+
non_string_configuration!(key) unless key.is_a?(String)
|
89
|
+
non_string_configuration!(value) unless value.is_a?(String) || value.nil?
|
90
|
+
end
|
75
91
|
|
76
92
|
::ENV[key.to_s] = value.nil? ? nil : value.to_s
|
77
93
|
::ENV[FIGARO_ENV_PREFIX + key.to_s] = value.nil? ? nil: value.to_s
|
@@ -81,6 +97,13 @@ module Figjam
|
|
81
97
|
::ENV.key?(key.to_s) && !::ENV.key?(FIGARO_ENV_PREFIX + key.to_s)
|
82
98
|
end
|
83
99
|
|
100
|
+
def non_string_warnings_silenced?
|
101
|
+
SILENCE_STRING_WARNINGS_KEYS.any? { |key|
|
102
|
+
# Allow the silence configuration itself to use non-string keys/values.
|
103
|
+
configuration.values_at(key.to_s, key).any? { |cv| cv.to_s == 'true' }
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
84
107
|
def non_string_configuration!(value)
|
85
108
|
warn "WARNING: Use strings for Figjam configuration. #{value.inspect} was converted to #{value.to_s.inspect}."
|
86
109
|
end
|
data/lib/figjam/rails.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: 1.
|
4
|
+
version: 1.6.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: 2022-
|
11
|
+
date: 2022-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: combustion
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: fasterer
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|