OSDN Git Service

ruby-1.9.1-rc1
[splhack/AndroidRuby.git] / lib / ruby-1.9.1-rc1 / lib / rubygems / defaults.rb
1 module Gem
2
3   @post_install_hooks   ||= []
4   @post_uninstall_hooks ||= []
5   @pre_uninstall_hooks  ||= []
6   @pre_install_hooks    ||= []
7
8   ##
9   # An Array of the default sources that come with RubyGems
10
11   def self.default_sources
12     %w[http://gems.rubyforge.org/]
13   end
14
15   ##
16   # Default home directory path to be used if an alternate value is not
17   # specified in the environment
18
19   def self.default_dir
20     if defined? RUBY_FRAMEWORK_VERSION then
21       File.join File.dirname(ConfigMap[:sitedir]), 'Gems',
22                 ConfigMap[:ruby_version]
23     elsif RUBY_VERSION > '1.9' then
24       File.join(ConfigMap[:libdir], ConfigMap[:ruby_install_name], 'gems',
25                 ConfigMap[:ruby_version])
26     else
27       File.join(ConfigMap[:libdir], ruby_engine, 'gems',
28                 ConfigMap[:ruby_version])
29     end
30   end
31
32   ##
33   # Path for gems in the user's home directory
34
35   def self.user_dir
36     File.join(Gem.user_home, '.gem', ruby_engine,
37               ConfigMap[:ruby_version])
38   end
39
40   ##
41   # Default gem load path
42
43   def self.default_path
44     [user_dir, default_dir]
45   end
46
47   ##
48   # Deduce Ruby's --program-prefix and --program-suffix from its install name
49
50   def self.default_exec_format
51     baseruby = ConfigMap[:BASERUBY] || 'ruby'
52     ConfigMap[:RUBY_INSTALL_NAME].sub(baseruby, '%s') rescue '%s'
53   end
54
55   ##
56   # The default directory for binaries
57
58   def self.default_bindir
59     if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
60       '/usr/bin'
61     else # generic install
62       ConfigMap[:bindir]
63     end
64   end
65
66   ##
67   # The default system-wide source info cache directory
68
69   def self.default_system_source_cache_dir
70     File.join Gem.dir, 'source_cache'
71   end
72
73   ##
74   # The default user-specific source info cache directory
75
76   def self.default_user_source_cache_dir
77     File.join Gem.user_home, '.gem', 'source_cache'
78   end
79
80   ##
81   # A wrapper around RUBY_ENGINE const that may not be defined
82
83   def self.ruby_engine
84     if defined? RUBY_ENGINE then
85       RUBY_ENGINE
86     else
87       'ruby'
88     end
89   end
90
91 end
92