erikw/nestedtext-ruby

View on GitHub
Guardfile

Summary

Maintainability
Test Coverage
# DSL: https://github.com/guard/guard/wiki/Guardfile-DSL---Configuring-Guard

# Disable simplecov as the minimum_coverage failure will overshadow the failed test output in Guard.
# Ref: https://stackoverflow.com/a/17714286/265508
guard :minitest, env: { 'NO_COVERAGE' => 'true' } do
  # with Minitest::Unit
  watch(%r{^test/(.*)\/?(.*)_test\.rb$})
  watch(%r{^lib/(.*/)?([^/]+)\.rb$})     { |m| "test/#{m[1]}#{m[2]}_test.rb" }
  watch(%r{^test/test_helper\.rb$})      { 'test' }
end

guard :rubocop do
  watch(%r{.+\.rb$})
  watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m[0]) }
end

guard :bundler do
  require 'guard/bundler'
  require 'guard/bundler/verify'
  helper = Guard::Bundler::Verify.new

  files = ['Gemfile']
  files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }

  # Assume files are symlinked from somewhere
  files.each { |file| watch(helper.real_path(file)) }
end

guard 'yard' do
  watch(%r{lib\/.+\.rb})
  watch('README.md')
end