module

Hwaro::Utils::DevMarker

Constants

CONTENT = "This directory was written by `hwaro serve` and is not deployable.\nIts pages carry the dev server's base_url (e.g. http://127.0.0.1:3000).\nRun `hwaro build` and deploy that output instead.\n"

What the file says to whoever finds it in a directory listing or a deploy artifact. The first line is the greppable contract — it is what hwaro itself matches on (see present?), so CI can grep for it too.

FILENAME = ".hwaro-dev"
FIRST_LINE = CONTENT.lines.first

The greppable contract from CONTENT's first line, and the ONLY thing that makes a .hwaro-dev file a marker.

Instance methods

path(output_dir : String) : String
Source
present?(output_dir : String, *, fail_closed : Bool = true) : Bool

Content check, not just existence: static/.hwaro-dev is a legitimate (if unusual) file for a user to keep, and the build publishes it like any other hidden static file. Identifying the marker by FILENAME alone meant the published copy made hwaro deploy refuse the whole tree blaming a serve session that never ran, and the next build deleted the user's file right after the static copy put it there.

Only the FIRST line is compared: it is the documented contract, so a marker written by an older (or newer) hwaro whose explanatory body has drifted still counts. A user file whose first line happens to be exactly that sentence is treated as a marker — it is announcing itself as one, and that is the deliberate trade for not hashing whole bodies. fail_closed is the deploy/build-warn default: an unreadable file keeps its old existence-only meaning so we never ship (or silently treat as production) output we cannot rule out as serve output. Callers that would DELETE on a true result must pass false — the same true would invert into "clearable".

Source
remove(output_dir : String) : Nil

Guarded by present? for the same reason it now checks content: the build reads the marker BEFORE the static copy runs, so by the time it removes one the file standing there may be the user's own static/.hwaro-dev, freshly published over a genuine leftover.

Source
write(output_dir : String) : Nil
Source