-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathSpookfile
45 lines (37 loc) · 995 Bytes
/
Spookfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
-- vim: syntax=moon
-- see: https//github.com/johnae/spook
log_level "INFO"
fs = require 'fs'
execute = require('process').execute
-- Adds the built-in terminal_notifier
notify.add 'terminal_notifier'
-- Add "notifier" in path if any, otherwise
-- fail silently.
pcall notify.add, 'notifier'
{
:until_success
:command
:task_filter
:notifies
} = require 'spookfile_helpers'
test = (event, tasks) ->
until_success ->
notifies event.path, event, tasks
task_list = task_filter fs.is_present
rspec = command "bundle exec rspec -f d"
watch '.', ->
on_changed "^(spec)/(spec_helper%.rb)", (event) ->
test event, task_list(
rspec, "spec"
)
on_changed "^spec/(.*)_spec%.rb", (event, name) ->
test event, task_list(
rspec, "spec/#{name}_spec.rb"
)
on_changed "^lib/.*%.rb", (event) ->
test event, task_list(
rspec, "spec/sambal/client_spec.rb"
)
on_changed '^Spookfile$', ->
notify.info 'Re-executing spook...'
reload_spook!