ruby_native 0.18.0 → 0.18.2

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.
@@ -1,3 +1,3 @@
1
1
  module RubyNative
2
- VERSION = "0.18.0"
2
+ VERSION = "0.18.2"
3
3
  end
data/lib/ruby_native.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "erb"
2
+ require "monitor"
2
3
  require "ruby_native/version"
3
4
  require "ruby_native/helper"
4
5
  require "ruby_native/native_version"
@@ -16,7 +17,6 @@ require "ruby_native/screenshots/sign_in_helper"
16
17
  require "ruby_native/engine"
17
18
 
18
19
  module RubyNative
19
- mattr_accessor :config
20
20
  mattr_accessor :subscription_callbacks, default: []
21
21
 
22
22
  # Screenshot configuration. Set via `RubyNative.configure` in an initializer.
@@ -41,6 +41,26 @@ module RubyNative
41
41
  subscription_callbacks.each { |cb| cb.call(event) }
42
42
  end
43
43
 
44
+ CONFIG_LOCK = Monitor.new
45
+ private_constant :CONFIG_LOCK
46
+
47
+ # Loaded on first read, not at boot: rendering the YAML's ERB runs asset
48
+ # helpers, and under `assets:precompile` those run before the bundles are
49
+ # built, leaving Propshaft's manifest without them.
50
+ def self.config
51
+ return @config if defined?(@config)
52
+
53
+ CONFIG_LOCK.synchronize do
54
+ load_config unless defined?(@config)
55
+ @config = nil unless defined?(@config) # missing or empty file
56
+ @config
57
+ end
58
+ end
59
+
60
+ def self.config=(value)
61
+ @config = value
62
+ end
63
+
44
64
  def self.load_config
45
65
  path = Rails.root.join("config", "ruby_native.yml")
46
66
  return unless path.exist?
@@ -48,7 +68,7 @@ module RubyNative
48
68
  parsed = YAML.load(render_config(path), filename: path.to_s, aliases: true)
49
69
 
50
70
  # An empty file, comments only, or ERB rendering to nothing parses to nil;
51
- # treat it like a missing file instead of crashing Rails boot.
71
+ # treat it like a missing file instead of raising.
52
72
  unless parsed.is_a?(Hash)
53
73
  Rails.logger.warn("[RubyNative] #{path} is empty or not a YAML mapping; ignoring it.")
54
74
  return
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_native
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Masilotti
@@ -92,7 +92,7 @@ files:
92
92
  - lib/generators/ruby_native/templates/create_ruby_native_purchase_intents.rb
93
93
  - lib/generators/ruby_native/templates/ruby_native.yml
94
94
  - lib/ruby_native.rb
95
- - lib/ruby_native/certs/AppleRootCA-G3.cer
95
+ - lib/ruby_native/certs/AppleRootCA-G3.pem
96
96
  - lib/ruby_native/cli.rb
97
97
  - lib/ruby_native/cli/apple.rb
98
98
  - lib/ruby_native/cli/check.rb