I have my own gem and I encounter a really weird LoadError when I set it as a gem and try to require it in irb.
Everything works fine with my rspec checks inside the project folder. This only happens when using it as an actual gem in irb.
The file that throws a LoadError exception in ( /lib/mws/api/order_response.rb) actually exists. I tried to rename the file and update the required file ( /lib/mws.rb). I tried to recreate the file, thinking there might be a permission issue. Nothing works.
If I comment out the require line for this particular file, everything will work. There is nothing special about this file. There are 4 more files, almost identical to it ( *_response.rb).
It seems to me that I'm taking crazy pills. I have to ignore something, but I don’t see it.
Trace:
chris@Samus:~$ irb
1.9.3p194 :001 > require 'mws'
LoadError: cannot load such file -- mws/api/order_response
from /Users/chris/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/chris/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /Users/chris/.rvm/gems/ruby-1.9.3-p194/gems/mws-0.1.18/lib/mws.rb:14:in `<top (required)>'
from /Users/chris/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
from /Users/chris/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
from /Users/chris/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
from (irb):1
from /Users/chris/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'
Request file ( /lib/mws.rb)
require 'mws/base'
require 'mws/connection'
require 'mws/utility'
require 'mws/api/seller'
require 'mws/api/product'
require 'mws/api/order'
require 'mws/api/report'
require 'mws/api/general_response'
require 'mws/api/product_response'
require 'mws/api/report_response'
require 'mws/api/seller_response'
require 'mws/api/order_response'
module MWS
def self.new(merchant_id, access_key, secret_key)
MWS::Base.new(merchant_id, access_key, secret_key)
end
end
module MWS
module API
end
module Utilities
end
end
File I need ( /lib/mws/api/order_response.rb):
module MWS
module API
class OrderResponse
extend GeneralResponse
end
end
end
And my file structure

source
share