josef.van.niekerk
josef.van.niekerk

Reputation: 12121

Ruby not finding gems, but they appear on gem list, and work in irb console?

I've got a Ruby app using deamon-kit to create a daemon that runs a cron task every 3 seconds.

Problem is I'm trying to add some error checking using Errbit, so that requires me to:

require 'hoptoad_notifier'

in my script. However, the script is complaining it can't find the file?

.rvm/gems/ruby-1.9.2-p320@stitch/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require': no such file to load -- hoptoad_notifier (LoadError)

What confuses me is that the gem is installed, when I run

gem list | grep hoptoad_notifier

I get

hoptoad_notifier (2.4.11)

Another test I did was to pop into irb console, on the same terminal window, after making sure I'm inside the correct RVM gemset off course:

1.9.2p320 :001 > require 'hoptoad_notifier'
 => true
1.9.2p320 :002 >

And voila, hoptoad is loading. It's only when loading my deamon-kit deamon, that I get the error.

What further confuses me is that when I look at my require block:

require 'rubygems'
require 'resque'
require 'hoptoad_notifier'

It's finding rubygems and resque, but not hoptoad_notifier? Why, when I comment out hoptoad, it doesn't also complain about resque and rubygems?

Upvotes: 1

Views: 269

Answers (1)

Intrepidd
Intrepidd

Reputation: 20878

dameon-kit uses bundler, so you don't need to include rubygems. Include the following lines to your Gemfile :

gem 'resque'
gem 'hoptoad_notifier'

Run bundle install

and include your gems as usual :

require 'resque'
require 'hoptoad_notifier'

It worked for me.

Upvotes: 1

Related Questions