[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

3 Errors in Ruby Gems

Lothar Scholz

11/24/2004 2:17:00 AM

Hello ,

While tracking a bug report for ArachnoRuby i found three errors in the
0.8.1 gems code. My program sets the environment "GEM_PATH".

1) If i use a normal windows path with backslashes in the environment
variable, then this does not work, because Dir::glob will fail.
So please convert all '\' to '/' this before feeding glob.

2) For some reasons Gem::@gem_path will have "/lib/ruby/gems/1.8" after
the directory that is given in GEM_PATH. Also @gem_home is set to this
wrong directory. Don't think that it is a good default value on
windows.

3) Error in Gem::Specification::build_paths

def self.build_paths
@paths = []
::Gem.path.each do |gempath|
@specs = Dir.glob("#{gempath}/specifications/*.gemspec").collect { |specfile| eval(File.read(specfile)) }.sort!
@specs.each do |spec|
spec.require_paths.each {|path|
@paths << "#{gempath}/gems/#{spec.full_name}/#{path}"
foo = "hallo"
}
end
end
end

Here you iterate over the gem path members but always reset @specs. So
in my case it founds the specs for in "c:/ruby/lib/ruby/gems/1.8" but
when trying to glob "/lib/ruby/gems/1.8" it clears the @specs member.
Later in def self.search_gempath(file) it will never find the
specification and so never activate the gem and always return
"false".

And by the way, on http://rubygems.rubyforge.org/wiki/wiki.pl...
you talk about a RUBY_GEMS environment variable, instead of GEM_PATH.
I think this is an also an mistake.


--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ru...
CTO Scriptolutions Ruby, PHP, Python IDE 's




1 Answer

Chad Fowler

11/24/2004 3:15:00 PM

0

Thanks, Lothar. These will be fixed for the next release.

Chad


On Wed, 24 Nov 2004 11:16:51 +0900, Lothar Scholz
<mailinglists@scriptolutions.com> wrote:
> Hello ,
>
> While tracking a bug report for ArachnoRuby i found three errors in the
> 0.8.1 gems code. My program sets the environment "GEM_PATH".
>
> 1) If i use a normal windows path with backslashes in the environment
> variable, then this does not work, because Dir::glob will fail.
> So please convert all '\' to '/' this before feeding glob.
>
> 2) For some reasons Gem::@gem_path will have "/lib/ruby/gems/1.8" after
> the directory that is given in GEM_PATH. Also @gem_home is set to this
> wrong directory. Don't think that it is a good default value on
> windows.
>
> 3) Error in Gem::Specification::build_paths
>
> def self.build_paths
> @paths = []
> ::Gem.path.each do |gempath|
> @specs = Dir.glob("#{gempath}/specifications/*.gemspec").collect { |specfile| eval(File.read(specfile)) }.sort!
> @specs.each do |spec|
> spec.require_paths.each {|path|
> @paths << "#{gempath}/gems/#{spec.full_name}/#{path}"
> foo = "hallo"
> }
> end
> end
> end
>
> Here you iterate over the gem path members but always reset @specs. So
> in my case it founds the specs for in "c:/ruby/lib/ruby/gems/1.8" but
> when trying to glob "/lib/ruby/gems/1.8" it clears the @specs member.
> Later in def self.search_gempath(file) it will never find the
> specification and so never activate the gem and always return
> "false".
>
> And by the way, on http://rubygems.rub.../wiki/wiki.pl...
> you talk about a RUBY_GEMS environment variable, instead of GEM_PATH.
> I think this is an also an mistake.
>
> --
> Best regards, emailto: scholz at scriptolutions dot com
> Lothar Scholz http://www.ru...
> CTO Scriptolutions Ruby, PHP, Python IDE 's
>
>


--

Chad Fowler
http://chad...
http://rubyc...
http://ruby...
http://rubygems.rub... (over 20,000 gems served!)