summaryrefslogtreecommitdiff
path: root/gem_prelude.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-31 22:27:35 (GMT)
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-31 22:27:35 (GMT)
commitaf0221e728742adb34aa5e2abfcefa899ccd1867 (patch)
treef857a455a6627484a5e790eedee57cf8fcbdd22e /gem_prelude.rb
parentff5a076e7e1dbe8f255cb23a03be006fded7d277 (diff)
Don't require rubygems/defaults from gem_prelude.rb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gem_prelude.rb')
-rw-r--r--gem_prelude.rb111
1 files changed, 104 insertions, 7 deletions
diff --git a/gem_prelude.rb b/gem_prelude.rb
index 7c54bdd..ddc56c8 100644
--- a/gem_prelude.rb
+++ b/gem_prelude.rb
@@ -1,4 +1,6 @@
# depends on: array.rb dir.rb env.rb file.rb hash.rb module.rb regexp.rb
+# vim: filetype=ruby
+# THIS FILE WAS AUTOGENERATED, DO NOT EDIT
if defined?(Gem) then
@@ -75,6 +77,97 @@ if defined?(Gem) then
def self.ensure_gem_subdirectories(path)
end
+
+ @post_install_hooks ||= []
+ @post_uninstall_hooks ||= []
+ @pre_uninstall_hooks ||= []
+ @pre_install_hooks ||= []
+
+ ##
+ # An Array of the default sources that come with RubyGems
+
+ def self.default_sources
+ %w[http://gems.rubyforge.org/]
+ end
+
+ ##
+ # Default home directory path to be used if an alternate value is not
+ # specified in the environment
+
+ def self.default_dir
+ if defined? RUBY_FRAMEWORK_VERSION then
+ File.join File.dirname(ConfigMap[:sitedir]), 'Gems',
+ ConfigMap[:ruby_version]
+ elsif RUBY_VERSION > '1.9' then
+ File.join(ConfigMap[:libdir], ConfigMap[:ruby_install_name], 'gems',
+ ConfigMap[:ruby_version])
+ else
+ File.join(ConfigMap[:libdir], ruby_engine, 'gems',
+ ConfigMap[:ruby_version])
+ end
+ end
+
+ ##
+ # Path for gems in the user's home directory
+
+ def self.user_dir
+ File.join(Gem.user_home, '.gem', ruby_engine,
+ ConfigMap[:ruby_version])
+ end
+
+ ##
+ # Default gem load path
+
+ def self.default_path
+ [user_dir, default_dir]
+ end
+
+ ##
+ # Deduce Ruby's --program-prefix and --program-suffix from its install name
+
+ def self.default_exec_format
+ baseruby = ConfigMap[:BASERUBY] || 'ruby'
+ ConfigMap[:RUBY_INSTALL_NAME].sub(baseruby, '%s') rescue '%s'
+ end
+
+ ##
+ # The default directory for binaries
+
+ def self.default_bindir
+ if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
+ '/usr/bin'
+ else # generic install
+ ConfigMap[:bindir]
+ end
+ end
+
+ ##
+ # The default system-wide source info cache directory
+
+ def self.default_system_source_cache_dir
+ File.join Gem.dir, 'source_cache'
+ end
+
+ ##
+ # The default user-specific source info cache directory
+
+ def self.default_user_source_cache_dir
+ File.join Gem.user_home, '.gem', 'source_cache'
+ end
+
+ ##
+ # A wrapper around RUBY_ENGINE const that may not be defined
+
+ def self.ruby_engine
+ if defined? RUBY_ENGINE then
+ RUBY_ENGINE
+ else
+ 'ruby'
+ end
+ end
+
+
+
# Methods before this line will be removed when QuickLoader is replaced
# with the real RubyGems
@@ -82,8 +175,7 @@ if defined?(Gem) then
begin
verbose, debug = $VERBOSE, $DEBUG
- $VERBOSE = $DEBUG = nil
- require 'rubygems/defaults'
+ $DEBUG = $VERBOSE = nil
begin
require 'rubygems/defaults/operating_system'
@@ -113,7 +205,8 @@ if defined?(Gem) then
undef_method :gem if method_defined? :gem
end
- $".delete File.join(Gem::ConfigMap[:libdir], Gem::ConfigMap[:ruby_install_name],
+ $".delete File.join(Gem::ConfigMap[:libdir],
+ Gem::ConfigMap[:ruby_install_name],
Gem::ConfigMap[:ruby_version], 'rubygems.rb')
require 'rubygems'
@@ -125,7 +218,7 @@ if defined?(Gem) then
def push_gem_version_on_load_path(gem_name, *version_requirements)
if version_requirements.empty?
unless GemPaths.has_key?(gem_name)
- raise LoadError.new("Could not find RubyGem #{gem_name} (>= 0)\n")
+ raise LoadError.new("Could not find RubyGem #{gem_name} (>= 0)\n")
end
# highest version gems already active
@@ -141,7 +234,7 @@ if defined?(Gem) then
if requirement == ">" || requirement == ">="
if (GemVersions[gem_name] <=> Gem.calculate_integers_for_gem_version(version)) >= 0
- return false
+ return false
end
elsif requirement == "~>"
loaded_version = GemVersions[gem_name]
@@ -190,8 +283,12 @@ if defined?(Gem) then
require_paths = []
GemPaths.each_value do |path|
- if File.exist?(file = File.join(path, ".require_paths"))
- require_paths.concat(File.read(file).split.map {|require_path| File.join(path, require_path)})
+ if File.exist?(file = File.join(path, ".require_paths")) then
+ paths = File.read(file).split.map do |require_path|
+ File.join path, require_path
+ end
+
+ require_paths.concat paths
else
require_paths << file if File.exist?(file = File.join(path, "bin"))
require_paths << file if File.exist?(file = File.join(path, "lib"))