guard 'rspec', :version => 2, :cli => "--color --format nested" do
watch(%r{^spec/.+_spec\.rb})
watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
end
group :development do
gem 'guard'
gem 'libnotify'
gem 'guard-rspec'
gem 'rb-readline'
end
Cuando ejecuto guard start
veo el mensaje libnotify con el informe y luego protejo los bloqueos con el siguiente error:
//home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/watcher.rb:80:in `initialize': No space left on device - Failed to watch "/home/blake/dev/my/project_child/.git/objects/78": The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC)
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `new'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:199:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:58:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listener.rb:100:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:20:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard.rb:203:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/cli.rb:75:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/bin/guard:6
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19:in `load'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/watcher.rb:80:in `initialize': No space left on device - Failed to watch "/home/blake/dev/my/project_child/.git/objects/78": The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC)
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `new'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:190:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:199:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:195:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `each'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/vendor/linux/lib/rb-inotify/notifier.rb:192:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:58:in `watch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listener.rb:100:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/listeners/linux.rb:20:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard.rb:203:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/lib/guard/cli.rb:75:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/gems/guard-1.0.0/bin/guard:6
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19:in `load'
from /home/blake/.rvm/gems/ruby-1.8.7-p352@project/bin/guard:19
¿Intenta ver archivos git? ¿Me pierdo algo?
Esto podría llegar cuando hay demasiados archivos para ver en su carpeta, puede ignorar alguna ruta con el método ignore_paths
(más información al respecto en el archivo README )
Intenté usar ignore_paths '.git'
no tuvo ningún efecto.
Solo tengo 93 archivos en el proyecto:
find . | grep -v '.git' | wc -l
93
Eso es raro, intenta pedirle a lib que notifique a los chicos.
Solo para su información, .git
ya se ignora de forma predeterminada: https://github.com/guard/guard/blob/master/lib/guard/listener.rb#L19
¿Hay noticias?
No. Voy a intentar ejecutarlo en otra máquina.
Hm .. En mi trabajo, en otra PC, el mismo proyecto funciona bien con guard .. En ambas PC utilizo Debian Squeeze.
Tengo un problema similar con un directorio grande que ignoré al usar ignore_paths. Insiste en quejarse de que no ha podido observar algún archivo del directorio ignorado.
Las rutas solo se ignoran en el nivel de Guardia, pero no con rb-inotify
por lo que usar ignore_paths
no es útil aquí. Para resolver su problema, creo que necesitamos una opción ignore_paths en rb-inotify
. @ nex3 ¿crees que sería posible?
No parece haber ninguna forma de ignorar selectivamente las rutas en la interfaz inotify subyacente.
Saqué el directorio de monstruos del árbol del proyecto por ahora. Gracias por intentarlo.
Eliminé el directorio .git
y también me funciona. Pero podría haber algo mejor :)
Intente aumentar max_user_watches para inotify. Está configurado por defecto en 8192. Lo subí a 100k y todo está bien.
cat /proc/sys/fs/inotify/max_user_watches
echo 100000|sudo tee /proc/sys/fs/inotify/max_user_watches
Para aumentar max_user_watches en el arranque, edite /etc/sysctl.conf y agregue fs.inotify.max_user_watches = 100000 o corrija fs.inotify.max_user_watches = a 100000.
No me agradezcas, gracias a este chico -> http://blog.sorah.jp/2012/01/24/inotify-limitation
@jhirn Bonito enlace, ¡gracias por compartirlo! / cc @ Maher4Ever
@thibaudgg Creo que es una buena idea detectar esta excepción y mostrar un enlace a una (¿página wiki?) o algo en el repositorio de escucha para ayudar a los usuarios. ¿Agregamos la primera página wiki a Escuchar? :)
Hazlo, pero asegúrate de darle crédito a github.com/sorah y no a mí. =)
@ Maher4Ever yeah +1 para un enlace a nuestra primera página de Escuchar wiki.
@jhirn , ¡buen hallazgo!
@thibaudgg , gracias por el apoyo.
Comentario más útil
Intente aumentar max_user_watches para inotify. Está configurado por defecto en 8192. Lo subí a 100k y todo está bien.
Para aumentar max_user_watches en el arranque, edite /etc/sysctl.conf y agregue fs.inotify.max_user_watches = 100000 o corrija fs.inotify.max_user_watches = a 100000.
No me agradezcas, gracias a este chico -> http://blog.sorah.jp/2012/01/24/inotify-limitation