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
عندما أقوم بتشغيل guard start
أرى رسالة libnotify مع تقرير ثم يتعطل الحارس مع الخطأ التالي:
//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
هل تحاول مشاهدة ملفات git؟ هل افتقد شيء؟
قد يصل هذا عندما يكون هناك الكثير من الملفات لمشاهدتها في مجلدك ، يمكنك تجاهل بعض المسارات باستخدام طريقة ignore_paths
(مزيد من المعلومات حول هذا الموضوع في README )
لقد حاولت استخدام ignore_paths '.git'
ولم يكن له أي تأثير.
لدي 93 ملفًا فقط في المشروع:
find . | grep -v '.git' | wc -l
93
هذا غريب ، حاول أن تطلب من lib إخطار اللاعبين.
فقط لمعلوماتك ، .git
تم تجاهله بالفعل افتراضيًا: https://github.com/guard/guard/blob/master/lib/guard/listener.rb#L19
أي أخبار؟
لا ، سأحاول تشغيله على جهاز آخر.
حسنًا .. في عملي ، على كمبيوتر شخصي آخر ، يعمل نفس المشروع بشكل جيد مع برنامج guard .. أستخدم Debian Squeeze على كلا جهازي الكمبيوتر.
أواجه مشكلة مماثلة مع دليل كبير تجاهلته باستخدام ignore_paths. ويصر على الشكوى من أنه قد "فشل في مشاهدة" بعض الملفات في الدليل الذي تم تجاهله.
يتم تجاهل المسارات على مستوى الحرس فقط ولكن ليس مع rb-inotify
لذا فإن استخدام ignore_paths
ليس مفيدًا هنا. لحل مشكلتك ، أعتقد أننا بحاجة إلى خيار ignore_paths في rb-inotify
. @ nex3 هل تعتقد أنه سيكون ممكنا؟
لا يبدو أن هناك أي طريقة لتجاهل المسارات بشكل انتقائي في واجهة inotify الأساسية.
لقد أخرجت دليل الوحش من شجرة المشروع في الوقت الحالي. شكرا للمحاولة.
أزلت دليل .git
وهو يعمل معي أيضًا. ولكن قد يكون هناك شيء أفضل :)
حاول زيادة max_user_watches من أجل inotify. تم تعيينه افتراضيًا على 8192. لقد صدمته إلى 100 كيلو والأشياء على ما يرام.
cat /proc/sys/fs/inotify/max_user_watches
echo 100000|sudo tee /proc/sys/fs/inotify/max_user_watches
لزيادة max_user_watches عند التمهيد ، قم بتحرير /etc/sysctl.conf وأضف fs.inotify.max_user_watches = 100000 أو أصلح fs.inotify.max_user_watches = إلى 100000.
لا تشكرني ، أشكر هذا الرجل -> http://blog.sorah.jp/2012/01/24/inotify-limitation
jhirn رابط جميل ، شكرا لمشاركته! / cc @ Maher4Ever
thibaudgg أعتقد أنه من الجيد حقًا التقاط هذا الاستثناء وإظهار ارتباط إلى (صفحة wiki؟) أو شيء ما على Listen repo لمساعدة المستخدمين. هل يجب أن نضيف صفحة wiki الأولى للاستماع؟ :)
افعل ذلك ، ولكن تأكد من الفضل في github.com/sorah وليس أنا. =)
@ Maher4Ever yeah +1 للحصول على رابط إلى صفحتنا الأولى للاستماع إلى wiki!
@ jhirn ، البحث الجيد!
thibaudgg ، شكرا على الدعم.
التعليق الأكثر فائدة
حاول زيادة max_user_watches من أجل inotify. تم تعيينه افتراضيًا على 8192. لقد صدمته إلى 100 كيلو والأشياء على ما يرام.
لزيادة max_user_watches عند التمهيد ، قم بتحرير /etc/sysctl.conf وأضف fs.inotify.max_user_watches = 100000 أو أصلح fs.inotify.max_user_watches = إلى 100000.
لا تشكرني ، أشكر هذا الرجل -> http://blog.sorah.jp/2012/01/24/inotify-limitation