tags:

views:

222

answers:

2

I'm trying to use the Optiflag package in my Ruby code and whenever I try to do the necessary require optiflag.rb, my program fails with the standard no such file to load -- optiflag message. I added the directory with that library to my $PATH variable, but it's still not working. Any ideas?

+4  A: 

is it a gem? Are you doing

require 'rubygems'
require 'optiflag'

or equivalent?

Purfideas
Arg, I keep forgetting about that! Much thanks!
Chris Bunch
+2  A: 

It looks like it's a gem, so you need to enable ruby gems before requiring it.

This site explains many ways of how to do it. But to have the cheat sheet here these are:

1) Require the rubygems package before using a gem.

require "rubygems"
require "optiflag" # etc

2) Add the -rubygems flag to wherever you execute ruby. I.e:

ruby -rubygems Something.rb

3) Add an environment variable called RUBYOPT, giving it an option of rubygems. I.e:

RUBYOPT=rubygems
Daemin