Skip to content

Commit

Permalink
0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Dec 5, 2020
1 parent bee7d9d commit 33038d4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
15 changes: 5 additions & 10 deletions makesure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

VERSION="0.9.1"
VERSION="0.9.2"

exec awk -v "Version=$VERSION" -f - Makesurefile "$@" <<'MAKESURE'
Expand Down Expand Up @@ -192,12 +192,6 @@ function do_work( i,j,goal_name,dep_cnt,dep,reached_if_condition,body,prelude
}
} else if ("-p" in Args || "--print" in Args) {
print Script
print "__resolved_goals() {"
for (i = 1; i <= resolved_goals[0]; i++) {
print " " resolved_goals[i]
}
print "}"
print "__resolved_goals"
} else {
cmd = Shell " -e"
print Script | cmd
Expand All @@ -222,11 +216,12 @@ function issue_resolved_goals_to_run(result, i, g, loop) {
die_msg("There is a loop in goal dependencies via " loop[1] " -> " loop[2])
}
issue_script_line("# resolved goals to execute")
issue_script_line("__resolved_goals() {")
for (i = 1; i <= result[0]; i++) {
issue_script_line(result[i])
issue_script_line(" " result[i])
}
issue_script_line("}")
issue_script_line("__resolved_goals")
}
function issue_script_line(line) {
Expand Down
15 changes: 5 additions & 10 deletions makesure_stable
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

VERSION="0.9.1"
VERSION="0.9.2"

exec awk -v "Version=$VERSION" -f - Makesurefile "$@" <<'MAKESURE'
Expand Down Expand Up @@ -192,12 +192,6 @@ function do_work( i,j,goal_name,dep_cnt,dep,reached_if_condition,body,prelude
}
} else if ("-p" in Args || "--print" in Args) {
print Script
print "__resolved_goals() {"
for (i = 1; i <= resolved_goals[0]; i++) {
print " " resolved_goals[i]
}
print "}"
print "__resolved_goals"
} else {
cmd = Shell " -e"
print Script | cmd
Expand All @@ -222,11 +216,12 @@ function issue_resolved_goals_to_run(result, i, g, loop) {
die_msg("There is a loop in goal dependencies via " loop[1] " -> " loop[2])
}
issue_script_line("# resolved goals to execute")
issue_script_line("__resolved_goals() {")
for (i = 1; i <= result[0]; i++) {
issue_script_line(result[i])
issue_script_line(" " result[i])
}
issue_script_line("}")
issue_script_line("__resolved_goals")
}
function issue_script_line(line) {
Expand Down
2 changes: 1 addition & 1 deletion tests/0.tush
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

$ cd "$MYDIR"; ./makesure -v; ./makesure --version
| 0.9.2
| 0.9.1
| 0.9.2

$ cd "$MYDIR"; ./makesure -f non-existent-file
@ makesure file not found: non-existent-file
Expand Down
6 changes: 6 additions & 0 deletions tests/1_goals.tush
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ $ cd "$MYDIR"; ./makesure -f tests/1_goals.sh
| aaa
| goal 'default' [empty].

$ cd "$MYDIR"; ./makesure -f tests/1_goals.sh fail
| goal 'fail' ...
| stdout
@ stderr
? 1

$ cd "$MYDIR"; ./makesure -f tests/1_goals.sh -p | bash
| goal 'bbb' [already satisfied].
| goal 'aaa' ...
Expand Down
1 change: 1 addition & 0 deletions tests/4_trace.tush
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $ cd "$MYDIR"; bash -c "./makesure -f tests/4_trace.sh -x 2> >(sed 's#\/.*\/test
@ + cd tests
@ + export A=aaa
@ + A=aaa
@ + __resolved_goals
@ + default
@ + bash -e
@ + echo A=aaa
Expand Down

0 comments on commit 33038d4

Please sign in to comment.