[Rubygems-developers] [ rubygems-Bugs-25741 ] Gem::Specification#installation_path should raise a proper exception
noreply at rubyforge.org
noreply at rubyforge.org
Fri May 1 19:49:10 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: Closed
>Resolution: Accepted
Priority: 2
Submitted By: Daniel Berger (djberg96)
>Assigned to: Eric Hodel (drbrain)
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
----------------------------------------------------------------------
>Comment By: Eric Hodel (drbrain)
Date: 2009-05-01 16:49
Message:
Fixed, now raises Gem::Exception with the hopefully clear-enough exception 'spec a-1 is not from an installed gem'
----------------------------------------------------------------------
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