Win Script test for blob level

This commit is contained in:
bleeptrack 2020-09-10 12:03:46 +02:00
parent 75679c8bb1
commit 39d952528f
3 changed files with 18 additions and 2 deletions

7
levels/01-blob/win Normal file
View file

@ -0,0 +1,7 @@
BLOB_COUNT=$(git cat-file --batch-check='%(objectname) %(objecttype)' --batch-all-objects | grep blob | wc -l)
if [ "$BLOB_COUNT" -gt 2 ]; then
echo yes
else
echo no
fi

View file

@ -76,6 +76,11 @@ func load_level(id):
goal_repository.path = goal_repository_path
active_repository.path = active_repository_path
var win_script = level_prefix+level+"/win"
var win_script_target = game.tmp_prefix+"/win"
var dir = Directory.new()
dir.copy(win_script, win_script_target)
func construct_repo(script, path):
# Becase in an exported game, all assets are in a .pck file, we need to put
# the script somewhere in the filesystem.
@ -87,7 +92,7 @@ func construct_repo(script, path):
game.global_shell.run("mkdir " + path)
game.global_shell.cd(path)
game.global_shell.run("git init")
var o = game.global_shell.run("source "+script_path)
var o = game.global_shell.run("sh "+script_path)
if game.debug:
print(o)

View file

@ -41,10 +41,14 @@ func send_command_async(command):
func run_command_in_a_thread(command):
var o = repo.shell.run(command)
check_win_condition()
input.text = ""
output.text = output.text + "$ " + command + "\n" + o
repo.update_everything() # FIXME
repo.update_everything()
func receive_output(text):
output.text += text
func check_win_condition():
print( repo.shell.run("bash /tmp/win") )