Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
35 lines (31 sloc) 556 Bytes
# vim:set filetype=ruby:
def run(cmd)
puts cmd
system cmd
end
def run_spec(args)
if `which spin`.empty?
run("bundle exec rspec #{args}")
else
run("spin push #{args}")
end
end
def spec(file)
if File.exists?(file)
run_spec(file)
else
puts("Spec: #{file} does not exist.")
end
end
watch("spec/.*/*_spec\.rb") do |match|
puts(match[0])
spec(match[0])
end
watch("lib/(.*/*)\.rb") do |match|
puts(match[0])
if File.exists?(p = "spec/"+match[1]+"_spec.rb")
spec(p)
else
spec("spec/momentum_spec.rb")
end
end