rails / spring-watcher-listen

MIT License
64 stars 35 forks source link

Error: undefined method callback! #12

Closed junaruga closed 1 year ago

junaruga commented 8 years ago

Hi,

I got an error in the output of "rake test", though I could pass the test. Could you tell me why this was happened?

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

$ bundle --version
Bundler version 1.12.5

$ git clone git@github.com:jonleighton/spring-watcher-listen.git

$ cd spring-watcher-listen

$ bundle install --path vendor/bundle

$ bundle list
Gems included by the bundle:
  * activesupport (5.0.0.1)
  * bundler (1.12.5)
  * concurrent-ruby (1.0.2)
  * ffi (1.9.14)
  * i18n (0.7.0)
  * listen (3.1.5)
  * minitest (5.9.0)
  * rake (11.2.2)
  * rb-fsevent (0.9.7)
  * rb-inotify (0.9.7)
  * ruby_dep (1.4.0)
  * spring (1.7.2 88bef7d)
  * spring-watcher-listen (2.0.0)
  * thread_safe (0.3.5)
  * tzinfo (1.2.2)

# Disable acceptance test because I did not install rails.
$ mv test/acceptance_test.rb test/acceptance_test.rb.disable

$ bundle exec rake >& build.log

$ cat build.log
...
./home/jaruga/git/spring-watcher-listen/lib/spring/watcher/listen.rb:39: warning: instance variable @listener not initialized
/home/jaruga/git/spring-watcher-listen/lib/spring/watcher/listen.rb:25: warning: instance variable @listener not initialized
E, [2016-08-12T17:55:26.023544 #32635] ERROR -- : run() in thread failed: undefined method `callback!' for nil:NilClass:\n /home/jaruga/git/spring-watcher-listen/vendor/bundle/ruby/2.3.0/gems/rb-inotify-0.9.7/lib/rb-inotify/event.rb:128:in `callback!'
...
12 runs, 19 assertions, 0 failures, 0 errors, 0 skips <= done with success.

Thank you.

e2 commented 8 years ago

Likely problem:

I think your tests are simply too fast to let Listen initialized.

I don't think you need Listen for tests, so in your Gemfile you can probably move spring-watcher-listen to the development group (so it isn't in the test group);

Then you can make sure it isn't installed by running:

$ bundle install --path vendor/bundle --without development

and confirm Listen isn't included with:

$ bundle list

On Fri, Aug 12, 2016 at 09:07:50AM -0700, Jun Aruga wrote:

Hi,

I got an error in the output of "rake test", though I could pass the test. Could you tell me why this was happened?

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]

$ bundle --version
Bundler version 1.12.5

$ git clone git@github.com:jonleighton/spring-watcher-listen.git

$ cd spring-watcher-listen

$ bundle install --path vendor/bundle

$ bundle list
Gems included by the bundle:
  * activesupport (5.0.0.1)
  * bundler (1.12.5)
  * concurrent-ruby (1.0.2)
  * ffi (1.9.14)
  * i18n (0.7.0)
  * listen (3.1.5)
  * minitest (5.9.0)
  * rake (11.2.2)
  * rb-fsevent (0.9.7)
  * rb-inotify (0.9.7)
  * ruby_dep (1.4.0)
  * spring (1.7.2 88bef7d)
  * spring-watcher-listen (2.0.0)
  * thread_safe (0.3.5)
  * tzinfo (1.2.2)

# Disable acceptance test because I did not install rails.
$ mv test/acceptance_test.rb test/acceptance_test.rb.disable

$ bundle exec rake >& build.log

$ cat build.log
...
./home/jaruga/git/spring-watcher-listen/lib/spring/watcher/listen.rb:39: warning: instance variable @listener not initialized
/home/jaruga/git/spring-watcher-listen/lib/spring/watcher/listen.rb:25: warning: instance variable @listener not initialized
E, [2016-08-12T17:55:26.023544 #32635] ERROR -- : run() in thread failed: undefined method `callback!' for nil:NilClass:\n /home/jaruga/git/spring-watcher-listen/vendor/bundle/ruby/2.3.0/gems/rb-inotify-0.9.7/lib/rb-inotify/event.rb:128:in `callback!'
...
12 runs, 19 assertions, 0 failures, 0 errors, 0 skips <= done with success.

Thank you.

You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/jonleighton/spring-watcher-listen/issues/12

junaruga commented 8 years ago

@e2 Thank you for the replying. Actually I am a RPM package maintainer for your gem file on Fedora Project. Not a user. For me, it is fine as all the test was passed though I could see the above error message. Of course, I am happy that someone could fix the error.

junaruga commented 8 years ago

I don't think you need Listen for tests, so in your Gemfile you can probably move spring-watcher-listen to the development group (so it isn't in the test group);

Then you can make sure it isn't installed by running: $ bundle install --path vendor/bundle --without development and confirm Listen isn't included with:

I could not understand your meaning. I created Gemfile and I could see both spring-watcher-listen and listen were not installed in the bundle list without development. Then?

$ cat Gemfile
source 'https://rubygems.org'

gem 'spring-watcher-listen', :group => :development

$ bundle install --path vendor/bundle --without development

$ bundle list
Gems included by the bundle:
  * bundler (1.12.5)
e2 commented 7 years ago

It's fixed in: https://github.com/nex3/rb-inotify/blob/a3ff7cc/lib/rb-inotify/event.rb#L128

but not released yet: https://github.com/nex3/rb-inotify/pull/53/files

I might need to fork rb-notify :(

junaruga commented 7 years ago

@e2 Sorry for late replying. OK! rb-inotify latest version v0.9.7 still does not include the fix. So, I will wait it. Thank you for the information.

hbarrington commented 7 years ago

This is still waiting to land?