Files
bake/README.md
T
2019-09-16 00:54:44 -04:00

146 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ☿ `bake`— the _strangely familiar_ task runner.
I love using `Makefile` for one-off tasks in projects. The problem with doing this, is you can't use familiar bashisms when doing so, as GNU Make doesn't use the familiar Bash syntax. This project seeks to bridge these worlds.
**WORK IN PROGRESS**
![vanity image](https://github.com/kennethreitz/bake/blob/master/ext/img.jpg?raw=true)
```console
$ bake -h
Usage: bake [OPTIONS] [TASK] [ARGUMENTS]...
bake — the strangely familiar taskrunner.
Options:
-b, --bakefile PATH The Bakefile to use.
-l, --list Lists available tasks.
--allow TEXT Whitelist an environment variable for use.
--yes Set mediumsecurity prompts to yes.
-c, --continue Continue, if a task fails.
--insecure Inherit parent shell's environment variables.
-s, --silent Reduce output.
-e, --environ-json TEXT Provide environment variables via JSON.
-j, --json Output in JSON format (stdout).
-h, --help Show this message and exit.
```
### Features 'n Things
- A `Bakefile`, which looks and feels like the good parts of a `Makefile`.
- Except, you can write real bash code!
- Environment variables are explicitly passed or whitelisted (allowed), not inherinted from the parent shell.
- Unlike `Makefile`, either tabs or 4 spaces can be used.
- Tasks can be run safely and reliably. Rest assured that scripts are executed from the project root (e.g. location of the `Bakefile`).
## `$ cat Bakefile`
```make
full-install: system-deps install
install: node-deps python-deps
format:
black .
python-argv:
#!/usr/bin/env python
from sys import argv
print(argv[1:])
bash-vars:
set -euxe
echo "HELLO, $WHO"
echo $@
python-deps:
pipenv install
node-deps:
yarn install
system-deps: @confirm
brew install pipenv
dangerous-example: @confirm:secure
rm -fr *
```
### `$ bake --list`
```console
- format
- python-argv
- bash-vars
- full-install
- install
- argv-example
- python-deps
- node-deps
- system-deps
- dangerous-example
```
### `$ bake --silent format`
```console
All done! ✨ 🍰 ✨
7 files left unchanged.
```
### `$ bake install`
```console
+ Executing 'node-deps':
yarn install v1.17.3
[1/4] 🔍 Resolving packages...
success Already up-to-date.
✨ Done in 0.03s.
+ Executing 'python-deps':
Installing dependencies from Pipfile.lock (2ee04c)…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 8/8 — 00:00:01
+ Done.
```
### `$ bake python-argv 1 2 3`
```console
+ Executing 'python-argv':
['1', '2', '3']
+ Done.
```
### `$ bake dangerous-example`
```console
+ Executing '@confirm:secure' ·
What is 10 times 2?: 7
Aborted.
```
## Simple Installation of `bake` (**MacOS**):
Coming soon!
```console
$ brew install kennethreitz/-/bake --HEAD
```
<!-- ![bake icon](https://github.com/kennethreitz/bake/blob/master/ext/bake.png?raw=true) -->
---------------------
<p align="center">
This repository has been brought to you, with much joy, by <a href="https://kennethreitz.org/">Kenneth Reitz</a>.
</p>
![kr soul icon](https://github.com/kennethreitz/bake/blob/master/ext/tattoo-design.jpg?raw=true)
<p align="center">
<em>As above, so below.
</p>