mirror of
https://github.com/kennethreitz/bake.git
synced 2026-06-05 23:00:17 +00:00
i love this
This commit is contained in:
+14
-2
@@ -144,6 +144,8 @@ class TaskScript(BaseAction):
|
||||
if line.startswith(indent_style):
|
||||
return line[len(indent_style) :]
|
||||
|
||||
return line
|
||||
|
||||
def temp_source(self):
|
||||
tf = mkstemp(suffix=".sh", prefix="bashf-")[1]
|
||||
|
||||
@@ -170,17 +172,27 @@ class TaskScript(BaseAction):
|
||||
script = shlex_quote(f"{tf} {args} 2>&1 | bake-indent")
|
||||
cmd = f"bash --init-file {shlex_quote(stdlib_path)} -i -c {script}"
|
||||
|
||||
return_code = os.system(cmd)
|
||||
|
||||
if debug:
|
||||
click.echo(f"$ {cmd}", err=True)
|
||||
else:
|
||||
os.remove(tf)
|
||||
|
||||
return os.system(cmd)
|
||||
return return_code
|
||||
|
||||
def shellcheck(self, *, silent=False, debug=False, **kwargs):
|
||||
tf = self.temp_source()
|
||||
cmd = f"shellcheck {shlex_quote(tf)} --external-sources --format=json"
|
||||
|
||||
c = delegator.run(cmd)
|
||||
|
||||
if debug:
|
||||
click.echo(f"$ {cmd}", err=True)
|
||||
return delegator.run(cmd)
|
||||
else:
|
||||
os.remove(tf)
|
||||
|
||||
return c
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
||||
Vendored
+5
-2
@@ -2,9 +2,12 @@ test1: test2 test3
|
||||
source ./
|
||||
test2: test3
|
||||
echo '2'
|
||||
test3:
|
||||
echo '3'
|
||||
test3: echo
|
||||
echo 'hm'
|
||||
|
||||
python:
|
||||
#!/usr/bin/env python
|
||||
print('wow!')
|
||||
|
||||
echo:
|
||||
echo 'hi, kenneth!'
|
||||
|
||||
@@ -11,3 +11,8 @@ def test_first_level_dep(bake):
|
||||
def test_second_level_dep(bake):
|
||||
c = bake("needs-needs", fixture="1")
|
||||
assert "kenneth" in c.out
|
||||
|
||||
|
||||
def test_python_invocation(bake):
|
||||
c = bake("python", fixture="1")
|
||||
assert "wow" in c.out
|
||||
|
||||
Reference in New Issue
Block a user