# A sample Guardfile # More info at github.com/guard/guard#readme

## Uncomment and set this to only include directories you want to watch # directories %w(app lib config test spec features) \ # .select{|d| Dir.exists?(d) ? d : UI.warning(“Directory #{d} does not exist”)}

## Note: if you are using the `directories` clause above and you are not ## watching the project directory ('.'), then you will want to move ## the Guardfile to a watched dir and symlink it back, e.g. # # $ mkdir config # $ mv Guardfile config/ # $ ln -s config/Guardfile . # # and, you'll have to watch “config/Guardfile” instead of “Guardfile”

guard :minitest do

# with Minitest::Unit
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
watch(%r{^lib/(.*/)?([^/]+)\.rb$})     { |m| "test/#{m[1]}test_#{m[2]}.rb" }
watch(%r{^test/test_helper\.rb$})      { 'test' }
watch(%r{^features/.*\.feature}) {'rake'}

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

cucumber_options = {

# Below are examples overriding defaults

# cmd: 'bin/cucumber',
# cmd_additional_args: '--profile guard',

# all_after_pass: false,
# all_on_start: false,
# keep_failed: false,
# feature_sets: ['features/frontend', 'features/experimental'],

# run_all: { cmd_additional_args: '--profile guard_all' },
# focus_on: { 'wip' }, # @wip
# notification: false

}

guard “cucumber”, cucumber_options do

watch(%r{^features/.+\.feature$})
watch(%r{^features/support/.+$}) { "features" }
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
  Dir[File.join("**/#{m[1]}.feature")][0] || "features"
end

end