I have a custom gem and am encountering a really weird LoadError when I install it as a gem and attempt to require it in irb.
Everything works fine with my rspec tests inside the project folder. This only occurs when using it as an actual gem in irb.
The file it throws a LoadError exception at (/lib/mws/api/order_response.rb) does in fact exist. I've tried renaming the file and updating the file that requires it (/lib/mws.rb). I've tried recreating the file thinking maybe there was a permissions issue. Nothing works.
If I comment out the require line for that specific file, everything works. There's nothing special about the file. There's 4 other files nearly identical to it (*_response.rb).
I feel like I'm taking crazy pills. I must being overlooking something but I sure 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>' File with the requires (/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' # <--- the offending line module MWS # @see Base#initialize MWS::Base for instantiation details. # @return [Base] returns MWS::Base object. def self.new(merchant_id, access_key, secret_key) MWS::Base.new(merchant_id, access_key, secret_key) end end # The below is for documentation generation purposes. # MWS is a wrapper for the Amazon Marketplace Web Service (MWS) API. module MWS # API handles all the Amazon MWS API specific stuff. module API end # Utilities contains various functions needed throughout MWS. Utilities is a mixin to multiple classes. module Utilities end end File I'm requiring (/lib/mws/api/order_response.rb):
module MWS module API # Class for parsing Amazon's XML responses into managable objects. class OrderResponse # Include GeneralResponse instance methods as class methods extend GeneralResponse end end end And my file structure
