mirror of
https://github.com/kennethreitz/bake.git
synced 2026-06-05 23:00:17 +00:00
cleanup
This commit is contained in:
@@ -6,6 +6,8 @@ format:
|
||||
full-install: system-deps install
|
||||
install: node-deps python-deps
|
||||
|
||||
env:
|
||||
env
|
||||
|
||||
argv-example:
|
||||
set -eux
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ class TaskScript:
|
||||
if silent:
|
||||
script = shlex_quote(f"{tf} {args}")
|
||||
else:
|
||||
script = shlex_quote(f"{tf} {args}")
|
||||
script = shlex_quote(f"{tf} {args} 2>&1 | bake-indent")
|
||||
cmd = f"bash --init-file {shlex_quote(stdlib_path)} -i -c {script} "
|
||||
|
||||
if debug:
|
||||
|
||||
+14
-8
@@ -38,7 +38,13 @@ def indent(line):
|
||||
)
|
||||
@click.option("--debug", default=False, is_flag=True, hidden=True)
|
||||
@click.option("--shellcheck", default=False, is_flag=True, hidden=False)
|
||||
@click.option("--whitelist", default=False, nargs=1, hidden=False)
|
||||
@click.option(
|
||||
"--whitelist",
|
||||
default=False,
|
||||
nargs=1,
|
||||
hidden=False,
|
||||
help="Whitelist an environment variable for use with --secure (persists between runs).",
|
||||
)
|
||||
@click.option("--yes", is_flag=True, help="Set prompts to yes.")
|
||||
@click.option(
|
||||
"--fail",
|
||||
@@ -48,10 +54,10 @@ def indent(line):
|
||||
help="Fail immediately, if any task fails.",
|
||||
)
|
||||
@click.option(
|
||||
"--secure",
|
||||
"--insecure",
|
||||
is_flag=True,
|
||||
type=click.BOOL,
|
||||
help="Ignore parent shell's environment variables.",
|
||||
help="Use parent shell's environment variables.",
|
||||
)
|
||||
@click.argument(
|
||||
"arguments",
|
||||
@@ -80,7 +86,7 @@ def task(
|
||||
shellcheck,
|
||||
debug,
|
||||
silent,
|
||||
secure,
|
||||
insecure,
|
||||
no_color,
|
||||
whitelist,
|
||||
yes,
|
||||
@@ -107,7 +113,7 @@ def task(
|
||||
|
||||
bakefile = Bakefile.find(root=".", filename=bakefile)
|
||||
|
||||
if secure:
|
||||
if not insecure:
|
||||
for key in bakefile.environ:
|
||||
if key not in SAFE_ENVIRONS:
|
||||
del bakefile.environ[key]
|
||||
@@ -158,9 +164,9 @@ def task(
|
||||
def execute_task(task, *, next_task=None, silent=False):
|
||||
if not silent:
|
||||
click.echo(
|
||||
crayons.white(" · ")
|
||||
crayons.white(" + ")
|
||||
+ crayons.yellow(f"Executing {task}")
|
||||
+ crayons.white(" · ")
|
||||
+ crayons.white(":")
|
||||
)
|
||||
return_code = task.execute(yes=yes, next_task=next_task, silent=silent)
|
||||
|
||||
@@ -180,7 +186,7 @@ def task(
|
||||
|
||||
if not silent:
|
||||
click.echo(
|
||||
crayons.white(" · ") + crayons.green("Done") + crayons.white(" · ")
|
||||
crayons.white(" + ") + crayons.green("Done") + crayons.white(".")
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ "$(uname)" == Darwin ]; then
|
||||
bashf-sed() { command sed -l "$@"; }
|
||||
bake-sed() { command sed -l "$@"; }
|
||||
else
|
||||
bashf-sed() { command sed -u "$@"; }
|
||||
bake-sed() { command sed -u "$@"; }
|
||||
fi
|
||||
|
||||
# Syntax sugar.
|
||||
bashf-indent() {
|
||||
bashf-sed "s/^/ /"
|
||||
bake-indent() {
|
||||
bake-sed "s/^/ /"
|
||||
}
|
||||
|
||||
# ---------------------
|
||||
# From: https://github.com/heroku/buildpack-stdlib/blob/master/stdlib.sh
|
||||
|
||||
# Buildpack Steps.
|
||||
puts_step() {
|
||||
bake-step() {
|
||||
if [[ "$*" == "-" ]]; then
|
||||
read -r output
|
||||
else
|
||||
@@ -26,7 +26,7 @@ puts_step() {
|
||||
}
|
||||
|
||||
# Buildpack Error.
|
||||
puts_error() {
|
||||
bake-error() {
|
||||
if [[ "$*" == "-" ]]; then
|
||||
read -r output
|
||||
else
|
||||
@@ -36,7 +36,7 @@ puts_error() {
|
||||
}
|
||||
|
||||
# Buildpack Warning.
|
||||
puts_warn() {
|
||||
bake-warn() {
|
||||
if [[ "$*" == "-" ]]; then
|
||||
read -r output
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user