Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Fix: Worktree setup failing when Ruby comes from mise
Damian Legawiecf2bd10ee3dad
diff --git a/CLAUDE.md b/CLAUDE.mdindex 1d86a7ebca..672d849612 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -61,7 +61,7 @@ It is deliberately **not** a member of this pnpm workspace — one lockfile and`storefront/.env.local` is regenerated on every boot with this worktree's API URL and the seeded publishable keys (read straight from Postgres — publishable tokens are plaintext), so a reseeded database can't leave a stale key behind. Anything you add below the marker line is preserved.-One-time machine setup: Homebrew `postgresql@18` running on :5432 (with a `postgres` superuser role), `mailpit` (`brew services start mailpit` — one instance serves every worktree), Ruby per `server/.ruby-version` (mise or rbenv), Node ≥ 24 with `npm i -g portless` (start the proxy once with `portless proxy start`, accepting sudo for :443), worktrunk, then `pnpm wt:template`.+One-time machine setup: Homebrew `postgresql@18` running on :5432 (with a `postgres` superuser role), `mailpit` (`brew services start mailpit` — one instance serves every worktree), Ruby per `server/.ruby-version` via [mise](https://mise.jdx.dev) (`mise settings add idiomatic_version_file_enable_tools ruby`, so it reads `.ruby-version`), Node ≥ 24 with `npm i -g portless` (start the proxy once with `portless proxy start`, accepting sudo for :443), worktrunk, then `pnpm wt:template`.| What changed | What to run (inside the worktree) || --- | --- |diff --git a/scripts/worktree/lib.sh b/scripts/worktree/lib.shindex 072d36dd29..a070b12c7a 100755--- a/scripts/worktree/lib.sh+++ b/scripts/worktree/lib.sh@@ -6,6 +6,13 @@# resources, e.g. from a post-remove hook running in the primary checkout.set -euo pipefail+# Hooks often run under long-lived parents (terminal multiplexers, editors)+# whose PATH predates the shell's version-manager setup, so resolve ruby and+# bundle through mise directly rather than trusting the inherited PATH.+if command -v mise >/dev/null; then+ eval "$(mise activate bash --shims)"+fi+TEMPLATE_DB="spree_worktree_template"STOREFRONT_REPO="https://github.com/spree/storefront.git"STOREFRONT_BRANCH="main"@@ -27,7 +34,22 @@ require_current_starter() {local missing=()local report- report=$(cd server && DATABASE_NAME=__dev_probe__ DATABASE_NAME_TEST=__test_probe__ ruby -ryaml -rerb -e '+ # Every fresh clone brings its own .mise.toml, which mise refuses until it is+ # trusted, and the starter moves to new Ruby releases on its own schedule.+ if command -v mise >/dev/null; then+ [ -f server/.mise.toml ] && mise trust --quiet server/.mise.toml+ (cd server && mise install --quiet)+ fi++ # The probe below hides its errors, so a Ruby that cannot start would read as+ # every check failing.+ if ! (cd server && ruby -e '' 2>/dev/null); then+ echo "Ruby $(cat server/.ruby-version) (from server/.ruby-version) is not installed." >&2+ echo "Install it with your Ruby version manager — with mise: (cd server && mise install)" >&2+ return 1+ fi++ report=$(cd server && DATABASE_NAME=__dev_probe__ DATABASE_NAME_TEST=__test_probe__ ruby -E UTF-8 -ryaml -rerb -e 'config = YAML.safe_load(ERB.new(File.read("config/database.yml")).result, aliases: true)puts "dev" if config.dig("development", "database") == "__dev_probe__"puts "test" if config.dig("test", "database") == "__test_probe__"