[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

RubyCocoa and libxml-ruby-0.3.6

pere.noel

3/7/2006 7:22:00 PM

i have two versions of Ruby with my computer, the default Tiger one
(1.8.2) and another one installed in /usr/local

i've buil recently RubyCocoa using the ruby in /ur/local

however, within XCode when i print out ruby --version, i still get the
Tiger's one (1.8.2)

then, following an advice given on RubyCocoa-talk i've installed also
libxml-ruby-0.3.6 for the Tiger's ruby.

each time i put a "require 'xml/libxml'" i my "rb_main.rb" file i get an
error saying this Tiger's ruby is unable to find that extension.

in order to install libxml-ruby-0.3.6 for the Tiger's ruby i had to
install also rubygems.

if i make a test, using Tiger's ruby, from the command line i get no
error the libray is found.

it is only when wanting to use it from XCode, in a RubyCocoa app i get
this error.

any idae ???
--
une bévue
28 Answers

John N. Alegre

3/7/2006 7:38:00 PM

0

Use DarwinPorts to install ruby which will put yet another ruby
in /opt/local/bin but this will be easy to keep updated, again with
DarwinPorts, then use DarwinPorts to install RubyCocoa. It puts everything
where it should be.

john

Une bévue wrote:

> i have two versions of Ruby with my computer, the default Tiger one
> (1.8.2) and another one installed in /usr/local
>
> i've buil recently RubyCocoa using the ruby in /ur/local
>
> however, within XCode when i print out ruby --version, i still get the
> Tiger's one (1.8.2)
>
> then, following an advice given on RubyCocoa-talk i've installed also
> libxml-ruby-0.3.6 for the Tiger's ruby.
>
> each time i put a "require 'xml/libxml'" i my "rb_main.rb" file i get an
> error saying this Tiger's ruby is unable to find that extension.
>
> in order to install libxml-ruby-0.3.6 for the Tiger's ruby i had to
> install also rubygems.
>
> if i make a test, using Tiger's ruby, from the command line i get no
> error the libray is found.
>
> it is only when wanting to use it from XCode, in a RubyCocoa app i get
> this error.
>
> any idae ???

pere.noel

3/7/2006 7:53:00 PM

0

John N. Alegre <info@johnalegre.net> wrote:

> Use DarwinPorts to install ruby which will put yet another ruby
> in /opt/local/bin but this will be easy to keep updated, again with
> DarwinPorts, then use DarwinPorts to install RubyCocoa. It puts everything
> where it should be.

obviously we could also rubygems with darwinports ?

i'll try taht asap thanks :-)
--
une bévue

Craig Demyanovich

3/7/2006 8:13:00 PM

0

Une bévue wrote:
> obviously we could also rubygems with darwinports ?

I do, and it has worked very well.... Although, I haven't been able to
install libxml-ruby using RubyGems. It can't find the libiconv installed
by DarwinPorts. When I have some time to write up my problem, I'll post
it to the list.

Regards,
Craig


Daniel Harple

3/7/2006 8:20:00 PM

0

On Mar 7, 2006, at 9:12 PM, Craig Demyanovich wrote:

> Une bévue wrote:
>> obviously we could also rubygems with darwinports ?
>
> I do, and it has worked very well.... Although, I haven't been able
> to install libxml-ruby using RubyGems. It can't find the libiconv
> installed by DarwinPorts. When I have some time to write up my
> problem, I'll post it to the list.
>
> Regards,
> Craig

I made a libxml-ruby portfile for DarwinPorts. It has been in
bugzilla for about 2 weeks -- maybe I should start bugging them on
the mailing list. They also haven't looked at my mod_ruby update (all
it does it update the version and md5 checksum).

-- Daniel

pere.noel

3/7/2006 8:38:00 PM

0

Craig Demyanovich <demmer12@fastmail.us> wrote:

> I do, and it has worked very well.... Although, I haven't been able to
> install libxml-ruby using RubyGems.

unfortunately, this isn't my case ;-)

because, before to darwinports i had allready installed rubygems into
/opt/local i get the following error message at the activate step :
---> Activating rb-rubygems 0.8.11_0
Error: Target com.apple.activate returned: Image error:
/opt/local/lib/ruby/gems/1.8/cache/sources-0.0.1.gem already exists and
does not belong to a registered port. Unable to activate port
rb-rubygems.
Error: /opt/local/bin/port: Status 1 encountered during processing.

do you know some workaround ?
--
une bévue

pere.noel

3/7/2006 8:51:00 PM

0

Une bévue <pere.noel@laponie.com.invalid> wrote:

> do you know some workaround ?

i did a :

rm -rf /opt/local/lib/ruby/gems

followed by a :

~/Darwinports%> sudo port install rb-rubygems
---> Activating rb-rubygems 0.8.11_0
---> Cleaning rb-rubygems


then everything, up to now, worked fine.
--
une bévue

pere.noel

3/7/2006 9:30:00 PM

0

John N. Alegre <info@johnalegre.net> wrote:

> Use DarwinPorts to install ruby which will put yet another ruby
> in /opt/local/bin but this will be easy to keep updated, again with
> DarwinPorts, then use DarwinPorts to install RubyCocoa. It puts everything
> where it should be.

i not sure about that, having done a complete re-install of ruby,
rubgems and rubycocoa i still get from my rb_main.rb where i've put :

def rb_main_init
path = OSX::NSBundle.mainBundle.resourcePath.fileSystemRepresentation
rbfiles = Dir.entries(path).select {|x| /\.rb\z/ =~ x}
rbfiles -= [ File.basename(__FILE__) ]
which_ruby=`which ruby `.chomp
p "#{which_ruby}"
p `#{which_ruby} --version`
p $LOAD_PATH
rbfiles.each do |path|
require( File.basename(path) )
end
end


the print out is :

"/usr/bin/ruby"
"ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]\n"

still Tiger's ruby...

however the $LOAD_PATH is :
["/Users/yvon/work/RubyCocoa/BookmarksMerge/build/Development/BookmarksM
erge.app/Contents/Resources",
"/Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby",
"/opt/local/lib/ruby/site_ruby/1.8",
"/opt/local/lib/ruby/site_ruby/1.8/powerpc-darwin8.5.0",
"/opt/local/lib/ruby/site_ruby", "/opt/local/lib/ruby/vendor_ruby/1.8",
"/opt/local/lib/ruby/vendor_ruby/1.8/powerpc-darwin8.5.0",
"/opt/local/lib/ruby/vendor_ruby", "/opt/local/lib/ruby/1.8",
"/opt/local/lib/ruby/1.8/powerpc-darwin8.5.0", "."]


then again, again and again, ruby is tiger's one even the $LOAD_PATH of
it is the corect one : /opt/local/blahblah...

exactly what i've get before using a "handy" install...

something wrong, to me, here !
--
une bévue

John N. Alegre

3/7/2006 10:32:00 PM

0

Une,

Do you use any other ports? How many?

/opt/local is ONLY used by DP so you have the option of blowing
away /opt/local (sudo rm -rf /opt/local) reinstalling ports and then
reinstalling any ports you use.

On the issue of your scripts still finding /usr/bin/ruby, it is necessary to
put in your .pofile in your home directrory "export
PATH=/opt/local/bin:/opt/local/sbin:$path"
This will make ports found first. If you use fink too do this AFTER you
call the fink script.

Good luck
john

Une bévue wrote:

> Craig Demyanovich <demmer12@fastmail.us> wrote:
>
>> I do, and it has worked very well.... Although, I haven't been able to
>> install libxml-ruby using RubyGems.
>
> unfortunately, this isn't my case ;-)
>
> because, before to darwinports i had allready installed rubygems into
> /opt/local i get the following error message at the activate step :
> --->  Activating rb-rubygems 0.8.11_0
> Error: Target com.apple.activate returned: Image error:
> /opt/local/lib/ruby/gems/1.8/cache/sources-0.0.1.gem already exists and
> does not belong to a registered port.  Unable to activate port
> rb-rubygems.
> Error: /opt/local/bin/port: Status 1 encountered during processing.
>
> do you know some workaround ?

pere.noel

3/8/2006 7:35:00 AM

0

John N. Alegre <info@johnalegre.net> wrote:

> Do you use any other ports? How many?

no, only those related to ruby.

> /opt/local is ONLY used by DP so you have the option of blowing
> away /opt/local (sudo rm -rf /opt/local) reinstalling ports and then
> reinstalling any ports you use.

yes i know.

> On the issue of your scripts still finding /usr/bin/ruby, it is necessary to
> put in your .pofile in your home

i think you mean .profile ?
-------------------^-----

or, does exist a .portfile file ?
--------------------^^----

i think this has been done automatically by the Darwinports pkg :
> cat .profile
#
# Your previous .profile (if any) is saved as .profile.dpsaved
# Setting the path for DarwinPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH

> directrory "export
> PATH=/opt/local/bin:/opt/local/sbin:$path"
> This will make ports found first. If you use fink too do this AFTER you
> call the fink script.

no i don't use fink.


BUT, i wonder about the useness of .profile, is this used by XCode ?
i don't think so.
also, i'm using zsh instead of bash as a shell.
my $PATH is obviously starting by /opt/local/bin :
> echo $PATH
/opt/local/bin:/usr/local/bin:/usr/local/mysql/bin:/bin:/usr/bin:/sbin:/
usr/sbin:/usr/X11R6/bin:/Users/yvon/bin:/Developer/qt/bin:/usr/local/pgs
ql/bin:/Users/yvon/bin/groovy/bin



my ruby scripts does have a shebang like that :

#!/usr/bin/env ruby -w

then, when launching a ruby script from Terminal i get the right ruby
according to the $PATH

all of those scripts are working correctly, from Terminal.

again, i don't think XCode nor RubyCocoa use this way to find ruby (thru
$PATH)

Jonathan Paisley (on RubyCocoa-talk mail-list) said something like "ruby
cocoa don't use /opt/local/bin/ruby" it finds that by $LOAD_PATH, which
is correct.

Finally may be it is MY way to print-out which ruby is in under use
being WRONG (from XCode /RubyCocoa) :
which_ruby=`which ruby `.chomp
p "#{which_ruby}"
p `#{which_ruby} --version`
p $LOAD_PATH


because i don't know, in the XCpde/RubyCocoa context, what's the SHELL
in use (i've set the $SHELL to /usr/local/bin/zsh.

to finish with, adding this line (after p $LOAD_PATH) in my rb_main.rb :
p `ruby --version`
i get :
"ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]\n"

now, i'll try, before (re)+ installing ruby and co, try a libxml binder
install by gem.
--
une bévue

Dave Howell

3/8/2006 8:27:00 AM

0


On Mar 7, 2006, at 23:38, Une bévue wrote:

>
> BUT, i wonder about the useness of .profile, is this used by XCode ?
> i don't think so.

Nope. It only affects what you get when you type "ruby" at the command
line.

> again, i don't think XCode nor RubyCocoa use this way to find ruby
> (thru
> $PATH)

I had the same problem. Somebody told me to use DarwinPorts, but
happily, I didn't take their advice. The last thing I needed was yet
another install of Ruby in yet another location. I already had too many
installs as it was! {chuckle}

Look and see if you have too many RubyCocoa.framework files. I'll bet
you'll find one in /Library/Frameworks, AND one in
~/Library/Frameworks. Delete the one in your user Library, and XCode
should start finding the one you want.