From 6d2f7966339ad4e62e76c5782eae0ad1360f78ec Mon Sep 17 00:00:00 2001 From: Fabrizio Ferrai <fabrizio.ferrai@gmail.com> Date: Sun, 22 Sep 2024 08:33:51 +0300 Subject: [PATCH] Remove docs about --before and --then flags since they are not planned anymore --- README.md | 18 -------------- test/Spago/Build.purs | 58 ------------------------------------------- 2 files changed, 76 deletions(-) diff --git a/README.md b/README.md index 8e87b19ea..46373625e 100644 --- a/README.md +++ b/README.md @@ -343,24 +343,6 @@ are ES modules, and you can just `import` them e.g. on Node. > $ spago build --output myOutput > ``` -To run a command before a build you can use the `--before` flag, eg to post a notification that a build has started: - -```console -$ spago build --before "notify-send 'Building'" -``` - -To run a command after the build, use `--then` for successful builds, or `--else` for unsuccessful builds: - -```console -$ spago build --then "notify-send 'Built successfully'" --else "notify-send 'Build failed'" -``` - -Multiple commands are possible - they will be run in the order specified: - -```console -$ spago build --before clear --before "notify-send 'Building'" -``` - If you want to run the program, just use `run`: ```console diff --git a/test/Spago/Build.purs b/test/Spago/Build.purs index e377b0d6c..fd47bb0ed 100644 --- a/test/Spago/Build.purs +++ b/test/Spago/Build.purs @@ -247,61 +247,3 @@ spec = Spec.around withTempDir do Monorepo.spec BuildInfo.spec - --- Spec.it "runs a --before command" \{ spago } -> do --- spago [ "init" ] >>= shouldBeSuccess --- let dumpFile = "testOutput" --- spago [ "build", "--before", "echo before>> " <> dumpFile ] >>= shouldBeSuccess --- test <- FS.readTextFile dumpFile --- test `Assert.shouldEqual` "before" - --- Spec.it "runs a --then command" \{ spago } -> do --- spago [ "init" ] >>= shouldBeSuccess --- let dumpFile = "testOutput" --- spago [ "build", "--then", "echo then>> " <> dumpFile, "--else", "echo else>> " <> dumpFile ] >>= shouldBeSuccess --- test <- FS.readTextFile dumpFile --- test `Assert.shouldEqual` "then" - --- Spec.it "runs a --before command before a --then command" \{ spago } -> do --- spago [ "init" ] >>= shouldBeSuccess --- let dumpFile = "testOutput" --- spago [ "build", "--before", "echo before>> " <> dumpFile, "--then", "echo then>> " <> dumpFile ] >>= shouldBeSuccess --- test <- FS.readTextFile dumpFile --- test `Assert.shouldEqual` "before\nthen" - --- Spec.it "runs an --else command if there is an error in the build" \{ spago } -> do --- spago [ "init" ] >>= shouldBeSuccess --- let dumpFile = "testOutput" --- FS.writeTextFile "src/Main.purs" "Invalid Purescript code" --- spago [ "build", "--then", "echo then>> " <> dumpFile, "--else", "echo else>> " <> dumpFile ] >>= shouldBeFailure --- test <- FS.readTextFile dumpFile --- test `Assert.shouldEqual` "else" - --- Spec.it "runs an --else command if there is an error in the run file" \{ spago } -> do --- spago [ "init" ] >>= shouldBeSuccess --- spago [ "install", "exceptions" ] >>= shouldBeSuccess --- let dumpFile = "testOutput" --- FS.writeTextFile "src/Main.purs" "module Main where\nimport Effect.Exception\nmain = throw \"error\"" --- spago [ "run", "--else", "echo else>> " <> dumpFile ] >>= shouldBeFailure --- test <- FS.readTextFile dumpFile --- test `Assert.shouldEqual` "else" - --- Spec.it "runs multiple commands in order" \{ spago } -> do --- spago [ "init" ] >>= shouldBeSuccess --- let dumpFile = "testOutput" --- spago [ "build", "--before", "echo before1>> " <> dumpFile, "--before", "echo before2>> " <> dumpFile, "--then", "echo then1>> " <> dumpFile, "--then", "echo then2>> " <> dumpFile ] >>= shouldBeSuccess --- test <- FS.readTextFile dumpFile --- test `Assert.shouldEqual` "before1\nbefore2\nthen1\nthen2" - --- Spec.it "fails the build if a --before command fails" \{ spago } -> do --- spago [ "init" ] >>= shouldBeSuccess --- spago [ "build", "--before", "exit 1" ] >>= shouldBeFailure - --- Spec.it "fails the build if a --then command fails" \{ spago } -> do --- spago [ "init" ] >>= shouldBeSuccess --- spago [ "build", "--then", "exit 1" ] >>= shouldBeFailure - --- Spec.it "still fails the build if an --else command fails" \{ spago } -> do --- spago [ "init" ] >>= shouldBeSuccess --- FS.writeTextFile "src/Main.purs" "Invalid Purescript code" --- spago [ "build", "--else", "exit 1" ] >>= shouldBeFailure