src/pub/run.bend relies on unsafe/foreign
raw source on the hub · import ezx@1.18.0.0/src/pub/run.bend as Run
pub/run: the interpreter for ez publish. It reads the directory the
project is in and the ledger's text into a World, then loops: it asks the
planner (pub/plan.bend) what is still open, answers each question, and adds
the answers to the World, until nothing is left to ask. Then it runs the
planner's plan with the lock's effect runner (Run.exec.plan), which prints
what a publish that agreed says, or exits 1 with the reason.
What git says of the project and a file's text are answered as the tool
commands answer them (ToolRun.answer). What git tracks is git ls-files
-v in the project, with paths written as they are rather than quoted. The
upload is bend <entry> --publish, followed by the <name>@<version> the
planner put in the question when the ledger names one, with the project's
packages on BEND_LIB, the way every other bend ez starts has them; the
planner asks for it last, once every other check has passed. Just before it
runs, the line the question carries, the hub description, goes to stderr,
where bend's own notices go, so stdout stays the hash and the import line.
Before that, the lock is read as a file, and a url under the hub is asked
for with the lock's own GET (Web.get), whose answer is a status line and
the text: whether the hub answered 200, and the body or why not.
It decides nothing; that it reads and executes faithfully is trusted in
ez/app.bend.
11 imports
import Base import snap@1.6.0.0/main.bend as R import ../io/file.bend as F import ../lock/run.bend as Run import ../tool/run.bend as ToolRun import ../tool/world.bend as TW import ../hub/get.bend as Net import ../share/env.bend as Env import ./world.bend as PW import ./plan.bend as PP import ../ws/run.bend as WsRun
Definitions
def ran source · line 35 · raw
@+out:String -> 0x2414c9622cab2353684d02a392804eb1/src/pub/world.Answer
what a program printed, and whether it exited 0
def answer source · line 39 · raw
@+lib:String -> @ask:0x2414c9622cab2353684d02a392804eb1/src/pub/world.Ask -> IO(0x2414c9622cab2353684d02a392804eb1/src/pub/world.Answer)
one question, answered
def answer.all source · line 68 · raw
@+lib:String -> @asks:List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pub/world.Ask> -> IO(List<&2, 0x2414c9622cab2353684d02a392804eb1/src/pub/world.Reply>)
every question, answered
def loop.step source · line 80 · raw
@st:0x2414c9622cab2353684d02a392804eb1/src/pub/plan.Step -> @+lib:String -> @world:0x2414c9622cab2353684d02a392804eb1/src/pub/world.World -> @go:(@_:0x2414c9622cab2353684d02a392804eb1/src/pub/world.World -> IO(Unit)) -> IO(Unit)
the planner's step: its questions answered and the loop gone round again, or its plan run
def rounds source · line 93 · raw
Nat
the rounds the loop may take. The walk asks for one file a round and cannot know how many the package holds until it has read them, so this is a guard against a planner that keeps asking, not a limit on a package: running out of it dies loudly.
def loop source · line 98 · raw
@fuel:Nat -> @+lib:String -> @+world:0x2414c9622cab2353684d02a392804eb1/src/pub/world.World -> IO(Unit)
the loop, under fuel. The walk asks for one file a round, so the fuel is a guard against a planner that keeps asking, not a limit on a package.
def run source · line 107 · raw
IO(Unit)
ez publish: the package the project's ledger names, checked, sent, and
the hash bend answered checked against ez's own