/
Guardfile
58 lines (45 loc) · 1.26 KB
/
Guardfile
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
46
47
48
49
50
51
52
53
54
55
56
57
58
require 'byebug'
module ::Guard
class Racc < Plugin
def run_all
end
def run_on_modifications(paths)
raise ArgumentError, 'Racc guard support only compilation of singe file' if paths.size > 1
input_file = Pathname.new(paths.first)
dir = input_file.dirname
output_file = dir + 'parser.rb'
UI.info "Running Racc on #{input_file}"
`racc #{input_file} -v -o #{output_file}`
end
end
end
module ::Guard
class Rex < Plugin
def run_all
end
def run_on_modifications(paths)
raise ArgumentError, 'Rex guard support only compilation of singe file' if paths.size > 1
input_file = Pathname.new(paths.first)
dir = input_file.dirname
output_file = dir + 'lexer.rb'
UI.info "Running Rex on #{input_file}"
`rex #{input_file} -o #{output_file}`
end
end
end
guard :rex do
watch(%r{^lib\/(.*)\/(.+)\.rex$})
end
guard :racc do
watch(%r{^lib\/(.*)\/(.+)\.y$})
end
guard :rspec, cmd: "rspec" do
watch(%r{^spec/(.+)/.+_spec\.rb$})
watch(%r{^lib\/(.*)\/(.+)\.rb$}) { |m| "spec/unit/#{m[1]}/#{m[2]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
end
guard :bundler do
watch('Gemfile')
# Uncomment next line if Gemfile contain `gemspec' command
# watch(/^.+\.gemspec/)
end