Skip to content

Commit

Permalink
Use make to coordinate the build (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
f-f authored Apr 26, 2021
1 parent 0b6fa78 commit ec0a8c3
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 15 deletions.
17 changes: 10 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,22 @@ If you wish to contribute documentation, [this is a suggested read](https://www.

## Developing `spago`

If you'd like to develop spago locally, the recommended tool to use is [stack][stack]
If you'd like to develop spago locally, the recommended tool to use is [stack][stack].

To compile the project from source you can do
We use `make` to coordinate the build, here's a compilation of useful targets:

```bash
# To compile the project from source:
$ make
$ stack build --fast
```

To install the version you're developing system-wide, do
# File-watching build:
$ make dev

```bash
$ stack install
# Running tests:
$ make test

# Installing system-wide the current build:
$ make install
```

If you edit any title in the readme, run `doctoc` to update the Table of Contents:
Expand Down
20 changes: 13 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
all: fetch-templates
all: build

fetch-templates:
@curl https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/docs-search-app.js -o templates/docs-search-app-0.0.10.js
@curl https://github.com/purescript/purescript-docs-search/releases/download/v0.0.10/purescript-docs-search -o templates/purescript-docs-search-0.0.10
@chmod +x templates/purescript-docs-search-0.0.10
@curl https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/docs-search-app.js -o templates/docs-search-app-0.0.11.js
@curl https://github.com/purescript/purescript-docs-search/releases/download/v0.0.11/purescript-docs-search -o templates/purescript-docs-search-0.0.11
@chmod +x templates/purescript-docs-search-0.0.11
@./scripts/fetch-templates

dev: fetch-templates
@stack build --fast --file-watch

build: fetch-templates
@stack build --fast

test: fetch-templates
@stack test --fast --pedantic

install: build
@stack install --fast
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ npm install -g spago

Other installation methods available:
- Download the binary from the [latest GitHub release][spago-latest-release]
- Compile from source by cloning this repo and running `stack install`
- Compile from source by cloning this repo and running `make install`
- With Nix, using [easy-purescript-nix][spago-nix]
- On FreeBSD, install with `pkg install hs-spago`.

Expand Down
17 changes: 17 additions & 0 deletions scripts/fetch-templates
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

templatesDir="./templates"
versions="0.0.10 0.0.11"
for version in $versions; do
file1="${templatesDir}/docs-search-app-${version}.js"
if [ ! -f "${file1}" ]; then
echo "Fetching ${file1}";
curl "https://github.com/purescript/purescript-docs-search/releases/download/v${version}/docs-search-app.js" -o ${file1}
fi
file2="${templatesDir}/purescript-docs-search-${version}"
if [ ! -f "${file2}" ]; then
echo "Fetching ${file2}";
curl "https://github.com/purescript/purescript-docs-search/releases/download/v${version}/purescript-docs-search" -o ${file2}
chmod +x "${file2}"
fi
done

0 comments on commit ec0a8c3

Please sign in to comment.