[Rubygems-developers] [ rubygems-Bugs-25741 ] Gem::Specification#installation_path should raise a proper exception
noreply at rubyforge.org
noreply at rubyforge.org
Thu Apr 30 18:42:49 EDT 2009
Bugs item #25741, was opened at 2009-04-30 15:42
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=575&aid=25741&group_id=126
Category: other
Group: v1.3.x
Status: Open
Resolution: None
Priority: 2
Submitted By: Daniel Berger (djberg96)
Assigned to: Nobody (None)
Summary: Gem::Specification#installation_path should raise a proper exception
Initial Comment:
Hi,
The Gem::Specification#installation_path is a public method, but it isn't meant for direct use in a .gemspec file. If you try to call that method directly in a .gemspec file it will result in this error:
/usr/local/lib/ruby/site_ruby/1.8/rubygems/specification.rb:624:in `dirname': can't convert nil into String (TypeError)
Looking at the source we can see why:
def installation_path
File.expand_path(File.dirname(File.dirname(@loaded_from)))
end
The @loaded_from instance variable is nil, so it blows up. Instead, this should raise a proper exception of some sort to let people (like me) know that it isn't meant for direct use, but for inspection after installation.
Regards,
Dan
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=575&aid=25741&group_id=126
More information about the Rubygems-developers
mailing list