Need help with require while modifiying a gem (active_merchant) - ruby

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 Workspace/active_merchant (LoadError)
from <internal:lib/rubygems/custom_require>:29:inrequire'
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'

Related

Error on running a Ruby Application

I'm building an enigma machine simulator in ruby using aptana studio 3 on ubuntu 16.04 LTS.
When I run the application the following error occurs:
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- enigma/rotor.rb (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/xxxx/Downloads/enigma-ruby-master/lib/enigma.rb:1:in `<main>'
Please.
It would be helpful if you added the require code from your ruby file, but I suspect the following
rotor.rb is a file you have created in your enigma project, and is contained in the enigma folder
your require should be
require './enigma/rotor'
or
require './enigma/rotor.rb'
if the enigma directory is a sub-directory of the one you are currently operating in
require './rotor'
or
require './rotor'
This will say to source the file locally and not to look through the general libraries or gem's you may have added

kernel_require.rb:55:in `require': cannot load such file -- pry-byebug (LoadError)

I'm following along this tutorial on rspec using this page: Test First: Learn Ruby and using this Github repo: Github Repo for same course using rspec v3. My issue is that after cloning the repo, running bundle install in the root directory, and then rspec --init to create the spec_helper.rb file, I run rake spec and I end up with this error regarding a dependency: ~\.rbenv/versions/2.3.0/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in 'require': cannot load such file -- pry-byebug (LoadError)
The thing is that the pry-byebug gem is installed. I've uninstalled and reinstalled it, removed the repo and restarted, but no matter what I get this error, and I'm not sure how to resolve it.
I'm new to programming and to this site so any information I've left out I can easily provide.
EDIT: I eventually figured out my rookie mistake: there's a folder in the path that has a space in it. Changing that fixed the issue.
Spaces in the file path to the project cause problems, apparently. I edited the offending folder and rspec then worked as intended.

`require': no such file to load -- rubygems (LoadError)

I am trying to create aws pipeline on vm for which i am using ruby1..3 and rubygems 2.0.3.While trying to create pipeline I am getting following error.
./aws/core/client.rb:14:in `require': no such file to load -- rubygems (LoadError)
Please help me with this problem....
It seems like you are having problems with your ruby/gem installation.
Maybe you have 2 ruby version installed simultaneously on the same machine?
Although not exactly the same question, but it seems that you can try the solutions described in this stackoverflow thread.

ruby test-unit test runner isnt running

I am attempting to make a custom test runner using test/unit in ruby
and have followed a tutorial outlined here
http://endofline.wordpress.com/2008/02/11/a-custom-testrunner-to-scratch-an-itch/
however when i try to run on it using the
ruby -rfast_fail_runner example_test.rb --runner fastfail
however i get the error
C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- fast_fail_runner (LoadError)
from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
You have a file in the current directory named fast_fail_runner.rb, right? Ruby is not finding it. You are following a very old tutorial and I suspect that old versions of Ruby had the current directory (.) on the load path or something like that.
Try replacing -rfast_fail_runner with -r./fast_fail_runner.

Rails Sinatra application not loading Gems. Do I have them in the wrong place?

I hope you can help me.
I am working on a small Sinatra Rails application. I have Ruby installed on Mac OSX using RVM (currently using ruby 1.9.2)
I changed my app to include some new gems and to use bundler/setup but I receive the following error when I start the server:
/Users/Matt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- bundler/setup (LoadError)
from /Users/Matt/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from application.rb:2:in `<main>'
I am fairly sure I have something going wrong here, I'm just not sure what or how to fix it.
Running the which commands receives the following output:
which ruby: /Users/Matt/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
which bundle: /Users/Matt/.rvm/gems/ruby-1.9.2-p290/bin/bundle
which gem: /Users/Matt/.rvm/rubies/ruby-1.9.2-p290/bin/gem
Please can someone help me as this is starting to drive me a little crazy.
Many thanks in advance for your help.
from the #stephenmurdoch's comment above:
try running gem install bundler followed by bundle install from inside your application.

Resources