Last active
June 12, 2016 16:01
-
-
Save bramswenson/fc45a2c1b6dc3aa4c6740d115bd9ce68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: ./spec/**/*_spec.cr | |
run: crystal spec %file% | |
--- | |
files: ./src/**/*.cr | |
run: crystal spec | |
--- | |
files: ./shard.yml | |
run: crystal deps |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def crystal_spec_runner(match) | |
n match[0], 'File Changed' | |
puts match[0] + ' File Changed' | |
spec_file = if match[0].start_with?("spec/") | |
match[0] | |
else | |
"spec/#{match[0].gsub('src/', '')[0..-4]}_spec.cr" | |
end | |
if File.exists?(spec_file) | |
puts %x( crystal spec #{spec_file} ) | |
if $?.exitstatus == 0 | |
puts "#{spec_file} success" | |
n match[0], "#{spec_file} success", :success | |
else | |
puts "#{spec_file} failed" | |
n match[0], "#{spec_file} failed", :failed | |
end | |
else | |
puts "#{spec_file} not found" | |
n match[0], "#{spec_file} not found", :pending | |
end | |
end | |
guard :shell do | |
watch(/src\/(.*).cr/) { |m| crystal_spec_runner(m) } | |
watch(/spec\/(.*)_spec.cr/) { |m| crystal_spec_runner(m) } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment