[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Gems not working

Doan, Alex

6/28/2007 6:39:00 PM

It's b/c you call your file 'hpricot.rb', rename the file to something
else and it should work.

-----Original Message-----
From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf
Of Vincent Predoehl
Sent: Thursday, June 28, 2007 1:30 PM
To: ruby-talk ML
Subject: Gems not working

I do not have rails, but I like to use Ruby Gems. I installed gem
hpricot and when I run my script with 'ruby', it has trouble finding the
Hpricot library. When I run the same code in IRB, it finds the gem. I
do have require 'rubygems' before require 'hpricot'. The code fails on
line 5, where I use the hpricot library for the first time ( which seems
strange )

require 'rubygems'
require 'pricot'
require 'open-uri'
# load the RedHanded home page
doc = Hpricot(open("http://redhanded.hobix.com/index....))
# change the CSS class on links
(doc/"span.entryPermalink").set("class", "newLinks") # remove the
sidebar (doc/"#sidebar").remove # print the altered HTML puts doc


This situation occurs when I run the script from teh command line:

ruby hpricot.rb

The same code runs perfectly in IRB. It would seem that IRB knows more
about gems while the ruby interpretor does not. What can I do about
this? Thanks.

--
Posted via http://www.ruby-....


1 Answer

Vincent Predoehl

6/28/2007 7:00:00 PM

0

Doan, Alex wrote:
> It's b/c you call your file 'hpricot.rb', rename the file to something
> else and it should work.

The platform is MacOS X Tiger. I installed hpricot using balloons from
here and it works:
http://balloon.hobix.c...

The file name was probably the problem though. Either way I got it
working and I renamed the file.

--
Posted via http://www.ruby-....