I am having a problem getting gems configured properly on my Mac (OS X
10.4.7), hopefully someone here can help me out. I installed ruby and
ruby gems using the instructions at http://hivelogic.com/articles/2005/12/01/ruby_rails_lighttpd_mysql_tiger.
I am trying to use the XmlSimple gem, but Ruby can't seem to find it, or
any other gems. I did
$ sudo gem install xml-simple
which seemed to work fine. but then
$ ruby -e "require 'xmlsimple'"
-e:1:in `require': no such file to load -- xmlsimple (LoadError)
from -e:1
I am having a problem getting gems configured properly on my Mac (OS X
10.4.7), hopefully someone here can help me out. I installed ruby and
ruby gems using the instructions at Dan Benjamin.
I am trying to use the XmlSimple gem, but Ruby can't seem to find it, or
any other gems. I did
$ sudo gem install xml-simple
which seemed to work fine. but then
$ ruby -e "require 'xmlsimple'"
-e:1:in `require': no such file to load -- xmlsimple (LoadError)
from -e:1
On Aug 12, 2006, at 11:43 AM, Geoff Hulette wrote:
I am trying to use the XmlSimple gem, but Ruby can't seem to find it, or
any other gems. I did
$ sudo gem install xml-simple
which seemed to work fine. but then
$ ruby -e "require 'xmlsimple'"
-e:1:in `require': no such file to load -- xmlsimple (LoadError)
from -e:1
maybe gems is installed wrong?
--
The folly of mistaking a paradox for a discovery, a metaphor for a proof, a torrent of verbiage for a spring of capital truths, and oneself for an oracle, is inborn in us.
-Paul Valery, poet and philosopher (1871-1945)
I am having a problem getting gems configured properly on my Mac (OS X
10.4.7), hopefully someone here can help me out. I installed ruby and
ruby gems using the instructions at Dan Benjamin.
I am trying to use the XmlSimple gem, but Ruby can't seem to find it, or
any other gems. I did
$ sudo gem install xml-simple
which seemed to work fine. but then
$ ruby -e "require 'xmlsimple'"
-e:1:in `require': no such file to load -- xmlsimple (LoadError)
from -e:1
Sorry to hijack here, but this is an issue that has sort of unsettled me as I
have seen it come up on this list a few times. Perhaps I am not understanding
gems fully here, but what if you are writing software to be released to the
public that relies on a 3rd party library?
Some might have the lib installed from gems and some might have installed
manually or whatever ... so how do you reconcile the two if you must require
rubygems to use gem installed libs? Why is the gems directory not added to
the regular include path? Are you required to write code to deal with this?
How do experienced Ruby devs deal with this issue? Or am I just thick and it
isn't an issue at all?
any insight appreciated,
-d
···
--
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
quoth the lists:
> Try this:
>
> ruby -e "require 'rubygems'; require 'xml-simple'"
>
> You have to require rubygems first.
Sorry to hijack here, but this is an issue that has sort of unsettled me as I
have seen it come up on this list a few times. Perhaps I am not understanding
gems fully here, but what if you are writing software to be released to the
public that relies on a 3rd party library?
Some might have the lib installed from gems and some might have installed
manually or whatever ... so how do you reconcile the two if you must require
rubygems to use gem installed libs? Why is the gems directory not added to
the regular include path? Are you required to write code to deal with this?
How do experienced Ruby devs deal with this issue? Or am I just thick and it
isn't an issue at all?
any insight appreciated,
export RUBYOPT=rubygems
The you can use "require" to load both gem-libraries and
non-gem-libraries.
Regards,
Tilman
···
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
The you can use "require" to load both gem-libraries and
non-gem-libraries.
Regards,
Tilman
Thanks Tilman,
That's what I was looking for...
-d
···
--
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
Of course, this isn't such a great solution from inside a library, However, it's not too hard.
begin
require 'rubygems'
rescue LoadError
end
···
On Sun, 13 Aug 2006, Tilman Sauerbeck wrote:
Some might have the lib installed from gems and some might have installed
manually or whatever ... so how do you reconcile the two if you must require
rubygems to use gem installed libs? Why is the gems directory not added to
the regular include path? Are you required to write code to deal with this?
How do experienced Ruby devs deal with this issue? Or am I just thick and it
isn't an issue at all?
>>Some might have the lib installed from gems and some might have installed
>>manually or whatever ... so how do you reconcile the two if you must
>>require
>>rubygems to use gem installed libs? Why is the gems directory not added to
>>the regular include path? Are you required to write code to deal with
>>this?
>>How do experienced Ruby devs deal with this issue? Or am I just thick and
>>it
>>isn't an issue at all?
>>
>>any insight appreciated,
>
>export RUBYOPT=rubygems
Of course, this isn't such a great solution from inside a library,
However, it's not too hard.
If you are the author of some library:
cat <<EOF >>README
If you're using rubygems, please export RUBYOPT=rubygems.
EOF
Done.
Regards,
Tilman
···
On Sun, 13 Aug 2006, Tilman Sauerbeck wrote:
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
> >export RUBYOPT=rubygems
>
> Of course, this isn't such a great solution from inside a library,
> However, it's not too hard.
If you are the author of some library:
cat <<EOF >>README
If you're using rubygems, please export RUBYOPT=rubygems.
EOF
Done.
I guess it would be bad form to go setting env variables on someone's system
from within a lib...
So you could do:
begin
require 'rubygems'
rescue LoadError
end
require 'libfoo'
And it would load 'libfoo' either through gems, if present, or regularly if
not? Is that right?
Regards,
Tilman
-d
···
--
darren kirby :: Part of the problem since 1976 :: http://badcomputer.org
"...the number of UNIX installations has grown to 10, with more expected..."
- Dennis Ritchie and Ken Thompson, June 1972
quoth the Tilman Sauerbeck:
> > >export RUBYOPT=rubygems
> >
> > Of course, this isn't such a great solution from inside a library,
> > However, it's not too hard.
>
> If you are the author of some library:
>
> cat <<EOF >>README
> If you're using rubygems, please export RUBYOPT=rubygems.
> EOF
>
> Done.
I guess it would be bad form to go setting env variables on someone's system
from within a lib...
Of course. That's why you would tell your fellow users to please export
RUBYOPT=rubygems. So you don't have to change your code.
I'm sure this is documented somewhere, too.
Regards,
Tilman
···
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?