Guard's really starting to tick me off now. Thought I had a nice regex going to select all files in my project apart from the ones with an extension of 'log':
Guardfile :
guard :rspec do
watch(%r{^.+$(?<!\.log)})
end
Rubular permalink: http://rubular.com/r/qPyeSs54BF
But this results in nothing. I save ANY file, and guard just sits there like a lemon. So annoying.
Same when I do this:
guard :rspec do
watch(%r{^.+$})
end
Rubular permalink: http://rubular.com/r/UxFXyq9lRm
this is what really gets me. As you can see from the rubular links, it's perfectly valid regex, but Guard doesn't listen to it. When can't it just take in regular regex? What's with the stupid %r{} crap? And I wish Guard didn't try to be clever, running individual specs when I tweak them, and then running entire spec files when I tweak those.
Is there some over-arching configuration somewhere where I can set guard to run all specs when any file other than a log file is updated and nothing else? Such a sensible thing to want to do and it's been a complete nightmare.
Here are my Gems:
source ' https://rubygems.org '
group :development do
gem 'capistrano'
gem 'guard-rspec'
gem 'guard-livereload', require: false
gem 'rb-fsevent'
gem 'debugger'
end
group :development, :test do
gem 'rspec-rails', '~> 2.14.0'
gem 'sqlite3'
end
group :test do
gem 'factory_girl_rails'
gem 'capybara', '~> 2.2.0'
gem 'selenium-webdriver'
# uses a program called 'libqtwebkit-dev' to build. To install 'libqtwebkit-dev' in Ubuntu, run
# sudo apt-get install libqtwebkit-dev
# gem 'capybara-webkit'
gem 'rb-readline'
gem 'launchy'
gem 'database_cleaner'
end
group :production do
gem 'pg'
end
# standard library
gem 'rails', '4.0.1'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
group :doc do
gem 'sdoc', require: false
end
# custom
gem 'devise'
gem 'puma'
UPDATE
Maybe this regex is a little better:
.+?\.(?!log).+
http://rubular.com/r/dsYKzUE8FF
So how should I go about implementing this in my guard file?
Short answer: You don't. You tell Guard to pass specific file sets (for lack of a better way to reference regex results) to specific plugins should other specific file sets be modified in any way.
For Guard to "work properly"
source: https://github.com/guard/guard/wiki/Understanding-Guard
I recommend anyone interested in using Guard visit the above link.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.