figjam 1.4.0 → 1.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63193ca4ccdc6bd4f2ef6176e38a4ffc60a9dbd3443f72f7115eafbea7d824e2
4
- data.tar.gz: 79a43ae8ab92ebb0b96b87a774fd8960e773fa86d37b6e55b189135c1c4dd23d
3
+ metadata.gz: efb30c09f6e2c3d1b9dd649679dfba6dbabd5cbbc5e56c8e9f51fd18082cfa9c
4
+ data.tar.gz: b95972fc469e8bfdb651406925fc3af859c0639662fd4464c8b367de1fc23c87
5
5
  SHA512:
6
- metadata.gz: f2f5091a1abcdf7907f0e4fd7afb02505d00fb250a59d3c340d02bf73e93375bd4b2e7d74c5d7b28f9eda7131496fdbf4f93c0a3da086225eda06cb5d5238215
7
- data.tar.gz: be33071b27c9053afd3ace0d8d9767b140ee79bbe1e35ff742372a5965509ff809b266f5241d5278792f76d52cd126d10bde80c3ddd420b004fe8d070587e1b2
6
+ metadata.gz: ba4c3648b7ed4c8f1cdc0a8e7df2a8db996511301b626f02ca0921547a996e4d21fddfbe2aabcb4643df6b14277026efa2a00c148ec25d0db93746fb3d978865
7
+ data.tar.gz: 00c61bc16d26dc502a4948d986ab528994a00a2aab51f45f0b9150ed17d8be7037660cb4d5b9990d50215c9f50dd44f49c32097af188f590b0384fe3c8c0f3da
@@ -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) && YAML.load(ERB.new(File.read(path)).result) || {}
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
- non_string_configuration!(key) unless key.is_a?(String)
74
- non_string_configuration!(value) unless value.is_a?(String) || value.nil?
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
@@ -5,8 +5,8 @@ begin
5
5
  rescue LoadError
6
6
  else
7
7
  require "figjam/rails/application"
8
- require "figjam/rails/railtie"
9
8
 
10
9
  Figjam.adapter = Figjam::Rails::Application
10
+ require "figjam/rails/railtie"
11
11
  end
12
12
 
@@ -1,3 +1,3 @@
1
1
  module Figjam
2
- VERSION = "1.4.0"
2
+ VERSION = "1.6.0"
3
3
  end
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.0
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-14 00:00:00.000000000 Z
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