diff --git a/makesure.awk b/makesure.awk index 9854c12..658c4fe 100755 --- a/makesure.awk +++ b/makesure.awk @@ -35,6 +35,7 @@ BEGIN { srand() prepareArgs() ProgAbs = "" # absolute path to makesure executable + MakesurefileAbs = "" # absolute path to Makesurefile being called MyDirScript = "MYDIR=" quoteArg(getMyDir(ARGV[1])) ";export MYDIR;cd \"$MYDIR\"" Error = "" makesure() @@ -201,9 +202,11 @@ function handleCalls( i) { } function processCalls( i) { - for (i = 2; i <= NF; i++) - addCodeLine(quoteArg(ProgAbs) " " quoteArg($i)) -# addCodeLine("echo " quoteArg(ProgAbs) " " quoteArg($i)) + for (i = 2; i <= NF; i++) { + # addCodeLine("pwd; echo " quoteArg(ProgAbs) " --file " quoteArg(MakesurefileAbs) " " quoteArg($i)) +# addCodeLine("echo " quoteArg(ProgAbs) " --file " quoteArg(MakesurefileAbs) " " quoteArg($i)) + addCodeLine(quoteArg(ProgAbs) " --file " quoteArg(MakesurefileAbs) " " quoteArg($i)) + } } function registerUseLib(goalName) { @@ -570,12 +573,14 @@ function shellExec(script, comment, res) { return res } -function getMyDir(makesurefilePath, script,res,p) { - script = "echo \"$(cd \"$(dirname "(p=quoteArg(Prog))")\" && pwd)/$(basename "p")\";cd \"$(dirname " quoteArg(makesurefilePath) ")\";pwd" +function getMyDir(makesurefilePath, script,myDir,p,m,baseName) { + script = "echo \"$(basename "(m=quoteArg(makesurefilePath))")\";echo \"$(cd \"$(dirname "(p=quoteArg(Prog))")\" && pwd)/$(basename "p")\";cd \"$(dirname " m ")\";pwd" + script | getline baseName script | getline ProgAbs - script | getline res + script | getline myDir closeErr(script) - return res + MakesurefileAbs = myDir "/" baseName + return myDir } function handleCodeLine(line) { diff --git a/tests/32_calls.tush b/tests/32_calls.tush index ee7bbe5..40baa64 100644 --- a/tests/32_calls.tush +++ b/tests/32_calls.tush @@ -1,2 +1,7 @@ -$ ./$MAKESURE -f tests/32_calls.sh x-updated +$ touch /tmp/x ; ./$MAKESURE -f tests/32_calls.sh x-updated +| goal 'x-updated' ... +| goal 'x-deleted' ... +| running x-deleted +| goal 'x-created' ... +| running x-created