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
Quando executo guard start
, vejo a mensagem libnotify com relatório e, em seguida, travamento do protetor com o próximo erro:
//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
Ele tenta assistir a arquivos git? Eu sinto falta de alguma coisa?
Isso pode acontecer quando há muitos arquivos para monitorar em sua pasta, você pode ignorar algum caminho com o método ignore_paths
(mais informações sobre isso no README )
Tentei usar ignore_paths '.git'
e não surtiu efeito.
Tenho apenas 93 arquivos no projeto:
find . | grep -v '.git' | wc -l
93
Isso é estranho, tente pedir lib notifique caras.
Apenas para sua informação, .git
já é ignorado por padrão: https://github.com/guard/guard/blob/master/lib/guard/listener.rb#L19
Alguma novidade?
Não. Vou tentar executá-lo em outra máquina.
Hm .. No meu trabalho, em outro PC o mesmo projeto funciona bem com guarda .. Em ambos os PCs eu uso Debian Squeeze.
Estou tendo um problema semelhante com um diretório grande que ignorei usando ignore_paths. Ele insiste em reclamar que "Falha ao observar" algum arquivo no diretório ignorado.
Os caminhos são ignorados apenas no nível de guarda, mas não com rb-inotify
portanto, usar ignore_paths
não é útil aqui. Para resolver seu problema, acho que precisamos de uma opção ignore_paths em rb-inotify
. @ nex3 você acha que seria possível?
Não parece haver nenhuma maneira de ignorar seletivamente os caminhos na interface subjacente do inotify.
Tirei o diretório do monstro da árvore do projeto por enquanto. Obrigado por tentar.
Eu removi .git
diretório e ele funciona para mim também. Mas pode haver algo melhor :)
Tente aumentar o max_user_watches para inotify. O padrão é 8192. Aumentei para 100k e as coisas estão bem.
cat /proc/sys/fs/inotify/max_user_watches
echo 100000|sudo tee /proc/sys/fs/inotify/max_user_watches
Para aumentar max_user_watches na inicialização, edite /etc/sysctl.conf e adicione fs.inotify.max_user_watches = 100000 ou corrija fs.inotify.max_user_watches = para 100000.
Não me agradeça, agradeça esse cara -> http://blog.sorah.jp/2012/01/24/inotify-limitation
@jhirn Belo link, obrigado por compartilhá-lo! / cc @ Maher4Ever
@thibaudgg Acho realmente uma boa ideia capturar essa exceção e mostrar um link para uma (página wiki?) ou algo no repositório Listen para ajudar os usuários. Devemos adicionar a primeira página wiki para Ouvir? :)
Faça isso, mas certifique-se de dar crédito a github.com/sorah e não a mim. =)
@ Maher4Ever yeah +1 para um link para nossa primeira página Listen wiki!
@jhirn , bom achado!
@thibaudgg , obrigado pelo suporte.
Comentários muito úteis
Tente aumentar o max_user_watches para inotify. O padrão é 8192. Aumentei para 100k e as coisas estão bem.
Para aumentar max_user_watches na inicialização, edite /etc/sysctl.conf e adicione fs.inotify.max_user_watches = 100000 ou corrija fs.inotify.max_user_watches = para 100000.
Não me agradeça, agradeça esse cara -> http://blog.sorah.jp/2012/01/24/inotify-limitation