3 Errors in Ruby Gems

L

Lothar Scholz

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::mad: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?UserGuide
you talk about a RUBY_GEMS environment variable, instead of GEM_PATH.
I think this is an also an mistake.
 
C

Chad Fowler

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

Chad


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::mad: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?UserGuide
you talk about a RUBY_GEMS environment variable, instead of GEM_PATH.
I think this is an also an mistake.


--

Chad Fowler
http://chadfowler.com
http://rubycentral.org
http://rubygarden.org
http://rubygems.rubyforge.org (over 20,000 gems served!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top