Effects.apply: def of near-v-framework@0.4.0.0 Import: import near-v-framework@0.4.0.0/domain/architecture/system/effects.bend as Effects Lines 277-308 of near-v-framework@0.4.0.0/domain/architecture/system/effects.bend: https://jend.leeeet.dev/read.txt?path=near-v-framework@0.4.0.0/domain/architecture/system/effects.bend&start_line=277&end_line=308 import Base import bend-kit-files@0.1.0.0/files.bend as Fs import near-v-framework@0.4.0.0/domain/architecture/system/effs/io.bend as X import near-v-framework@0.4.0.0/domain/architecture/system/plan/type.bend as P import near-v-framework@0.4.0.0/domain/architecture/system/plan/ops.bend as PO # ---- a deploy: carry out a plan with nothing blocked ---- def apply(+root: String, +bend: String, s: P.Step) -> IO(Unit): match s: case P.Current{_}: IO.print(PO.show(s)) case P.Publish{+n, +v, +e}: do IO: out : String <- X.run(bend, [root ++ "/" ++ e, "--publish", n ++ "@" ++ v]) IO.print(Bool.pick(String, String.contains(out, "published"), "published " ++ n ++ "@" ++ v, "failed publish " ++ n ++ "@" ++ v)) case P.Push{+r}: do IO: ok : Bool <- X.succeeds("git", ["-C", root, "push", "-q", "origin", "HEAD:main"]) IO.print(Bool.pick(String, ok, "pushed github " ++ r, "failed push github " ++ r)) case P.ReleasePlugin{+n, +v, +r, create}: do IO: ok : Bool <- release_plugin(root, n, v, r, create) IO.print(Bool.pick(String, ok, "released plugin " ++ n ++ "@" ++ v, "failed release plugin " ++ n ++ "@" ++ v)) case P.Rebuild{+h, +fl, +mac}: do IO: _ : Result<&1, &1, U32 & String, Unit> <- Fs.mkdir(root ++ "/nix") X.write(root ++ "/nix/flake.nix", fl) X.write(root ++ "/nix/mac.nix", mac) ok : Bool <- X.succeeds("sudo", ["-n", "/run/current-system/sw/bin/darwin-rebuild", "switch", "--flake", root ++ "/nix#" ++ h]) IO.print(Bool.pick(String, ok, "rebuilt nix-darwin " ++ h, "failed darwin-rebuild switch " ++ h)) case P.ServePort{+p, +t, ts}: do IO: ok : Bool <- X.succeeds(ts, ["serve", "--bg", "--yes", "--https=" ++ U32.show(p), t]) IO.print(Bool.pick(String, ok, "served :" ++ U32.show(p) ++ " -> " ++ t, "failed serve :" ++ U32.show(p))) case P.Change{_, _, _}: IO.pure(Unit, Unit{}) case P.Blocked{_, _}: IO.print(PO.show(s)) Uses (22): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.pick https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.bind https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.print https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=IO.pure https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.contains https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.show https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Unit https://jend.leeeet.dev/definition.txt?path=bend-kit-files@0.3.1.0/files.bend&name=mkdir https://jend.leeeet.dev/definition.txt?path=near-v-framework@0.4.0.0/domain/architecture/system/effects.bend&name=release_plugin https://jend.leeeet.dev/definition.txt?path=near-v-framework@0.4.0.0/domain/architecture/system/effs/io.bend&name=run https://jend.leeeet.dev/definition.txt?path=near-v-framework@0.4.0.0/domain/architecture/system/effs/io.bend&name=succeeds https://jend.leeeet.dev/definition.txt?path=near-v-framework@0.4.0.0/domain/architecture/system/effs/io.bend&name=write https://jend.leeeet.dev/definition.txt?path=near-v-framework@0.4.0.0/domain/architecture/system/plan/ops.bend&name=show https://jend.leeeet.dev/definition.txt?path=near-v-framework@0.4.0.0/domain/architecture/system/plan/type.bend&name=Step