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 notify์๊ฒ ๋ฌผ์ด๋ณด์ญ์์ค.
์ฐธ๊ณ ๋ก .git
๋ ๊ธฐ๋ณธ์ ์ผ๋ก ์ด๋ฏธ ๋ฌด์๋ฉ๋๋ค. https://github.com/guard/guard/blob/master/lib/guard/listener.rb#L19
์์์ด ์๋์?
์๋์. ๋ค๋ฅธ ์ปดํจํฐ์์ ์คํํ๋ ค๊ณ ํฉ๋๋ค.
ํ .. ์ ์์ ์์๋ ๋ค๋ฅธ PC์์ ๋์ผํ ํ๋ก์ ํธ๊ฐ ๊ฐ๋๋ก ์ ์คํ๋ฉ๋๋ค. ๋ PC์์ ์ ๋ Debian Squeeze๋ฅผ ์ฌ์ฉํฉ๋๋ค.
ignore_paths๋ฅผ ์ฌ์ฉํ์ฌ ๋ฌด์ํ๋ ํฐ ๋๋ ํ ๋ฆฌ์ ๋น์ทํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ๋ฌด์๋ ๋๋ ํ ๋ฆฌ์ ์ผ๋ถ ํ์ผ์ด '๊ฐ์ ์คํจ'ํ๋ค๊ณ ๋ถํ์ ๊ณ์ํฉ๋๋ค.
๊ฒฝ๋ก๋ Guard ์์ค์์๋ง ๋ฌด์๋์ง๋ง rb-inotify
์์๋ ๋ฌด์๋์ง ์์ผ๋ฏ๋ก ignore_paths
๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ์ฌ๊ธฐ์์ ์ ์ฉํ์ง ์์ต๋๋ค. ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๋ ค๋ฉด rb-inotify
ignore_paths ์ต์
์ด ํ์ํ๋ค๊ณ ์๊ฐํฉ๋๋ค. @nex3 ๊ทธ๊ฒ ๊ฐ๋ฅํ ๊ฒ
๊ธฐ๋ณธ inotify ์ธํฐํ์ด์ค์์ ๊ฒฝ๋ก๋ฅผ ์ ํ์ ์ผ๋ก ๋ฌด์ํ๋ ๋ฐฉ๋ฒ์ ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ง๊ธ์ ํ๋ก์ ํธ ํธ๋ฆฌ์์ ๋ชฌ์คํฐ ๋๋ ํ ๋ฆฌ๋ฅผ ๊ฐ์ ธ์์ต๋๋ค. ์๋ํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
.git
๋๋ ํ ๋ฆฌ๋ฅผ ์ ๊ฑฐํ๋๋ฐ ์ ์๊ฒ๋ ํจ๊ณผ์ ์
๋๋ค. ํ์ง๋ง ๋ ์ข์ ๊ฒ์ด ์์ ์ ์์ต๋๋ค. :)
inotify์ ๋ํ max_user_watches๋ฅผ ๋๋ ค๋ณด์ญ์์ค. ๊ธฐ๋ณธ๊ฐ์ 8192๋ก ์ค์ ๋์ด ์์ต๋๋ค. 100k๋ก ์ค์ ํ๋๋ฐ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
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 ์ฌ์ฉ์๋ฅผ ๋๊ธฐ ์ํด ์ด ์์ธ๋ฅผ ํฌ์ฐฉํ๊ณ (์ํค ํ์ด์ง?) ๋๋ Listen ๋ฆฌํฌ์งํ ๋ฆฌ์ ์๋ ๋ฌด์ธ๊ฐ์ ๋ํ ๋งํฌ๋ฅผ ํ์ํ๋ ๊ฒ์ด ์ ๋ง ์ข์ ์๊ฐ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. Listen ์ ์ฒซ ๋ฒ์งธ ์ํค ํ์ด์ง๋ฅผ ์ถ๊ฐํด ๋ณผ๊น์? :)
๊ทธ๋ ๊ฒ ํ์ธ์. ํ์ง๋ง ์ ๋ง๊ณ github.com/sorah์ ํฌ๋ ๋ง์ ์ฌ์ฉํ์ธ์. =)
@Maher4Ever yes ์ฒซ ๋ฒ์งธ Listen Wiki ํ์ด์ง์ ๋ํ ๋งํฌ์ +1!
@jhirn , ์ ์ฐพ์์ต๋๋ค!
@thibaudgg , ์ง์์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
inotify์ ๋ํ max_user_watches๋ฅผ ๋๋ ค๋ณด์ญ์์ค. ๊ธฐ๋ณธ๊ฐ์ 8192๋ก ์ค์ ๋์ด ์์ต๋๋ค. 100k๋ก ์ค์ ํ๋๋ฐ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
๋ถํ ์ 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