diff --git a/Makesurefile b/Makesurefile index 3086070..ea177b7 100644 --- a/Makesurefile +++ b/Makesurefile @@ -370,14 +370,23 @@ in_begin && $1 ~ /^split/ { next } @goal gh_release @doc 'publish Github release (draft)' - releaseTag="v$NEXT_VERSION" - echo - echo "Will publish a draft release for $releaseTag ..." - echo + fail () { echo >&2 "$@" exit 1 } + + prodVersion="$(./makesure -v)" + if [[ "$prodVersion" != "$NEXT_VERSION" ]] + then + fail "$prodVersion in ./makesure, must be $NEXT_VERSION. Please run './makesure release' and commit first." + fi + + releaseTag="v$NEXT_VERSION" + echo + echo "Will publish a draft release for $releaseTag ..." + echo + milestoneId=$(gh api -X GET "repos/xonixx/makesure/milestones" --jq '.[] | select(.title=="'$NEXT_VERSION'").number') if [[ -z $milestoneId ]] then diff --git a/README.md b/README.md index 07b95b4..87548ad 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ By default, all scripts inside goals are executed with `bash`. If you want to us ``` $ ./makesure -h -makesure ver. 0.9.16 +makesure ver. 0.9.17 Usage: makesure [options...] [-f buildfile] [goals...] -f,--file buildfile set buildfile to use (default Makesurefile) diff --git a/makesure b/makesure index 250cd5f..9fa23e5 100755 --- a/makesure +++ b/makesure @@ -1,6 +1,6 @@ #!/bin/sh if command -v gawk >/dev/null;then makesure_awk='gawk -ltime -v Gawk=1';makesure_pre='';else makesure_awk=awk;makesure_pre='function gettimeofday(){}';fi -exec $makesure_awk -v "Version=0.9.16" -v "Prog=$0" "$makesure_pre"' +exec $makesure_awk -v "Version=0.9.17" -v "Prog=$0" "$makesure_pre"' BEGIN { Shell = "bash" SupportedShells["bash"] @@ -111,7 +111,7 @@ function handleOptions( i) { } } function handleDefine() { - checkPreludeOnly() + started("define") $1 = "" handleDefineLine($0) } @@ -134,12 +134,10 @@ function handleShell() { if (!(Shell in SupportedShells)) addError("Shell '\''" Shell "'\'' is not supported") } -function adjustOptions() { - if ("silent" in Options) - delete Options["timing"] +function timingOn() { + return "timing" in Options && !("silent" in Options) } function started(mode) { - if (isPrelude()) adjustOptions() Mode = mode } function handleLib( libName) { @@ -326,7 +324,7 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) { print quote2(goalName) } } else { - if ("timing" in Options) + if (timingOn()) t0 = currentTimeMillis() addLine(definesLine, MyDirScript) addLine(definesLine, DefinesCode) @@ -362,7 +360,7 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) { } else { for (i = 0; i in resolvedGoals; i++) { goalName = resolvedGoals[i] - goalTimed = "timing" in Options && !reachedGoals[goalName] && !emptyGoals[goalName] + goalTimed = timingOn() && !reachedGoals[goalName] && !emptyGoals[goalName] if (goalTimed) t1 = t2 ? t2 : currentTimeMillis() if (!("silent" in Options)) @@ -377,7 +375,7 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) { if (exitCode != 0) break } - if ("timing" in Options) + if (timingOn()) print " total time " renderDuration((t2 ? t2 : currentTimeMillis()) - t0) if (exitCode != 0) realExit(exitCode) @@ -398,6 +396,7 @@ function resolveGoalsToRun(result, i, goalName, loop) { die("There is a loop in goal dependencies via " loop[1] " -> " loop[2]) } } +function isCodeAllowed() { return "goal"==Mode || "goal_glob"==Mode || "lib"==Mode } function isPrelude() { return "prelude"==Mode } function checkPreludeOnly() { if (!isPrelude()) addError("Only use " $1 " in prelude") } function checkGoalOnly() { if ("goal" != Mode && "goal_glob" != Mode) addError("Only use " $1 " in @goal") } @@ -434,9 +433,9 @@ function getMyDir(makesurefilePath) { return executeGetLine("cd \"$(dirname " quoteArg(makesurefilePath) ")\";pwd") } function handleCodeLine(line) { - if (isPrelude() && line !~ /^[ \t]*#/ && trim(line) != "") { + if (!isCodeAllowed() && line !~ /^[ \t]*#/ && trim(line) != "") { if (!ShellInPreludeErrorShown++) - addError("Shell code is not allowed in prelude area") + addError("Shell code is not allowed outside goals/libs") } else addCodeLine(line) } diff --git a/makesure_candidate b/makesure_candidate index 9027a6e..9fa23e5 100755 --- a/makesure_candidate +++ b/makesure_candidate @@ -1,6 +1,6 @@ #!/bin/sh if command -v gawk >/dev/null;then makesure_awk='gawk -ltime -v Gawk=1';makesure_pre='';else makesure_awk=awk;makesure_pre='function gettimeofday(){}';fi -exec $makesure_awk -v "Version=0.9.16" -v "Prog=$0" "$makesure_pre"' +exec $makesure_awk -v "Version=0.9.17" -v "Prog=$0" "$makesure_pre"' BEGIN { Shell = "bash" SupportedShells["bash"]