Created
June 5, 2018 18:27
-
-
Save jaydorsey/272db89fc54360aba2221487728e3b7c to your computer and use it in GitHub Desktop.
Guard for exercism
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
# Append this alias to your .zshrc or .bashrc | |
# | |
# Run `guardme` from any exercise directory to start guard | |
# with your custom Guardfile | |
alias guardme="guard --guardfile ~/exercism/ruby/Guardfile" |
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
# Place this file in ~/exercism/ruby | |
# | |
# This runs minitest, followed by rubocop | |
# | |
# https://paulfioravanti.com/blog/2018/01/11/setting-up-a-ruby-development-environment-for-exercism/ | |
group :red_green_refactor, half_on_fail: true do | |
guard :minitest, cli: '--pride', test_folders: ['.'] do | |
# Re-test files when they're modified | |
watch(%r{\A.+_test\.rb\z}) { |m| "./#{m[1]}" } | |
# Run the test file of the file that was edited | |
watch(%r{\A(.+)(?<!_test)\.rb\z}) { |m| "./#{m[1]}_test.rb" } | |
end | |
guard :rubocop do | |
# Only run Rubocop over implementation files | |
# as test files are not written by students. | |
watch(%r{\A(.+)(?<!_test)\.rb\z}) | |
watch(%r{(?:.+/)?\.rubocop\.yml\z}) { |m| File.dirname(m[0]) } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment