Last active
January 1, 2016 01:29
-
-
Save ewalk153/8073036 to your computer and use it in GitHub Desktop.
Go guard file. Slightly more advanced version.
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
| require 'guard' | |
| require 'guard/plugin' | |
| class Guard::Mygo < Guard::Plugin | |
| def run_all | |
| system 'go test ./...' | |
| end | |
| def run_on_changes(paths) | |
| paths.each do |file| | |
| file.sub!(/\.go\Z/, '_test.go') unless file.scan(/_test\.go/).length > 0 | |
| unless File.exist?(file) | |
| puts "#{file} does not exist" | |
| next | |
| end | |
| puts "Running #{file};" | |
| system "go test #{file}" | |
| puts | |
| end | |
| end | |
| end | |
| guard :mygo do | |
| watch(%r{.*?.go}) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment