I'm using guard with rspec and spork in a on ubuntu 12.04, rails
3.2.3, ruby 1.9.3
I have a directory in public/ in the rails project directory with
around 15,000 files in it. When I fire up guard, the disk gets
thrashed to the point where the workstation is effectively unusable.
I *have* added ignore_paths 'public' to the Guardfile, which makes no
difference.
Guard works fine with this project on other developers' MacOS
workstations, this disk-grinding only seems to happen on Linux.
I have bumped up max_user_watches:
$ cat /proc/sys/fs/inotify/max_user_watches
65536
I've tried moving the dir containing the 15k files out of the project
dir, and then symlinking to it; this doesn't fix the problem.
-----------------------------------------
Relevant snippet of Gemfile:
-----------------------------------------
group :development, :test do
gem 'thin'
gem 'rspec-rails'
gem 'capybara'
gem 'fuubar'
gem 'nifty-generators'
gem 'nokogiri'
gem 'sqlite3'
gem 'rails_best_practices'
gem 'rb-fsevent'
gem 'guard-rspec'
end
--------------
Guardfile:
--------------
# -*- ruby -
*-
# A sample
Guardfile
# More info at
https://github.com/guard/guard#readme
ignore_paths 'public'
# NOTE: spork section needs to come
first.
guard 'spork', :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile')
watch('Gemfile.lock')
watch('spec/factories.rb')
watch('spec/spec_helper.rb') { :rspec }
watch(%r{^app/(.+)\.rb$})
end
guard 'rspec', :version => 2, :cli => "--drb", :all_on_start =>
false, :all_after_pass => false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails
example
watch(%r{^app/(.+)\.rb$}) { |m| "spec/
#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/
#{m[1]}#{m[2]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/
routing/#{m[1]}_routing_spec.rb",
"spec/
#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb",
"spec/
acceptance/#{m[1]}_spec.rb"] }
watch('spec/factories.rb') { "spec" }
watch('config/routes.rb') { "spec/
routing" }
watch('app/controllers/application_controller.rb') { "spec/
controllers" }
# Request
specs
watch(%r{^app/views/(.+)/}) { |m| "spec/requests/#{m[1]}
_request_spec.rb" }
end