~/bend-docscommunity

src/pub/plan.bend fails

raw source on the hub · import 0x74799d3f846634a3d7461d4336d7c9d4/src/pub/plan.bend as Plan

pub/plan: the planner for ez publish, pure. It reads a World (pub/world.bend) and either asks the questions still open or makes the plan. The package is sent to the hub by bend --publish, which is the only thing that can send it, but the 0x name ez reports is the one the package walk (pkg/pkg.bend) computed from the files, never the one bend printed. Reading bend's output is a check, not a lookup: ez already knows the answer before bend runs, and what bend says is compared against it.

Publishing is irreversible and public, so every check that can be made before the upload is made first, in this order: there is a ledger that parses, and it names the entry, and the name it publishes under, if any, is one bend takes (EZ-PUB-3); git answers git status --porcelain --untracked-files=normal about the project and names no path (EZ-PUB-1); the walk from the entry makes a package; git tracks every file of that package; and the hub the ledger names has every hub package the package imports (EZ-PUB-5). Only then is the upload asked for, and its answer is checked against ez's hash (EZ-PUB-2). bend cannot report a package's hash without uploading it, so that check comes after the upload, and a disagreement exits 1 with no import line rather than taking the upload back.

Each stage of decide reads what it needs from the World itself rather than from the stage before, so a law about one stage holds of every World whatever the others say.

12 imports
import Base
import ../lock/plan.bend as P
import ../tool/world.bend as TW
import ../ledger/manifest.bend as M
import ../pkg/pkg.bend as K
import ../pkg/path.bend as Path
import ../git/git.bend as G
import ./world.bend as PW
import ./blurb.bend as B
import ../lock/lock.bend as L
import ../share/sha.bend as Sha
import ../io/file.bend as F