aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/resolver/specification.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-25 19:14:49 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-25 19:14:49 +0000
commit04817ae6d3e1d898d6fbf09ad146850d26d2b404 (patch)
tree7e5482d13830cacf363d21a087b490588a960095 /lib/rubygems/resolver/specification.rb
parentc107372597586e1ad0fea03c00a14bdd7205b5d8 (diff)
downloadruby-04817ae6d3e1d898d6fbf09ad146850d26d2b404.tar.gz
* lib/rubygems: Update to RubyGems master 612f85a. Notable changes:
Fixed installation and activation of git: and path: gems via Gem.use_gemdeps Improved documentation coverage * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/resolver/specification.rb')
-rw-r--r--lib/rubygems/resolver/specification.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/rubygems/resolver/specification.rb b/lib/rubygems/resolver/specification.rb
index 7dd4c2e829..d158225474 100644
--- a/lib/rubygems/resolver/specification.rb
+++ b/lib/rubygems/resolver/specification.rb
@@ -56,5 +56,34 @@ class Gem::Resolver::Specification
"#{@name}-#{@version}"
end
+ ##
+ # Installs this specification using the Gem::Installer +options+. The
+ # install method yields a Gem::Installer instance, which indicates the
+ # gem will be installed, or +nil+, which indicates the gem is already
+ # installed.
+
+ def install options
+ require 'rubygems/installer'
+
+ destination = options[:install_dir] || Gem.dir
+
+ Gem.ensure_gem_subdirectories destination
+
+ gem = source.download spec, destination
+
+ installer = Gem::Installer.new gem, options
+
+ yield installer if block_given?
+
+ installer.install
+ end
+
+ ##
+ # Returns true if this specification is installable on this platform.
+
+ def installable_platform?
+ Gem::Platform.match spec.platform
+ end
+
end