ruby_everywhere 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: 75b09aedaa84953cf39a5b6bc7e793f660998f297d5c7cc74ed453fef68172f3
4
- data.tar.gz: f1970350eaaedaf2fed2fd6123a25c152f196019256d5c2ff848a0a262f589c7
3
+ metadata.gz: 19938d7ab43425ebeb6a729c9dff31fa1c301aea0b72b08638483a1e2e1e5313
4
+ data.tar.gz: b493f9396d3b2f7b84d2b9434ab232ef21294df373b8c432d2c1aac811c9ac98
5
5
  SHA512:
6
- metadata.gz: 3f611fb7632f07a4931b659166ad6c1e0e773b7fa979b38c66f109cb0c22ace4c9710bd977e112d40bceee6efdd358fe5283262d7218f60e36f267e4456e6f5f
7
- data.tar.gz: '08def4faa79e14355864dd66369a8cfb06884b062186234d96478c9cbe3edd9957f14e46319bd2276f5927728ccea0ce442ae6d216b2bc851cd059de815f84a3'
6
+ metadata.gz: fd4d9e03d266ee568170e60b663034c519db76941e2f91057dcc88cbb2250f71dae01668049a0af35edbd7464d468903c0027d97664da150b67529d62f7974a7
7
+ data.tar.gz: 6bb5a9afbe5d330f6a5bf7be303e728626b8df04476c9b5f3931ef0ed2d71ba9bf5507a1c54b99f0e11d7305c1acdbb2cb68f7bb43d7f46967dbf6746c5400e0
@@ -6,6 +6,7 @@ require "tmpdir"
6
6
  require "shellwords"
7
7
  require_relative "../shellout"
8
8
  require_relative "../png"
9
+ require_relative "../paths"
9
10
 
10
11
  module Everywhere
11
12
  module Commands
@@ -111,7 +112,7 @@ module Everywhere
111
112
  # Rails binary (as "app-server") + Info.plist + icon. An .app bundle is
112
113
  # just a directory layout, so we build it by hand — no tauri-cli needed.
113
114
  def bundle_app(server_binary, app_name, shell_dir, config, dist_dir: nil)
114
- shell_dir ||= find_shell_dir
115
+ shell_dir ||= Everywhere::Paths.shell_dir!
115
116
  dist_dir ||= File.dirname(server_binary)
116
117
 
117
118
  icon_source = config.icon
@@ -185,12 +186,6 @@ module Everywhere
185
186
  UI.success("app bundle: #{app_dir.sub("#{Dir.pwd}/", "")} #{UI.dim("(open it!)")}")
186
187
  end
187
188
 
188
- def find_shell_dir
189
- candidates = ["shell/src-tauri", "../shell/src-tauri", "src-tauri"]
190
- found = candidates.find { |c| File.exist?(File.join(c, "tauri.conf.json")) }
191
- found ? File.expand_path(found) : UI.die!("couldn't find the shell (looked in #{candidates.join(", ")}); pass --shell-dir")
192
- end
193
-
194
189
  # macOS ships everything needed to make an .icns from a png.
195
190
  def make_icns(png, resources_dir)
196
191
  return nil unless File.exist?(png)
@@ -3,6 +3,7 @@
3
3
  require "dry/cli"
4
4
  require "socket"
5
5
  require_relative "../shellout"
6
+ require_relative "../paths"
6
7
 
7
8
  module Everywhere
8
9
  module Commands
@@ -18,7 +19,7 @@ module Everywhere
18
19
  def call(port: "3000", shell_dir: nil, **)
19
20
  framework = Framework.detect
20
21
  config = Everywhere::Config.load(framework.root)
21
- shell_dir ||= find_shell_dir
22
+ shell_dir ||= Everywhere::Paths.shell_dir!
22
23
 
23
24
  server_pid = nil
24
25
  if port_open?(port)
@@ -43,12 +44,6 @@ module Everywhere
43
44
 
44
45
  private
45
46
 
46
- def find_shell_dir
47
- candidates = ["shell/src-tauri", "../shell/src-tauri", "src-tauri"]
48
- found = candidates.find { |c| File.exist?(File.join(c, "tauri.conf.json")) }
49
- found or UI.die!("couldn't find the shell (looked in #{candidates.join(", ")}); pass --shell-dir")
50
- end
51
-
52
47
  def port_open?(port)
53
48
  TCPSocket.new("127.0.0.1", Integer(port)).close
54
49
  true
@@ -3,6 +3,7 @@
3
3
  require "dry/cli"
4
4
  require_relative "../shellout"
5
5
  require_relative "../receipt"
6
+ require_relative "../paths"
6
7
  require_relative "build"
7
8
 
8
9
  module Everywhere
@@ -93,9 +94,7 @@ module Everywhere
93
94
  def resolve_shell_dir(given)
94
95
  return File.expand_path(given) if given
95
96
 
96
- ["shell/src-tauri", "../shell/src-tauri", "src-tauri"]
97
- .map { |c| File.expand_path(c) }
98
- .find { |c| File.exist?(File.join(c, "tauri.conf.json")) }
97
+ Everywhere::Paths.shell_dir
99
98
  end
100
99
 
101
100
  # Read the truth back off the bundle rather than trusting the script's log:
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Everywhere
4
+ # Filesystem locations the CLI resolves relative to the gem itself, so
5
+ # `every dev`/`build`/`release` work in any project the gem is installed into.
6
+ module Paths
7
+ module_function
8
+
9
+ # The gem's own root — the dir holding lib/, exe/, support/. Correct whether
10
+ # the code runs from a git checkout or an installed gem.
11
+ def gem_root
12
+ File.expand_path("../..", __dir__)
13
+ end
14
+
15
+ # The generic Tauri shell vendored inside the gem: support/shell/ holds the
16
+ # src-tauri app and the splash/ dir it serves. This is the shell the CLI
17
+ # uses unless the caller overrides it with --shell-dir.
18
+ def bundled_shell_dir
19
+ File.join(gem_root, "support", "shell", "src-tauri")
20
+ end
21
+
22
+ # Absolute path to the shell's src-tauri directory, or nil if the vendored
23
+ # copy is missing (a corrupt/partial install).
24
+ def shell_dir
25
+ bundled_shell_dir if File.exist?(File.join(bundled_shell_dir, "tauri.conf.json"))
26
+ end
27
+
28
+ # Like #shell_dir but aborts with a helpful message when the shell is
29
+ # missing. The --shell-dir hint covers monorepo dev pointed at build-runner.
30
+ def shell_dir!
31
+ shell_dir or UI.die!("couldn't find the bundled shell at #{bundled_shell_dir}; " \
32
+ "reinstall ruby_everywhere or pass --shell-dir")
33
+ end
34
+ end
35
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Everywhere
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
 
6
6
  # Version of the vendored @rubyeverywhere/bridge JS this gem ships. Tracks
7
7
  # bridge/package.json — bump it whenever lib/everywhere/javascript/bridge.js is
@@ -0,0 +1,40 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>Starting…</title>
6
+ <style>
7
+ :root { color-scheme: light dark; }
8
+ body {
9
+ margin: 0; height: 100vh; display: grid; place-items: center;
10
+ font-family: -apple-system, system-ui, sans-serif;
11
+ background: var(--bg, light-dark(#faf9f7, #1c1b1a));
12
+ color: light-dark(#333, #ddd);
13
+ }
14
+ .boot { text-align: center; }
15
+ .gem { font-size: 56px; animation: pulse 1.2s ease-in-out infinite; }
16
+ @keyframes pulse { 50% { opacity: 0.35; transform: scale(0.92); } }
17
+ h1 { margin: 12px 0 0; font-size: 17px; font-weight: 600; }
18
+ p { margin-top: 4px; font-size: 13px; opacity: 0.6; }
19
+ </style>
20
+ </head>
21
+ <body>
22
+ <div class="boot">
23
+ <div class="gem">💎</div>
24
+ <h1 id="name"></h1>
25
+ <p>Starting…</p>
26
+ </div>
27
+ <script>
28
+ // The shell injects window.__EVERYWHERE_CONFIG__ (from config/everywhere.yml)
29
+ // into every page, this splash included.
30
+ const cfg = window.__EVERYWHERE_CONFIG__ || {};
31
+ if (cfg.name) {
32
+ document.getElementById("name").textContent = cfg.name;
33
+ document.title = cfg.name;
34
+ }
35
+ const dark = matchMedia("(prefers-color-scheme: dark)").matches;
36
+ const bg = cfg.background_color && (dark ? cfg.background_color.dark : cfg.background_color.light);
37
+ if (bg) document.body.style.setProperty("--bg", bg);
38
+ </script>
39
+ </body>
40
+ </html>