1

I apologize if I've missed something obvious. I am new to Ruby.

My overall goal is to add functionality to an existing script, which is using rvm and gemsets.

When I install new gems to a particular gemset, the requires in my scripts fail to find them. I am using the following rvm instance:

$ rvm current jruby-1.6.7.2@preflight 

To confirm:

$ which ruby /Users/user/.rvm/rubies/jruby-1.6.7.2/bin/ruby $ ruby -v jruby 1.6.7.2 (ruby-1.8.7-p357) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.8.0_11) [darwin-x86_64-java] 

I specified the gemset into I install a given gem (let's say xml-simple).

$ rvm @preflight do gem install xml-simple Successfully installed xml-simple-1.1.5 1 gem installed 

To verify the gem installed correctly:

$ gem list *** LOCAL GEMS *** ... xml-simple (1.1.5) ... 

We see the module I installed there.

Following the xml-simple instructions to include the module, I run this script:

require 'xmlsimple'

which, results in:

$ ruby testver.rb LoadError: no such file to load -- xmlsimple require at org/jruby/RubyKernel.java:1033 (root) at testver.rb:1 

One suspicious thing I have seen is that printing out RUBY_VERSION and $LOAD_PATH shows me this:

$ ruby testver.rb 1.8.7 /Users/user/.rvm/rubies/jruby-1.6.7.2/lib/ruby/site_ruby/1.8 /Users/user/.rvm/rubies/jruby-1.6.7.2/lib/ruby/site_ruby/shared /Users/user/.rvm/rubies/jruby-1.6.7.2/lib/ruby/1.8 . 
1
  • Just as a finished this post, I encountered a solution from another post: stackoverflow.com/a/4209569/1258020. Adding equire "rubygems" worked. Writing out the question at least allowed me to focus in on the problem point. Sort of rubber-duckying. Commented May 18, 2015 at 16:12

1 Answer 1

0

Adding require "rubygems" is required prior to Ruby version 1.9.2, per this stackoverflow answer. This resolved my issue.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.