Need help with require while modifiying a gem (active_merchant)
I'm trying to add a new gateway to the active_merchant
gem and I'm having 'require' issues when I try to run it from source.
(I think my problem is not active_merchant
-specific, but more of a general Ruby environment issue, so I dont think the specific gem in use has to do with it.)
This is what I've done:
Cloned the Git repo for AM, to my local directory "C:\Users\jb\Documents\Aptana Studio 3 Workspace\active_merchant"
Went about doing the changes in the "billing/gateways" directory (this is just background info..)
Copied the "Sample Usage" example on AM's Git repo to
C:\Users\jb\Documents\Aptana Studio 3 Workspace\simple_gw_test.rb
, which starts with:require 'rubygems' require 'active_merchant'
Ran "ruby simple_gw_test.rb" and got the error message:
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- active_merchant (LoadError) from <internal:lib/rubygems/custom_require>:29:in 'require' from simple_gw_test.rb:3:in '<main>'
This is understandable, since I don't have active_merchant
gem installed
However, I want to use the downloaded source in the sample file, since I'm modifying the gateway source continually.
I tried
require '/Users/jb/Documents/Aptana Studio 3 Workspace/active_merchant'
And then got the same error:
<internal:lib/rubygems/custom_require>:29:in require': no such file to load --
/Users/jb/Documents/Aptana Studio 3 Works开发者_JAVA技巧pace/active_merchant (LoadError)
from <internal:lib/rubygems/custom_require>:29:in
require'
from simple_gw_test.rb:2:in `<main>'
;
Any Ruby Guru who can shed some light greatly appreaciated!
--jb
PS: I'm using MRI 1.9.2 on Windows 7 x64.
Make sure you have read access to that file. Ruby has given me that error before when I didn't have correct permissions.
I guess I scratched my own itch: After a couple of hours of "Pickaxe book-ing" and googling, I got the code necessary to bootstap the gem without it being installed:
require_relative 'active_merchant/lib/active_merchant'
精彩评论