WebQube
WebQube

Reputation: 8961

failed to require a local gem

created a demo gem built it :

gem build control.gemspec
  Successfully built RubyGem
  Name: process_controller
  Version: 0.0.1
  File: process_controller-0.0.1.gem

installed it:

gem install --local process_controller-0.0.1.gem
Successfully installed process_controller-0.0.1
1 gem installed

but I can't seem to require it :

irb (from the installed directory)
2.1.5 :001 > require 'process_controller'
LoadError: cannot load such file -- process_controller
    from /Users/partuck/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/partuck/.rvm/rubies/ruby-2.1.5/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from (irb):1
    from /Users/partuck/.rvm/rubies/ruby-2.1.5/bin/irb:11:in `<main>'

also tried

require 'control' # since it's in the control directory

bundle show output:

bundle show
Gems included by the bundle:
  * bundler (1.7.9)
  * process_controller (0.0.1)

here is a screen shot of the directory structure http://cl.ly/image/2t1s331e273u

Upvotes: 4

Views: 2331

Answers (1)

WebQube
WebQube

Reputation: 8961

turns out you can't require the gem, you have to require the main file name. in my case its:

require 'control'

thanks a lot @matt

Upvotes: 3

Related Questions