Bake
Simple Bash build/project utility in the style of rake.
Not trying to reinvent wheel. Most node project Makefiles are just Bash scripts.
Installation
npm install bake-bash
Usage
Display tasks
bake
Run task
bake <task>
Example Bakefile
#. Builds the project #. Cleans the project #. Renders hello-template.sh
Rules
bake
searches the current and parent directories for aBakefile
to run.- Tasks are defined as normal Bash functions.
- A task description is simply a comment that starts with
#.
and precedes a function.
Functions
Prints a red error message.
bake-error <action> <description>
example: bake-error "compiling" "src/lib/test.coffee"
Prints a plain message.
bake-log <action> <description>
example: bake-log "bake" "Processing bakefile..."
Prints a green ok message.
bake-ok <action> <description>
example: bake-ok "compiling" "compiled src/lib/test.js"
Prints a cyan info message.
bake-info <action> <description>
example: bake-info "bake" "built project in 700ms"
Invokes a task only once.
bake-invoke <function_name>
example: bake-invoke "clean"
Determines if target is older than reference, returning 1 if outdated.
bake-outdated <target> <reference>
examples:
bake-outdated build src || return 1 # skip rest of task
outdated build src && invoke "compile" # compile if outdated
Renders a heredoc file template
bake-render-template template.sh > newfile.txt
Run a dynamic task when task $1
is not found. For example, to run
a test as the first argument to bake
, add this to Bakefile