Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jefftriplett/scripts-to-rule-them-all

⚙ Scripts To Rule Them All
https://github.com/jefftriplett/scripts-to-rule-them-all

Last synced: about 14 hours ago
JSON representation

⚙ Scripts To Rule Them All

Awesome Lists containing this project

README

        

# Scripts To Rule Them All

This is a WIP repo to form some opinions on my own version of the "[Scripts To Rule Them All][Scripts To Rule Them All]" standard for my projects.

I'm using [just][casey/just] instead of Make or external files because it fits my brain better.
It also allows me to avoid `make` vs. `gmake` differences.

When my `just` recipes get too large, I turn them into an external file stored in a `scripts` folder, and I call them from a `just` recipe.
This can be `scripts/bootstrap.sh` or `scripts/bootstrap.py`, depending on which language the recipe is written in.

## Usage

```shell
❯ just
Available recipes:
bootstrap *ARGS # installs/updates all dependencies
check # run '--fmt' in "check" mode.
cibuild # invoked by continuous integration servers to run tests
console # opens a console
docs # updates our README when justfile changes
fmt # format and overwrite justfile
format # alias for `fmt`
lint # check/lint our project
server # starts app
setup # sets up a project to be used for the first time
test # runs tests
update # updates a project to run at its current version

```

### Summary view

The summary view might be nice for linting or scripting to see what options are available with less parsing.

```shell
❯ just --summary
bootstrap check cibuild console docs fmt lint server setup test update

```

## Recipes

### bootstrap recipe

```shell
$ just bootstrap
```

source

```shell
# installs/updates all dependencies
@bootstrap *ARGS:
#!/usr/bin/env bash

set -euo pipefail

# we use cogapp to update our README
pip install cogapp

# setup our project defaults if they exist
if [ ! -f ".env" ]; then
echo ".env created"
cp .env.example .env
fi

if [ ! -f "docker-compose.override.yml" ]; then
echo "docker-compose.override.yml created"
cp docker-compose.override.yml.example docker-compose.override.yml
fi

# [ ] uncomment if we are using Docker
# docker-compose {{ ARGS }} build --force-rm

# [ ] uncomment if we are using pre-commit
# python -m pip install --upgrade pre-commit
```

### check recipe

```shell
$ just check
```

source

```shell
# run '--fmt' in "check" mode.
@check:
just --check --fmt --unstable
```

### cibuild recipe

```shell
$ just cibuild
```

source

```shell
# invoked by continuous integration servers to run tests
@cibuild:
echo "TODO: cibuild"
```

### console recipe

```shell
$ just console
```

source

```shell
# opens a console
@console:
echo "TODO: console"
```

### docs recipe

```shell
$ just docs
```

source

```shell
# updates our README when justfile changes
@docs:
pipx run --spec cogapp cog -r README.md
```

### fmt recipe

```shell
$ just fmt
```

source

```shell
# format and overwrite justfile
@fmt:
just --fmt --unstable
```

### lint recipe

```shell
$ just lint
```

source

```shell
# check/lint our project
@lint:
pipx run --spec cogapp cog --check README.md
```

### server recipe

```shell
$ just server
```

source

```shell
# starts app
@server:
echo "TODO: server"
```

### setup recipe

```shell
$ just setup
```

source

```shell
# sets up a project to be used for the first time
@setup:
echo "TODO: setup"
```

### test recipe

```shell
$ just test
```

source

```shell
# runs tests
@test:
echo "TODO: test"
```

### update recipe

```shell
$ just update
```

source

```shell
# updates a project to run at its current version
@update:
echo "TODO: update"
```

## Resources

- [Scripts to Rule Them All][Scripts to Rule Them All]
- [github/scripts-to-rule-them-all][github/scripts-to-rule-them-all]
- [casey/just][casey/just]

[casey/just]: https://github.com/casey/just
[github/scripts-to-rule-them-all]: https://github.com/github/scripts-to-rule-them-all
[Scripts to Rule Them All]: https://github.blog/2015-06-30-scripts-to-rule-them-all/