juxt / mach

A remake of make (in ClojureScript)
246 stars 21 forks source link

Add support for dynamically matching targets #37

Open SevereOverfl0w opened 7 years ago

SevereOverfl0w commented 7 years ago

There is a basis protocol (Target) which exposes match? for whether or not a target matches. A sequential search is then performed over all targets for each input target.

Example usage of this feature:

;; Machfile.edn
{#mach/glob "*.md" {product "somefile"
            produce (str "# A title")}}

$ mach hello.md
Writing somefile

Further functionality that is necessary to make this feature useful is the exposure of the match ctx (already assoced onto the target when it matches) so that code can refer to the full path. To extend the example above, the future feature should allow the product to be set based on the matching input.

I haven't thoroughly tested this, so a second pair of eyes over this would be good.

SevereOverfl0w commented 7 years ago

new commit added which dynamically binds vars relative to the match context.