-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvement to
@goal @glob
#46 : README.md
- Loading branch information
Showing
1 changed file
with
15 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -220,14 +220,18 @@ This one is easy to illustrate with an example: | |
echo $ITEM $INDEX $TOTAL | ||
``` | ||
|
||
Is equivalent to declaring two goals | ||
Is equivalent to declaring three goals | ||
|
||
``` | ||
@goal [email protected] | ||
@goal [email protected] @private | ||
echo a.txt 0 2 | ||
@goal [email protected] | ||
@goal [email protected] @private | ||
echo b.txt 1 2 | ||
@goal process_file | ||
@depends_on [email protected] | ||
@depends_on [email protected] | ||
``` | ||
iff | ||
``` | ||
|
@@ -242,16 +246,20 @@ For convenience, you can omit name in case of glob goal: | |
``` | ||
as equivalent for | ||
``` | ||
@goal a.txt | ||
@goal a.txt @private | ||
echo a.txt 0 2 | ||
@goal b.txt | ||
@goal b.txt @private | ||
echo b.txt 1 2 | ||
@goal *.txt | ||
@depends_on a.txt | ||
@depends_on b.txt | ||
``` | ||
|
||
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. | ||
|
||
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#L95). | ||
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#L98). | ||
|
||
Why this may be useful? Imagine in your nodejs application you have `test1.js`, `test2.js`, `test3.js`. | ||
Now you can use this `Makesurefile` | ||
|
@@ -260,14 +268,9 @@ Now you can use this `Makesurefile` | |
@goal @glob test*.js | ||
echo "running test file $INDEX out of $TOTAL ..." | ||
node $ITEM | ||
@goal test_all | ||
@depends_on test1.js | ||
@depends_on test2.js | ||
@depends_on test3.js | ||
``` | ||
|
||
to be able to run each test individually (`./makesure test2.js` for example) and all together (`./makesure test_all`). | ||
to be able to run each test individually (`./makesure test2.js` for example) and all together (`./makesure 'test*.js'`). | ||
|
||
### @doc | ||
|
||
|