c3f271481a
Prior to this patch, Dotbot was relying on running with the base directory being the current working directory. In practice, it was relying on the install shim to set up this context. It makes more sense sense to actually execute `chdir()` within Dotbot itself, rather than relying on the install shim to do so.
28 lines
556 B
Bash
28 lines
556 B
Bash
test_description='plugin loading works'
|
|
. '../test-lib.bash'
|
|
|
|
test_expect_success 'setup' '
|
|
cat > ${DOTFILES}/test.py <<EOF
|
|
import dotbot
|
|
import os.path
|
|
|
|
class Test(dotbot.Plugin):
|
|
def can_handle(self, directive):
|
|
return directive == "test"
|
|
|
|
def handle(self, directive, data):
|
|
with open(os.path.expanduser("~/flag"), "w") as f:
|
|
f.write("it works")
|
|
return True
|
|
EOF
|
|
'
|
|
|
|
test_expect_success 'run' '
|
|
run_dotbot --plugin ${DOTFILES}/test.py <<EOF
|
|
- test: ~
|
|
EOF
|
|
'
|
|
|
|
test_expect_success 'test' '
|
|
grep "it works" ~/flag
|
|
'
|