1

How do I use ruby gems in google-sketchup?

Whenever I try typing:

> require 'rubygems'

into the ruby console, I get the following:

Error: #<LoadError: (eval):7:in `require': no such file to load -- rubygems>

EDIT

I am on OSX.

dsg
  • 12,924
  • 21
  • 67
  • 111
  • What OS are you on? Mac OS X and Windows are very different in terms of paths and loading. – coreyward Feb 13 '11 at 06:04
  • Which Ruby version do you use? Did you installed Ruby by source or are you using the default Ruby version shipped with MaxOSX? – Simone Carletti Feb 13 '11 at 15:05
  • I am using ruby 1.8.7. I'm not sure abou the second question, I think I installed it rather than using the default. – dsg Feb 13 '11 at 20:09

2 Answers2

1

sorry this is not an answer, i just thought i could shed some more light... (i dont have enough rep points to comment yet)

typing RUBY_VERSION in the SketchUp Ruby Console returns 1.8.5?

i have several ruby versions on my mac but certainly not 1.8.5.

using sketchup 8.0.4810

firien
  • 1,548
  • 16
  • 23
  • typing `> RUBY_VERSION` into the SketchUp Ruby Console gives `1.8.7`. There are ways of changing the Ruby version used by SketchUp: http://superuser.com/questions/167453/how-to-update-ruby-in-google-sketchup-for-mac – dsg Feb 22 '11 at 00:32
1

need ruby1.8.6, and add some paths to $LOAD_PATH before require rubygems:

$LOAD_PATH << "C:/Ruby186/lib/ruby/1.8"
$LOAD_PATH << "C:/Ruby186/lib/ruby/site_ruby/1.8"
$LOAD_PATH << "C:/Ruby186/lib/ruby/1.8/i386-mingw32"

$LOAD_PATH.uniq!

# print LOAD PATHS to console
Sketchup.send_action('showRubyPanel:')
  UI.start_timer(1,false) {
  puts "\nLOAD PATHS:\n"
  $LOAD_PATH.each {|x| puts "#{x}\n"}
  puts "\n\n"
}

require 'rubygems' #=> true

edit C:\Ruby186\lib\ruby\site_ruby\1.8\rubygems.rb remove line 12

#require 'thread' # HACK: remove me for 1.5 - this is here just for rails
user760308
  • 11
  • 2