Skip to content

Commit

Permalink
makesure_stable should not be changed before the release #60
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Sep 29, 2021
1 parent d3e70ab commit ddc8bd1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 606 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: "run tests"
run: |
./makesure_stable tested_awks
./makesure tested_awks
macos_gawk:
name: "Run tests macos / gawk"
Expand All @@ -41,7 +41,7 @@ jobs:
- name: "run tests"
run: |
brew install gawk # TODO understand if this step can be cached
./makesure_stable
./makesure
win:
name: "Run tests Win"
Expand All @@ -60,4 +60,4 @@ jobs:

- name: "run tests"
run: |
& bash -e -c "./makesure_stable"
& bash -e -c "./makesure"
24 changes: 12 additions & 12 deletions Makesurefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,29 @@
MAKESURE=makesure \
run_tush_file "$ITEM"

@goal tested_stable @glob tests/*.tush @private
@goal tested_candidate @glob tests/*.tush @private
@depends_on prepared4tests
@use_lib testing_tush
MAKESURE=makesure_stable \
MAKESURE=makesure_candidate \
run_tush_file "$ITEM"

@goal stable
@doc rebuilds makesure_stable & README.md for release
@depends_on makesure_stable
@goal candidate
@doc rebuilds makesure_candidate & README.md for release
@depends_on makesure_candidate
awk '
/^\$ \.\/makesure -h$/ { print; stop=1; system("./makesure_stable -h") }
/^\$ \.\/makesure -h$/ { print; stop=1; system("./makesure_candidate -h") }
/^```$/ { stop=0 }
!stop' README.md > README.md.1
mv README.md.1 README.md

@goal makesure_stable @private
@doc compiles makesure_stable
@goal makesure_candidate @private
@doc compiles makesure_candidate
@depends_on tested
@depends_on stable_version_prepared
@depends_on tested_stable
@depends_on candidate_version_prepared
@depends_on tested_candidate

#TODO ^V this should be more pure
@goal stable_version_prepared @private
@goal candidate_version_prepared @private
{
echo '#!/bin/sh'
echo "if command -v gawk >/dev/null;then AWK='gawk -ltime -v Gawk=1'; X='';else AWK=awk; X='function gettimeofday(){}';fi"
Expand All @@ -137,7 +137,7 @@ in_begin && $1 ~ /^split/ { next }
/^function gettimeofday/ { next }
{ gsub("\\s*#.+$", ""); gsub(Q, Q "\\" Q Q); if (trim($0)) print}' makesure.awk
echo \''"$X" Makesurefile "$@"'
} > makesure_stable
} > makesure_candidate

@goal default
@doc calls 'tested' goal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Usage: makesure [options...] [-f buildfile] [goals...]
Since `makesure` is a tiny utility represented by a single file, the recommended installation strategy is to keep it local to a project where it's used (this means in code repository). Not only this eliminates the need for repetitive installation for every dev on a project, but also allows using separate `makesure` version per project and update only as needed.

```shell
wget "https://raw.githubusercontent.com/xonixx/makesure/main/makesure_stable?token=$(date +%s)" -Omakesure && \
wget "https://raw.githubusercontent.com/xonixx/makesure/main/makesure?token=$(date +%s)" -Omakesure && \
chmod +x makesure && echo "makesure $(./makesure -v) installed"
```

Expand Down
2 changes: 1 addition & 1 deletion docs/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [makesure_candidate](../makesure_candidate)
- **what:** self-contained sh script, that embeds the `makesure.awk` content as AWK CLI argument
- **why** the final tool requires some sh additions to correctly initialize the core. Serves a candidate for next release. Need this as separate entity to be able to test the compiled version of a tool.
- **how** is generated via `./makesure candidate` TODO link
- **how** is generated via `./makesure candidate` from `makesure.awk`.
- [makesure](../makesure)
- **what** contains a latest released version of a tool
- **why** this one should be very stable and only change with a new release published. Serves the source of `./makesure --self-update`. *Should only change when the `makesure` version is incremented!*
Expand Down
2 changes: 1 addition & 1 deletion makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ function currentTimeMillis( script, res) {
}

function selfUpdate( url, tmp, err, newVer) {
url = "https://raw.githubusercontent.com/xonixx/makesure/main/makesure_stable?token=" rand()
url = "https://raw.githubusercontent.com/xonixx/makesure/main/makesure?token=" rand()
tmp = executeGetLine("mktemp /tmp/makesure_new.XXXXXXXXXX")
err = dl(url, tmp)
if (!err && !ok("chmod +x " tmp)) err = "can't chmod +x " tmp
Expand Down
Loading

0 comments on commit ddc8bd1

Please sign in to comment.