ruby_native 0.18.1 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2ff32d06c4b1e5f4e233e9c4d1ad0004af8bcec9de8067c86300e54bfb357a1
4
- data.tar.gz: 352e68de5fda0187815a70468413fa3baf1576b1e9b2ad2e4d843c88b5c18323
3
+ metadata.gz: 833ee6403127ec6df4f7fcb42cca062b48d7e719902059f982451278eade0209
4
+ data.tar.gz: 234cb926954f458d8f98d3b5e2dc8dd8e831bf0dd5d724ebd14e9686e7ce0219
5
5
  SHA512:
6
- metadata.gz: 0661a6b1ee573f0f8a54fc18f340108244e7e238aab990383ca945bd566b69ce506870cfc79d1f054db3214cb8361b117d97d7dfbb10c359656e06edfe796ead
7
- data.tar.gz: 06e53bdceb344b7a9c32d81de47aa0607abcac7799857757e8252115d991016f8cf712a7e131019378c5fbba672dd6572bc6e914f65a5140a0c0af3ac3bfdc81
6
+ metadata.gz: e244d2e734b9b59d143b1d97c66301aa8733632d4d65897508f6aace6a1668a90ef2771396220bd3dfd7c22420ebbc0a599d55d01e2e5dbadfd064072e13f4a2
7
+ data.tar.gz: e90eacfe5a6c86de36fdb0ae9ad9b80dcbb4ae9be5dc4b9f03ec5977c8f2673abc0aebd8a10dbd25e8f1bdd3e5cedfa2d22d91f7b869c58dd990626d1168b973
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  [Ruby Native](https://rubynative.com) turns a Rails app into iOS and Android apps. This gem is the Rails-side integration: view helpers, a YAML config file, endpoints auto-mounted at `/native`, and a CLI for previewing and deploying builds. Full docs, including the complete helper reference and config schema, live at [rubynative.com/docs](https://rubynative.com/docs).
4
4
 
5
+ It is built for teams with a Rails product whose customers want an app. You keep one codebase and one roadmap: Ruby Native renders the HTML you already write as native tab bars, navigation, forms, and push notifications, builds the apps in the cloud with no Xcode or Android Studio, and submits them to the App Store and Google Play. A coding agent can drive every step through the bundled MCP server, stopping only for the few clicks Apple keeps for a person. Apps built with it run on 150,000+ devices. Pricing is one plan per app, $199 a month or $1,990 a year, at [rubynative.com/pricing](https://rubynative.com/pricing); the phone preview costs nothing and needs no account.
6
+
5
7
  ## Installation
6
8
 
7
9
  ```ruby
data/config/signals.yml CHANGED
@@ -82,6 +82,11 @@ signals:
82
82
  renders_when:
83
83
  toolbar: false
84
84
  singleton: true
85
+ data-native-locale:
86
+ since: "0.18.2"
87
+ helper: native_locale_tag
88
+ always: true
89
+ singleton: true
85
90
  data-native-menu:
86
91
  since: "0.14.0"
87
92
  helper: native_menu_tag
@@ -32,12 +32,6 @@ module RubyNative
32
32
  end
33
33
  end
34
34
 
35
- initializer "ruby_native.config" do
36
- config.after_initialize do
37
- RubyNative.load_config
38
- end
39
- end
40
-
41
35
  initializer "ruby_native.oauth_middleware", before: :build_middleware_stack do |app|
42
36
  app.middleware.insert_before ActionDispatch::Cookies, RubyNative::OAuthMiddleware
43
37
  end
@@ -38,6 +38,10 @@ module RubyNative
38
38
  OpenSSL::HMAC.hexdigest("SHA256", Rails.application.secret_key_base, parts.join(":"))[0, 16]
39
39
  end
40
40
 
41
+ def native_locale_tag(locale = I18n.locale)
42
+ tag.div(data: { native_locale: locale }, hidden: true)
43
+ end
44
+
41
45
  def native_back_button_tag(text = nil, **options)
42
46
  options[:class] = [options[:class], "native-back-button"].compact.join(" ")
43
47
  default_content = tag.svg(
@@ -1,3 +1,3 @@
1
1
  module RubyNative
2
- VERSION = "0.18.1"
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.1
4
+ version: 0.18.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Masilotti