dev: configure a dev run in dev.ru, not the rake task
dev.ru hands ProTacts a Config built on dev defaults, and exported variables still win;
the Rakefile keeps only the data directory and log, the parts it sets up before rackup begins.
The jj change id is read again every time entr reloads,
so a `jj new` shows up in the footer after the next restart it does.
Assisted-by: Claude Opus 5 via Claude Code
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
diff --git a/Rakefile b/Rakefile
index 7ed2d41..36bf003 100644
--- a/Rakefile
+++ b/Rakefile
@@ -28,14 +28,6 @@ task :dev do
# log/exchange.log stays the deployment default. An exported
# PRO_TACTS_EXCHANGE_LOG (e.g. stderr) wins over both.
ENV["PRO_TACTS_EXCHANGE_LOG"] ||= "log/dev.log"
- ENV["PRO_TACTS_INSTANCE_NAME"] ||= "pro-tacts (dev)"
- ENV["PRO_TACTS_FAVICON"] ||= "/favicon-dev.svg"
- ENV["PRO_TACTS_ACCENT"] ||= "ink-blue"
- # The change being worked on names a dev build, the way a release's tag
- # names an image; a change id holds still while its content is edited.
- change = `jj log --no-graph -r @ -T 'change_id.short()'`
- fail "jj could not name the working-copy change" unless $?.success?
- ENV["VERSION"] ||= change
File.truncate("log/dev.log", 0) if File.exist?("log/dev.log")
Dir.mktmpdir("pro-tacts-dev") do |dir|
diff --git a/dev.ru b/dev.ru
index c479cc3..067419e 100644
--- a/dev.ru
+++ b/dev.ru
@@ -3,7 +3,22 @@
require "pathname"
$LOAD_PATH.unshift(Pathname.new(__dir__) / "lib")
+require "pro_tacts"
require "pro_tacts/dev_login"
+# The change being worked on names a dev build, the way a release's tag
+# names an image; a change id holds still while its content is edited.
+change = `jj log --no-graph -r @ -T 'change_id.short()'`
+fail "jj could not name the working-copy change" unless $?.success?
+
+# What marks a dev run, set before config.ru reads the config. An
+# exported variable still wins over each.
+ProTacts.config = ProTacts::Config.new({
+ "PRO_TACTS_INSTANCE_NAME" => "pro-tacts (dev)",
+ "PRO_TACTS_FAVICON" => "/favicon-dev.svg",
+ "PRO_TACTS_ACCENT" => "ink-blue",
+ "VERSION" => change,
+}.merge(ENV))
+
use ProTacts::DevLogin
run Rack::Builder.parse_file(File.expand_path("config.ru", __dir__))