Module: Everywhere::Paths
- Defined in:
- lib/everywhere/paths.rb
Overview
Filesystem locations the CLI resolves relative to the gem itself, so
every dev/build/release work in any project the gem is installed into.
Class Method Summary collapse
-
.android_dir ⇒ Object
Absolute path to the Android template, or nil when it isn't there.
-
.android_dir! ⇒ Object
Like #android_dir but aborts with a helpful message when the template is missing.
-
.android_fonts_dir ⇒ Object
Where the Material Symbols icon font is cached after its one-time fetch.
-
.android_gradle_home ⇒ Object
GRADLE_USER_HOME for shell builds.
-
.android_work_dir(application_id) ⇒ Object
The stamped copy of the Android template for one app, keyed by applicationId.
-
.app_bundle_dir ⇒ Object
Where a build runner installs the APP's gems (BUNDLE_PATH), so CI can cache them across builds of the same app.
-
.bundled_android_dir ⇒ Object
The Hotwire Native Android shell template bundled inside the gem: support/mobile/android/ holds a frozen Gradle project (wrapper committed) the CLI stamps per-app — everywhere.properties + assets + res, never a build script.
-
.bundled_desktop_dir ⇒ Object
The generic Tauri shell bundled inside the gem: support/desktop/ holds the src-tauri app and the splash/ dir it serves, alongside support/mobile/ios and support/mobile/android.
-
.bundled_ios_dir ⇒ Object
The Hotwire Native iOS shell template bundled inside the gem: support/mobile/ios/ holds a frozen Xcode project the CLI stamps per-app (xcconfig + everywhere.json + AppIcon — never the pbxproj).
-
.cache_dir ⇒ Object
Per-user cache dir.
-
.cargo_target_dir ⇒ Object
Where cargo writes the shell's build output (CARGO_TARGET_DIR) for apps on the fast path — the ones that declare no
native.desktop. -
.desktop_assets_dir(bundle_id) ⇒ Object
Where
every devstages native/desktop/assets for the running shell. -
.desktop_dev_app_dir(bundle_id) ⇒ Object
Where
every devkeeps the throwaway .app wrapper it runs the shell inside. -
.desktop_icon_dir(bundle_id) ⇒ Object
Where
every devstages the app's Dock icon for the running shell. -
.desktop_target_dir(bundle_id) ⇒ Object
CARGO_TARGET_DIR for a stamped shell.
-
.desktop_work_dir(bundle_id) ⇒ Object
The staged copy of the Tauri shell for one app, keyed by bundle id.
-
.gem_root ⇒ Object
The gem's own root — the dir holding lib/, exe/, support/.
-
.ios_derived_data_dir ⇒ Object
Where xcodebuild writes DerivedData for iOS shell builds.
-
.ios_dir ⇒ Object
Absolute path to the iOS template, or nil if the bundled copy is missing (a corrupt/partial install).
-
.ios_dir! ⇒ Object
Like #ios_dir but aborts with a helpful message when the template is missing.
-
.ios_packages_dir ⇒ Object
Where SPM clones the shell's package dependencies (hotwire-native-ios), so resolution is warm/offline after the first build.
-
.ios_work_dir(bundle_id) ⇒ Object
The stamped copy of the iOS template for one app.
-
.shell_dir ⇒ Object
Absolute path to the shell's src-tauri directory, or nil if the bundled copy is missing (a corrupt/partial install).
-
.shell_dir! ⇒ Object
Like #shell_dir but aborts with a helpful message when the shell is missing.
Class Method Details
.android_dir ⇒ Object
Absolute path to the Android template, or nil when it isn't there. Unlike #ios_dir, nil is the NORMAL state until the template lands — callers must read it as "Android isn't buildable in this release yet", not as a corrupt install. settings.gradle.kts is the marker because it's the one file every Gradle project must have at its root.
76 77 78 |
# File 'lib/everywhere/paths.rb', line 76 def android_dir bundled_android_dir if File.exist?(File.join(bundled_android_dir, "settings.gradle.kts")) end |
.android_dir! ⇒ Object
Like #android_dir but aborts with a helpful message when the template is missing. The --template-dir hint covers dev on a modified template.
82 83 84 85 |
# File 'lib/everywhere/paths.rb', line 82 def android_dir! android_dir or UI.die!("couldn't find the bundled Android template at #{bundled_android_dir}; " \ "reinstall ruby_everywhere or pass --template-dir") end |
.android_fonts_dir ⇒ Object
Where the Material Symbols icon font is cached after its one-time fetch. The font is ~10 MB, so it's fetched on first Android build instead of riding along in a 229 KB gem that most users never build Android with.
135 136 137 |
# File 'lib/everywhere/paths.rb', line 135 def android_fonts_dir File.join(cache_dir, "android-fonts") end |
.android_gradle_home ⇒ Object
GRADLE_USER_HOME for shell builds. Redirected here so the multi-GB Gradle distribution, the Android Gradle Plugin and the Hotwire artifacts are downloaded once and stay warm across every app — and never land inside the installed gem. Same trick as cargo_target_dir.
128 129 130 |
# File 'lib/everywhere/paths.rb', line 128 def android_gradle_home File.join(cache_dir, "android-gradle") end |
.android_work_dir(application_id) ⇒ Object
The stamped copy of the Android template for one app, keyed by applicationId. Persistent for the same reasons ios_work_dir is: Gradle's incremental state is path-sensitive, and the stamped project opens in Android Studio unmodified.
120 121 122 |
# File 'lib/everywhere/paths.rb', line 120 def android_work_dir(application_id) File.join(cache_dir, "android", application_id) end |
.app_bundle_dir ⇒ Object
Where a build runner installs the APP's gems (BUNDLE_PATH), so CI can cache them across builds of the same app. Local builds never use this — dev machines keep their own bundler setup; the runner opts in by setting EVERY_BUNDLE_PATH (see Commands::Build#bundle_env).
199 200 201 |
# File 'lib/everywhere/paths.rb', line 199 def app_bundle_dir File.join(cache_dir, "bundle") end |
.bundled_android_dir ⇒ Object
The Hotwire Native Android shell template bundled inside the gem: support/mobile/android/ holds a frozen Gradle project (wrapper committed) the CLI stamps per-app — everywhere.properties + assets + res, never a build script. Same freeze contract the iOS template has.
67 68 69 |
# File 'lib/everywhere/paths.rb', line 67 def bundled_android_dir File.join(gem_root, "support", "mobile", "android") end |
.bundled_desktop_dir ⇒ Object
The generic Tauri shell bundled inside the gem: support/desktop/ holds the
src-tauri app and the splash/ dir it serves, alongside support/mobile/ios
and support/mobile/android. This is the CANONICAL copy of the shell —
external consumers (e.g. the build-runner repo) resolve it via
every shell-dir. The CLI uses it unless the caller passes --shell-dir.
The directory is named for the platform; the reader keeps the "shell" wording because that's what the flag, the command and every caller call it.
25 26 27 |
# File 'lib/everywhere/paths.rb', line 25 def bundled_desktop_dir File.join(gem_root, "support", "desktop", "src-tauri") end |
.bundled_ios_dir ⇒ Object
The Hotwire Native iOS shell template bundled inside the gem: support/mobile/ios/ holds a frozen Xcode project the CLI stamps per-app (xcconfig + everywhere.json + AppIcon — never the pbxproj). The mobile/ parent leaves room for support/mobile/android later.
46 47 48 |
# File 'lib/everywhere/paths.rb', line 46 def bundled_ios_dir File.join(gem_root, "support", "mobile", "ios") end |
.cache_dir ⇒ Object
Per-user cache dir. Keeps heavy build state out of the gem and the app.
~ needs a home to expand against, and a container run with --user has
neither HOME nor a passwd entry.
90 91 92 93 94 |
# File 'lib/everywhere/paths.rb', line 90 def cache_dir File.(ENV["RUBYEVERYWHERE_HOME"] || "~/.rubyeverywhere") rescue ArgumentError UI.die!("couldn't resolve your home directory — set HOME or RUBYEVERYWHERE_HOME") end |
.cargo_target_dir ⇒ Object
Where cargo writes the shell's build output (CARGO_TARGET_DIR) for apps on
the fast path — the ones that declare no native.desktop. Redirected here
so cargo never dumps a multi-GB target/ into the installed gem, and so the
shell compiles warm across projects: with no app Rust in it the shell
source really is identical for everyone, so one shared target dir is safe
to reuse. An app that declares extensions gets desktop_target_dir instead,
because that premise stops holding the moment its crate graph differs.
191 192 193 |
# File 'lib/everywhere/paths.rb', line 191 def cargo_target_dir File.join(cache_dir, "shell-target") end |
.desktop_assets_dir(bundle_id) ⇒ Object
Where every dev stages native/desktop/assets for the running shell.
A staged copy rather than the source tree on purpose: the packaged app
reads ONE flat Resources/assets folder, and pointing dev at the nested
source would quietly resolve assets/branding/logo.png in a build and not
in dev. Staging runs the same DesktopAssets compiler both ways, so the two
can't drift. Keyed by bundle id like the mobile work dirs.
180 181 182 |
# File 'lib/everywhere/paths.rb', line 180 def desktop_assets_dir(bundle_id) File.join(cache_dir, "desktop-assets", bundle_id) end |
.desktop_dev_app_dir(bundle_id) ⇒ Object
Where every dev keeps the throwaway .app wrapper it runs the shell
inside. macOS reads the application name from CFBundleName, so a bare
cargo run binary shows up as the crate name — "example-shell" — in the
menu bar, the About/Hide/Quit items and the Dock. The wrapper exists only
to carry an Info.plist; the binary inside it is a hard link to cargo's.
163 164 165 |
# File 'lib/everywhere/paths.rb', line 163 def desktop_dev_app_dir(bundle_id) File.join(cache_dir, "desktop-app", bundle_id) end |
.desktop_icon_dir(bundle_id) ⇒ Object
Where every dev stages the app's Dock icon for the running shell. The
shaped master is derived from app.icon, so it's a build product, not the
app's own file — it belongs in the cache next to the rest of them.
170 171 172 |
# File 'lib/everywhere/paths.rb', line 170 def desktop_icon_dir(bundle_id) File.join(cache_dir, "desktop-icon", bundle_id) end |
.desktop_target_dir(bundle_id) ⇒ Object
CARGO_TARGET_DIR for a stamped shell. Per-app rather than shared, because the whole point of stamping is that this app's crate graph differs from every other app's — pointing them at one target dir would make cargo rebuild the world on every alternating build.
154 155 156 |
# File 'lib/everywhere/paths.rb', line 154 def desktop_target_dir(bundle_id) File.join(cache_dir, "desktop-target", bundle_id) end |
.desktop_work_dir(bundle_id) ⇒ Object
The staged copy of the Tauri shell for one app, keyed by bundle id.
Every app builds from one of these — cargo never runs inside the
installed gem, which may be root-owned — but only apps that declare
native.desktop get their Rust stamped in; everyone else's copy is
identical to the template and shares cargo_target_dir so the compile
stays warm across projects. Persistent for the same reason the mobile
work dirs are: a cold Tauri build is minutes where a warm one is seconds.
146 147 148 |
# File 'lib/everywhere/paths.rb', line 146 def desktop_work_dir(bundle_id) File.join(cache_dir, "desktop", bundle_id) end |
.gem_root ⇒ Object
The gem's own root — the dir holding lib/, exe/, support/. Correct whether the code runs from a git checkout or an installed gem.
13 14 15 |
# File 'lib/everywhere/paths.rb', line 13 def gem_root File.("../..", __dir__) end |
.ios_derived_data_dir ⇒ Object
Where xcodebuild writes DerivedData for iOS shell builds. Shared across apps like cargo_target_dir — safe because the product is always App.app; worst case a mismatch is a cache miss, never a wrong artifact.
106 107 108 |
# File 'lib/everywhere/paths.rb', line 106 def ios_derived_data_dir File.join(cache_dir, "ios-derived-data") end |
.ios_dir ⇒ Object
Absolute path to the iOS template, or nil if the bundled copy is missing (a corrupt/partial install).
52 53 54 |
# File 'lib/everywhere/paths.rb', line 52 def ios_dir bundled_ios_dir if File.exist?(File.join(bundled_ios_dir, "App.xcodeproj", "project.pbxproj")) end |
.ios_dir! ⇒ Object
Like #ios_dir but aborts with a helpful message when the template is missing. The --template-dir hint covers dev on a modified template.
58 59 60 61 |
# File 'lib/everywhere/paths.rb', line 58 def ios_dir! ios_dir or UI.die!("couldn't find the bundled iOS template at #{bundled_ios_dir}; " \ "reinstall ruby_everywhere or pass --template-dir") end |
.ios_packages_dir ⇒ Object
Where SPM clones the shell's package dependencies (hotwire-native-ios), so resolution is warm/offline after the first build.
112 113 114 |
# File 'lib/everywhere/paths.rb', line 112 def ios_packages_dir File.join(cache_dir, "ios-packages") end |
.ios_work_dir(bundle_id) ⇒ Object
The stamped copy of the iOS template for one app. Persistent (not a tmpdir) on purpose: a stable project path keeps Xcode's incremental state valid across builds, and users can open the stamped project in Xcode.
99 100 101 |
# File 'lib/everywhere/paths.rb', line 99 def ios_work_dir(bundle_id) File.join(cache_dir, "ios", bundle_id) end |
.shell_dir ⇒ Object
Absolute path to the shell's src-tauri directory, or nil if the bundled copy is missing (a corrupt/partial install).
31 32 33 |
# File 'lib/everywhere/paths.rb', line 31 def shell_dir bundled_desktop_dir if File.exist?(File.join(bundled_desktop_dir, "tauri.conf.json")) end |
.shell_dir! ⇒ Object
Like #shell_dir but aborts with a helpful message when the shell is missing. The --shell-dir hint covers dev on a modified shell checkout.
37 38 39 40 |
# File 'lib/everywhere/paths.rb', line 37 def shell_dir! shell_dir or UI.die!("couldn't find the bundled shell at #{bundled_desktop_dir}; " \ "reinstall ruby_everywhere or pass --shell-dir") end |