3 These notes reflect earlier thinking about the language and may not
4 necessarily accurately describe the current goaljobs language. Please
5 read the documentation instead.
10 - Predicates can be based on arbitrary expressions, not just
11 "file X is older than file Y".
12 - Rules are more flexible and encourage structuring and reuse
14 - Goals can be parameterized.
15 - Program can run continuously to implement business rules.
17 Differences from 'whenjobs':
18 - Goals instead of variables.
19 - Persistent (across session) variables exist, but are not central.
20 - Doesn't use <<..>> for shell scripts (has a function 'sh' instead).
23 Similarities to 'whenjobs':
24 - Each shell script runs in its own temporary directory.
30 let rec goal website_updated version =
31 let tarfile = sprintf "%s-%s.tar.gz" package version in
32 let tarpath = getenv "HOME" // "html" // tarfile in
33 let url = sprintf "http://example.com/%s" tarfile in
35 target (url_exists url);
37 require (tarball_exists version);
38 require (tarball_tested version);
40 sh "rsync %s example.com:/html/" tarpath
42 and goal tarball_tested version =
43 let tarfile = sprintf "%s-%s.tar.gz" package version in
44 let tarpath = getenv "HOME" // "html" // tarfile in
45 let memkey = package ^ "_tested_" ^ version in
47 target (memory_exists memkey);
49 require (tarball_exists version);
57 " tarpath package version;
61 and goal tarball_exists version =
62 let tarpath = getenv "HOME" // "html" // tarfile in
63 target (file_exists tarpath);
67 git archive --prefix %s-%s/ v%s | gzip > %s-t
69 " package package version version tarpath tarpath tarpath
75 git describe --tags --abbrev=0 --match='v*'
77 require (website_updated version)
79 This compiles down to a command line program that can be used like this:
81 ./compile [-flags] [goals]
83 The goals are not enabled automatically. You have to do something
84 (simple) to publish a goal and specify how command line arguments get
85 mapped to goal arguments, since the mapping is not likely to be 1-1
86 strings. In the end you can do stuff like:
90 ./compile build program # program is a parameter
91 ./compile -my-flag # custom flags can be defined