Skip to content

Instantly share code, notes, and snippets.

@Insti
Last active November 13, 2016 15:36
Show Gist options
  • Save Insti/5b3fb27f66ebd2e1e7887a3d97eb049c to your computer and use it in GitHub Desktop.
Save Insti/5b3fb27f66ebd2e1e7887a3d97eb049c to your computer and use it in GitHub Desktop.
Guardfile for running Exercism (Ruby) tests.
# Guardfile to run Exercism Ruby tests.
# gem install guard
# gem install guard-shell
# Run with 'guard' command from your base exercism directory.
interactor :off
guard :shell do
watch(/(.*).rb/) do |m|
file = m[0]
test_file = file[/_test\.rb/] ? file : file.sub(/\.rb/, '_test.rb')
command = "ruby #{test_file} && rubocop -D #{file} #{test_file}"
system(command)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment