ruby_native 0.1.0 → 0.1.1

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: d6157407a95aecdb39c9f05de070e3268e6d0910162fcd3b50e54b75f52f4093
4
- data.tar.gz: 66c9cc2caa92638cbb52f56cae855c16ffd956de4ad1e8db843e990a7197cc90
3
+ metadata.gz: c9cc3f159d5a1cdb53f843060574ad40fa6023854633df6ab08c23628246f926
4
+ data.tar.gz: bfc390268391502cc285da1011e2b17263829d1a92daf33bf40256ebe90f57a3
5
5
  SHA512:
6
- metadata.gz: 1a510f3343561161004f5a4104a28c79846f224e4d30335fcd33617d18f57c35179aedced255e9876fdb704c6cdd7e5b26727614dbda9bb0e5c95470fbd029a5
7
- data.tar.gz: 0a177fca9a18e66d623c18a97412e4ccc923ca3f97c750f90c246f6f7eb4c7124bd279a41fa6a91f3c3e627deabf7b83584ad74f5fc731a0703311c5042b8451
6
+ metadata.gz: 7638386535366c20bb57eac4b339d1c6df136d172efbebbda30acf5a1de8d12fdf4b5bb1bb8c8cb0b3a0a8fdd8f43792dfa9fbee6831450efe4aa67f50e7fc52
7
+ data.tar.gz: 4bbd9674f45483760079c09476650c8bec90f693bdca2632d59fd8a2865a154c9fd26174110ad7a248d36cd20320e7cffbd73dcab71f07b278c3468a6353c32b
data/README.md CHANGED
@@ -78,11 +78,11 @@ The companion app persists the scanned URL across launches. Long-press the app i
78
78
  - `GET /native/config` - returns the YAML config as JSON
79
79
  - `POST /native/push/devices` - registers a push notification token (requires `current_user` from host app)
80
80
 
81
- ## Standard and Advanced Modes
81
+ ## Normal and Advanced Modes
82
82
 
83
- Standard Mode works with any frontend framework and requires no JavaScript. You get tabs, form page marking, push notifications, and history management.
83
+ Normal Mode works with any frontend framework and requires no JavaScript. You get tabs, form page marking, push notifications, and history management.
84
84
 
85
- Advanced Mode adds native navigation bar buttons, submit buttons, action menus, and search bars. It requires Stimulus and a small JavaScript setup step (see [Advanced Mode setup](#advanced-mode-setup) below). Migration is additive. Start with Standard and add Advanced helpers one page at a time.
85
+ Advanced Mode adds native navigation bar buttons, submit buttons, action menus, and search bars. It requires Stimulus and a small JavaScript setup step (see [Advanced Mode setup](#advanced-mode-setup) below). Migration is additive. Start with Normal and add Advanced helpers one page at a time.
86
86
 
87
87
  ## View helpers
88
88
 
@@ -93,9 +93,9 @@ Place helpers in the `<body>`, not the `<head>`.
93
93
  - `native_app?` - true when the request comes from a Ruby Native app (checks user agent)
94
94
  - `native_tabs_tag(enabled: true)` - shows the native tab bar.
95
95
  - `native_push_tag` - requests push notification permission.
96
- - `native_back_button_tag(text = nil, **options)` - renders a back button for Standard Mode. Hidden by default, shown when the native app sets `body.can-go-back`. Not needed in [Advanced Mode](https://rubynative.dev/docs/advanced-mode) where the system provides a native back button.
96
+ - `native_back_button_tag(text = nil, **options)` - renders a back button for Normal Mode. Hidden by default, shown when the native app sets `body.can-go-back`. Not needed in [Advanced Mode](https://rubynative.dev/docs/advanced-mode) where the system provides a native back button.
97
97
 
98
- ### Standard Mode
98
+ ### Normal Mode
99
99
 
100
100
  - `native_form_tag` - marks the page as a form. The app skips form pages when navigating back.
101
101
 
@@ -30,13 +30,17 @@ rails generate ruby_native:install
30
30
  <%= native_tabs_tag %>
31
31
  ```
32
32
 
33
- 6. Preview on your phone:
33
+ 6. Start your Rails server and the preview tunnel in separate terminals:
34
+
35
+ ```bash
36
+ bin/rails server
37
+ ```
34
38
 
35
39
  ```bash
36
40
  bundle exec ruby_native preview
37
41
  ```
38
42
 
39
- Scan the QR code with the Ruby Native Preview app from the App Store.
43
+ Scan the QR code with the Ruby Native Preview app from the App Store. Keep both the server and tunnel running.
40
44
 
41
45
  ## Configuration
42
46
 
@@ -100,7 +104,7 @@ Signal elements are hidden `<div>` tags. Place them in the `<body>`, not the `<h
100
104
 
101
105
  ## Preview
102
106
 
103
- `bundle exec ruby_native preview` starts a Cloudflare tunnel and displays a QR code. Requires `cloudflared`:
107
+ `bundle exec ruby_native preview` starts a Cloudflare tunnel and displays a QR code. Your Rails server must be running separately (e.g., `bin/rails server` in another terminal). Requires `cloudflared`:
104
108
 
105
109
  ```bash
106
110
  brew install cloudflare/cloudflare/cloudflared
@@ -139,7 +143,7 @@ The gem auto-mounts at `/native`. No route configuration needed.
139
143
  <%= native_tabs_tag if user_signed_in? %>
140
144
  ```
141
145
 
142
- ### Add a native back button (Standard Mode only)
146
+ ### Add a native back button (Normal Mode only)
143
147
 
144
148
  Use the `native_back_button_tag` helper. The gem's stylesheet handles showing it only when there's history to go back to. Not needed in Advanced Mode where the system provides a native back button.
145
149
 
@@ -45,6 +45,8 @@ module RubyNative
45
45
 
46
46
  def start_tunnel
47
47
  puts "Starting tunnel to http://localhost:#{@port}..."
48
+ puts "Make sure your Rails server is running on port #{@port} in another terminal."
49
+ puts ""
48
50
 
49
51
  stdin, stdout_err, wait_thread = Open3.popen2e(
50
52
  "cloudflared", "tunnel", "--url", "http://localhost:#{@port}"
@@ -108,6 +110,7 @@ module RubyNative
108
110
  puts url
109
111
  puts ""
110
112
  puts "Scan with the Ruby Native preview app."
113
+ puts "Keep this running and your Rails server on port #{@port} in another terminal."
111
114
  puts "Press Ctrl+C to stop."
112
115
  end
113
116
 
@@ -32,7 +32,11 @@ module RubyNative
32
32
 
33
33
  def native_back_button_tag(text = nil, **options)
34
34
  options[:class] = [options[:class], "native-back-button"].compact.join(" ")
35
- tag.button(text || "Back", onclick: "webkit.messageHandlers.rubyNative.postMessage({action: 'back'})", **options)
35
+ default_content = tag.svg(
36
+ tag.path(d: "M15.75 19.5L8.25 12l7.5-7.5", stroke_linecap: "round", stroke_linejoin: "round"),
37
+ width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", stroke_width: 2.5
38
+ )
39
+ tag.button(text || default_content, onclick: "webkit.messageHandlers.rubyNative.postMessage({action: 'back'})", **options)
36
40
  end
37
41
 
38
42
  def native_search_tag
@@ -1,3 +1,3 @@
1
1
  module RubyNative
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Masilotti