diff options
author | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 21:23:04 +0000 |
---|---|---|
committer | ryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-19 21:23:04 +0000 |
commit | 64847a9cfe467b808ca5e8148dfa85a059198963 (patch) | |
tree | b21ca4404f92f1fe269347a8d624cf188e7fbc97 /lib/rubygems.rb | |
parent | df2762fb1aaa82577b4e3e8df67cc56b7aefdfb8 (diff) |
Importing rubygems @ c2d4131: Deal with platforms that have DLEXT2 == nil. Fixes RF#28867
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r-- | lib/rubygems.rb | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb index d8f49d552b..08c675a86f 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -193,6 +193,7 @@ module Gem @ruby = nil @sources = [] + @post_build_hooks ||= [] @post_install_hooks ||= [] @post_uninstall_hooks ||= [] @pre_uninstall_hooks ||= [] @@ -729,6 +730,17 @@ module Gem end ## + # Adds a post-build hook that will be passed an Gem::Installer instance + # when Gem::Installer#install is called. The hook is called after the gem + # has been extracted and extensions have been built but before the + # executables or gemspec has been written. If the hook returns +false+ then + # the gem's files will be removed and the install will be aborted. + + def self.post_build(&hook) + @post_build_hooks << hook + end + + ## # Adds a post-install hook that will be passed an Gem::Installer instance # when Gem::Installer#install is called @@ -747,7 +759,8 @@ module Gem ## # Adds a pre-install hook that will be passed an Gem::Installer instance - # when Gem::Installer#install is called + # when Gem::Installer#install is called. If the hook returns +false+ then + # the install will be aborted. def self.pre_install(&hook) @pre_install_hooks << hook @@ -986,7 +999,8 @@ module Gem '.rb', *%w(DLEXT DLEXT2).map { |key| val = RbConfig::CONFIG[key] - ".#{val}" unless val.empty? + next unless val and not val.empty? + ".#{val}" } ].compact.uniq end @@ -1097,6 +1111,12 @@ module Gem attr_reader :loaded_specs ## + # The list of hooks to be run before Gem::Install#install finishes + # installation + + attr_reader :post_build_hooks + + ## # The list of hooks to be run before Gem::Install#install does any work attr_reader :post_install_hooks @@ -1219,9 +1239,6 @@ end ## # Enables the require hook for RubyGems. -# -# Ruby 1.9 allows --disable-gems, so we require it when we didn't detect a Gem -# constant at rubygems.rb load time. require 'rubygems/custom_require' |