You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -103,13 +103,6 @@ Updates `makesure` executable to latest available version in-place:
103
103
- MacOS
104
104
- Windows (via Git Bash)
105
105
106
-
#### AWK
107
-
108
-
The core of this tool is implemented in [AWK](https://en.wikipedia.org/wiki/AWK).
109
-
Almost all major implementations of AWK will work. Tested and officially supported are [Gawk](https://www.gnu.org/software/gawk/), [BWK](https://github.com/onetrueawk/awk), [mawk](https://invisible-island.net/mawk/). This means that the default AWK implementation in your OS will work.
110
-
111
-
Developed in [xonixx/intellij-awk](https://github.com/xonixx/intellij-awk).
112
-
113
106
## Concepts
114
107
115
108
- Build file is a text file named `Makesurefile`.
@@ -180,6 +173,7 @@ Example:
180
173
```sh
181
174
@define A hello
182
175
@define B "${A} world"
176
+
@define C 'hello world'
183
177
```
184
178
185
179
This directive is valid [in any place](tests/24_define_everywhere.sh) in `Makesurefile`. However, we recommend:
@@ -194,6 +188,16 @@ Overall the precedence for variables resolution is (higher priority top):
194
188
-`@define VAR 2` in `Makesurefile`
195
189
-`VAR=3 ./makesure`
196
190
191
+
The precedence priorities are designed like this on purpose, to prevent accidental override of `@define VAR='value'` definition in file by the environment variable with the same name. However, sometimes this is the desired behavior. In this case you can use:
192
+
193
+
```sh
194
+
@define VAR "${VAR}"# using the same name, or
195
+
@define VAR1 "${ENV_VAR}"# using different name, or
196
+
@define VAR2 "${VAR_NAME:-default_value}"# if need the default value when not set
197
+
```
198
+
199
+
This allows to use environment variables `VAR`, `ENV_VAR`, and `VAR_NAME` to set the value of `VAR`, `VAR1` and `VAR2`.
200
+
197
201
Please note, the parser of `makesure` is somewhat stricter here than shell's one:
198
202
```sh
199
203
@define HW ${HELLO}world # makesure won't accept
@@ -300,7 +304,7 @@ as equivalent for
300
304
301
305
So essentially one glob goal declaration expands to multiple goal declarations based on files present in project that match the glob pattern. Shell glob expansion mechanism applies.
302
306
303
-
The useful use case here would be to represent a set of test files as a set of goals. The example could be found in the project's own [build file](https://github.com/xonixx/makesure/blob/main/Makesurefile#L108).
307
+
The useful use case here would be to represent a set of test files as a set of goals. The example could be found in the project's own [build file](https://github.com/xonixx/makesure/blob/3be738d771bf855b5a6d3cd08cbc38dc977bed76/Makesurefile#L91).
304
308
305
309
Why this may be useful? Imagine in your nodejs application you have `test1.js`, `test2.js`, `test3.js`.
306
310
Now you can use this `Makesurefile`
@@ -347,7 +351,7 @@ Example:
347
351
@depends_on file_processed @args 'file3'
348
352
```
349
353
350
-
Having the above in `Makesurefile` will produce next output when ran with `./makesure all_files_processed`
354
+
Having the above in `Makesurefile` will produce next output when ran with `./makesure all_files_processed`:
351
355
```
352
356
goal 'file_downloaded@file1' ...
353
357
Downloading file1...
@@ -388,6 +392,30 @@ Processing file2...
388
392
389
393
You can also take a look at an [example from a real project](https://github.com/xonixx/intellij-awk/blob/68bd7c5eaa5fefbd7eaa9f5f5a4b77b69dcd8779/Makesurefile#L126).
390
394
395
+
Note, you can reference the `@define`-ed variables in the arguments of the parameterized goals:
396
+
397
+
```shell
398
+
@define HELLO 'hello'
399
+
400
+
@goal parameterized_goal @params ARG
401
+
echo"ARG=$ARG"
402
+
403
+
@goal goal1
404
+
@depends_on parameterized_goal @args HELLO # reference by name
Having the above in `Makesurefile` will produce next output when ran with `./makesure goal1`:
409
+
```
410
+
goal 'parameterized_goal@hello' ...
411
+
ARG=hello
412
+
goal 'parameterized_goal@hello world' ...
413
+
ARG=hello world
414
+
goal 'goal1' [empty].
415
+
```
416
+
417
+
Please find a more real-world example [here](https://github.com/xonixx/fhtagn/blob/e7161f92731c13b5afbc09c7d738c1ff4882906f/Makesurefile#L70).
418
+
391
419
For more technical consideration regarding this feature see [parameterized_goals.md](docs/parameterized_goals.md).
392
420
393
421
### @doc
@@ -659,6 +687,19 @@ echo 'Please reopen the shell to activate completion.'
659
687
660
688
Find some contributor instructions in [DEVELOPER.md](docs/DEVELOPER.md).
661
689
690
+
#### AWK
691
+
692
+
The core of this tool is implemented in [AWK](https://en.wikipedia.org/wiki/AWK).
693
+
Almost all major implementations of AWK will work. Tested and officially supported are [Gawk](https://www.gnu.org/software/gawk/), [BWK](https://github.com/onetrueawk/awk), [mawk](https://invisible-island.net/mawk/). This means that the default AWK implementation in your OS will work.
694
+
695
+
Developed in [xonixx/intellij-awk](https://github.com/xonixx/intellij-awk).
696
+
697
+
## Articles
698
+
699
+
-[Adding parameterized goals to makesure](https://maximullaris.com/parameterized_goals.html) (March 2023)
700
+
-[makesure vs make](https://maximullaris.com/makesure-vs-make.html) (March 2023)
701
+
-[makesure – make with a human face](https://maximullaris.com/makesure.html) (February 2023)
0 commit comments