ruby_everywhere 0.1.12 → 0.1.13
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b32234a25ed3595183b216bcf7b3c1098e5a3c4f3bd442dc97b273623e48ef5d
|
|
4
|
+
data.tar.gz: 5019ffcd442cf46b5d2327b998b939390eb79a99c8238a629ebd509e5df89d4a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8a76d601c2550e82d43b8205a40499376ffa7472d8611378b1af5eae4050b6138bf5cd947312865fbadfed1d82e4066e36e174f69deb8a9217af7c3868af7d45
|
|
7
|
+
data.tar.gz: 843e78f6a210b4c2480fb1b75a17a9c32a200cff4eeadf3635796a105c6974bb6c1f88c2f0c4d95ae51caa6cd69a627ae00a5b4268cbb9003926f3e121ef16f4
|
|
@@ -75,9 +75,32 @@ module Everywhere
|
|
|
75
75
|
|
|
76
76
|
private
|
|
77
77
|
|
|
78
|
+
# The precompile step runs against the HOST Ruby — unlike tebako press,
|
|
79
|
+
# which installs the app's gems itself inside the packaged Ruby. A fresh
|
|
80
|
+
# machine (a hosted build runner, a brand-new checkout) has Gemfile.lock
|
|
81
|
+
# but none of the gems, so bin/rails would die with Bundler::GemNotFound.
|
|
82
|
+
def ensure_gems!(framework)
|
|
83
|
+
return if Shellout.run?(bundle_env, "bundle", "check", chdir: framework.root, quiet: true)
|
|
84
|
+
|
|
85
|
+
UI.step("installing gems #{UI.dim("(bundle install — first build on this machine)")}")
|
|
86
|
+
Shellout.run!(bundle_env, "bundle", "install", chdir: framework.root)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# EVERY_BUNDLE_PATH (set by `every platform runner`) redirects the app's
|
|
90
|
+
# gems to a stable per-user dir so CI can cache them across builds. It
|
|
91
|
+
# must be merged EXPLICITLY into each host-side bundler command:
|
|
92
|
+
# Shellout.unbundled strips inherited BUNDLE_* vars, so an inherited
|
|
93
|
+
# BUNDLE_PATH would never survive to the child process.
|
|
94
|
+
def bundle_env
|
|
95
|
+
path = ENV["EVERY_BUNDLE_PATH"]
|
|
96
|
+
path ? { "BUNDLE_PATH" => File.expand_path(path) } : {}
|
|
97
|
+
end
|
|
98
|
+
|
|
78
99
|
def press!(framework, entry, ruby, output_path)
|
|
100
|
+
ensure_gems!(framework) if framework.precompile?
|
|
101
|
+
|
|
79
102
|
UI.step("precompiling assets")
|
|
80
|
-
Shellout.run!(framework.precompile_env, framework.precompile_command, chdir: framework.root)
|
|
103
|
+
Shellout.run!(framework.precompile_env.merge(bundle_env), framework.precompile_command, chdir: framework.root)
|
|
81
104
|
|
|
82
105
|
out_dir = File.dirname(output_path)
|
|
83
106
|
# Tebako packages the whole app root, so stale build products in an
|
|
@@ -108,7 +131,7 @@ module Everywhere
|
|
|
108
131
|
# Leaving precompiled assets behind shadows dev-mode assets (new JS
|
|
109
132
|
# wouldn't load in `every dev` until someone clobbers by hand).
|
|
110
133
|
UI.step("cleaning up precompiled assets")
|
|
111
|
-
Shellout.run!(framework.precompile_env, framework.cleanup_command, chdir: framework.root)
|
|
134
|
+
Shellout.run!(framework.precompile_env.merge(bundle_env), framework.cleanup_command, chdir: framework.root)
|
|
112
135
|
|
|
113
136
|
surface_warnings(log)
|
|
114
137
|
end
|
|
@@ -8,6 +8,7 @@ require "base64"
|
|
|
8
8
|
require "json"
|
|
9
9
|
require "open3"
|
|
10
10
|
require_relative "../../ui"
|
|
11
|
+
require_relative "../../paths"
|
|
11
12
|
require_relative "../../platform/client"
|
|
12
13
|
|
|
13
14
|
module Everywhere
|
|
@@ -133,7 +134,12 @@ module Everywhere
|
|
|
133
134
|
# The web UI renders ANSI, but `every release` runs here as a pipe (not a
|
|
134
135
|
# TTY) so it would otherwise strip all color. Force it on — for our own
|
|
135
136
|
# output and for cargo — so the hosted log looks like the local one.
|
|
136
|
-
|
|
137
|
+
#
|
|
138
|
+
# EVERY_BUNDLE_PATH sends the app's gems to a stable per-user dir
|
|
139
|
+
# (instead of the runner's own gem env) so CI can cache them across
|
|
140
|
+
# builds of the same app — the gem analogue of the shell-target cache.
|
|
141
|
+
forced = { "CLICOLOR_FORCE" => "1", "CARGO_TERM_COLOR" => "always",
|
|
142
|
+
"EVERY_BUNDLE_PATH" => Everywhere::Paths.app_bundle_dir }
|
|
137
143
|
success = stream(forced.merge(signing_env), cmd)
|
|
138
144
|
|
|
139
145
|
dist = File.join(src, "dist")
|
data/lib/everywhere/framework.rb
CHANGED
|
@@ -73,6 +73,10 @@ module Everywhere
|
|
|
73
73
|
# Env each framework needs set before the app loads, beyond NATIVE_PACKAGED.
|
|
74
74
|
def env_exports = {}
|
|
75
75
|
|
|
76
|
+
# Whether the build must run anything against the app's bundle on the HOST
|
|
77
|
+
# Ruby (asset precompile). Sinatra's no-op precompile opts out.
|
|
78
|
+
def precompile? = precompile_command != "true"
|
|
79
|
+
|
|
76
80
|
def render_boot_stub(env, setup_line)
|
|
77
81
|
exports = ({ "NATIVE_PACKAGED" => "1" }.merge(env))
|
|
78
82
|
.map { |k, v| "ENV[#{k.inspect}] ||= #{v.inspect}" }.join("\n")
|
data/lib/everywhere/paths.rb
CHANGED
|
@@ -45,5 +45,13 @@ module Everywhere
|
|
|
45
45
|
def cargo_target_dir
|
|
46
46
|
File.join(cache_dir, "shell-target")
|
|
47
47
|
end
|
|
48
|
+
|
|
49
|
+
# Where a build runner installs the APP's gems (BUNDLE_PATH), so CI can
|
|
50
|
+
# cache them across builds of the same app. Local builds never use this —
|
|
51
|
+
# dev machines keep their own bundler setup; the runner opts in by setting
|
|
52
|
+
# EVERY_BUNDLE_PATH (see Commands::Build#bundle_env).
|
|
53
|
+
def app_bundle_dir
|
|
54
|
+
File.join(cache_dir, "bundle")
|
|
55
|
+
end
|
|
48
56
|
end
|
|
49
57
|
end
|
data/lib/everywhere/shellout.rb
CHANGED
|
@@ -17,8 +17,10 @@ module Everywhere
|
|
|
17
17
|
UI.die!("command failed: #{cmd.join(" ")}") unless success
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def run?(*cmd)
|
|
21
|
-
|
|
20
|
+
def run?(*cmd, chdir: Dir.pwd, quiet: false)
|
|
21
|
+
opts = { chdir: chdir }
|
|
22
|
+
opts.update(out: File::NULL, err: File::NULL) if quiet
|
|
23
|
+
unbundled { system(*cmd, **opts) }
|
|
22
24
|
end
|
|
23
25
|
|
|
24
26
|
# Run a command and capture its combined stdout+stderr. Returns
|
data/lib/everywhere/version.rb
CHANGED