Skip to content

Commit

Permalink
Remove docs about --before and --then flags since they are not planne…
Browse files Browse the repository at this point in the history
…d anymore
  • Loading branch information
f-f committed Sep 22, 2024
1 parent fbfb548 commit 6d2f796
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 76 deletions.
18 changes: 0 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
58 changes: 0 additions & 58 deletions test/Spago/Build.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6d2f796

Please sign in to comment.