Skip to content

New configuration DSL #4

@johnae

Description

@johnae

Currently there's a branch new-configuration with a simple DSL in it. Looks like this:

log_level "INFO"
spooked false

watch {"lib", "spec"}

map {
  {"^(spec)/(spec_helper%.moon)": (a,b) -> "spec"}
  {"^spec/(.*)%.moon": (a,b) -> "spec/#{a}.moon"}
  {"^lib/(.*)%.moon": (a,b) -> "spec/#{a}_spec.moon"}
}

notifier "path/to/notifier.moon"
-- or
notifier {
   start: (changed_file, mapped_file) -> do_stuff
   finish: (status, changed_file, mapped_file) -> do_stuff
}

command "./spook -f spec/support/run_busted.lua"

While that surely works, perhaps it might be useful to go a bit further (before merging)?

A more advanced option might be:

log_level "INFO"
spooked false

watch "lib spec" ->
   command "./spook -f spec/support/run_busted.lua"
   map "^(spec)/(spec_helper%.moon)": (a,b) -> "spec"
   map "^spec/(.*)%.moon": (a,b) -> "spec/#{a}.moon"
   map "^lib/(.*)%.moon": (a,b) -> "spec/#{a}_spec.moon"

watch "playground" ->
   command "./spook -f"
   map "^playground/(.*)%.moon": (a) -> "playground/#{a}.moon"

notifier "path/to/notifier.moon"
-- or
notifier {
   start: (changed_file, mapped_file) -> do_stuff
   finish: (status, changed_file, mapped_file) -> do_stuff
}
-- or maybe
notifier ->
   start (changed_file, mapped_file) -> do_stuff
   finish (status, changed_file, mapped_file) -> do_stuff

command "./spook -f spec/support/run_busted.lua"

Might also want to think some more on sane defaults... should there be a default command? Is it meaningful to provide different notifiers per watch statement?

Could some be implemented while keeping watches simple for now while later they could support custom notifiers (without having to - again - change the Spookfile format and force anyone using this to change theirs, i.e backward compatible). Not that anyone but me is using spook afaik :-).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions