Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 107 lines (86 sloc) 2.312 kB
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
1 module Gem
3714bed @zenspider + Moved lots of stuff from rubygems.rb. (steveklabnik)
zenspider authored
2 DEFAULT_HOST = "https://rubygems.org"
f33345d @zenspider Removed Gem::FS and Gem::Path.
zenspider authored
3
28aca90 @drbrain Privatize kernel methods, expose Kernel extensions to RDoc.
drbrain authored
4 @post_install_hooks ||= []
ba2a83a @drbrain - Rename post_installs to done_installing
drbrain authored
5 @done_installing_hooks ||= []
28aca90 @drbrain Privatize kernel methods, expose Kernel extensions to RDoc.
drbrain authored
6 @post_uninstall_hooks ||= []
7 @pre_uninstall_hooks ||= []
8 @pre_install_hooks ||= []
9
e6587c0 @drbrain RDoc style
drbrain authored
10 ##
11 # An Array of the default sources that come with RubyGems
12
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
13 def self.default_sources
e153667 @drbrain Warn once about Gem::Dependency#version_requirement.
drbrain authored
14 %w[http://rubygems.org/]
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
15 end
16
e6587c0 @drbrain RDoc style
drbrain authored
17 ##
989df42 @drbrain Remove duplicate default_dir definition
drbrain authored
18 # Default home directory path to be used if an alternate value is not
e6587c0 @drbrain RDoc style
drbrain authored
19 # specified in the environment
20
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
21 def self.default_dir
9a5dd34 * More low-level integration.
Erik Hollensbe authored
22 path = if defined? RUBY_FRAMEWORK_VERSION then
f33345d @zenspider Removed Gem::FS and Gem::Path.
zenspider authored
23 [
24 File.dirname(ConfigMap[:sitedir]),
87b9085 Removed File.join idioms relating to Gem::FS.
Erik Hollensbe authored
25 'Gems',
9a5dd34 * More low-level integration.
Erik Hollensbe authored
26 ConfigMap[:ruby_version]
87b9085 Removed File.join idioms relating to Gem::FS.
Erik Hollensbe authored
27 ]
9a5dd34 * More low-level integration.
Erik Hollensbe authored
28 elsif ConfigMap[:rubylibprefix] then
87b9085 Removed File.join idioms relating to Gem::FS.
Erik Hollensbe authored
29 [
f33345d @zenspider Removed Gem::FS and Gem::Path.
zenspider authored
30 ConfigMap[:rubylibprefix],
87b9085 Removed File.join idioms relating to Gem::FS.
Erik Hollensbe authored
31 'gems',
32 ConfigMap[:ruby_version]
33 ]
9a5dd34 * More low-level integration.
Erik Hollensbe authored
34 else
87b9085 Removed File.join idioms relating to Gem::FS.
Erik Hollensbe authored
35 [
f33345d @zenspider Removed Gem::FS and Gem::Path.
zenspider authored
36 ConfigMap[:libdir],
37 ruby_engine,
87b9085 Removed File.join idioms relating to Gem::FS.
Erik Hollensbe authored
38 'gems',
39 ConfigMap[:ruby_version]
40 ]
9a5dd34 * More low-level integration.
Erik Hollensbe authored
41 end
f33345d @zenspider Removed Gem::FS and Gem::Path.
zenspider authored
42
43 @default_dir ||= File.join(*path)
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
44 end
45
e6587c0 @drbrain RDoc style
drbrain authored
46 ##
c469882 @evanphx + Add a default for where to install rubygems itself
evanphx authored
47 # Paths where RubyGems' .rb files and bin files are installed
48
49 def self.default_rubygems_dirs
50 nil # default to standard layout
51 end
52
53 ##
e6587c0 @drbrain RDoc style
drbrain authored
54 # Path for gems in the user's home directory
55
1194442 @technomancy Add Gem.user_dir and make use of it in installer.rb
technomancy authored
56 def self.user_dir
f33345d @zenspider Removed Gem::FS and Gem::Path.
zenspider authored
57 File.join Gem.user_home, '.gem', ruby_engine, ConfigMap[:ruby_version]
1194442 @technomancy Add Gem.user_dir and make use of it in installer.rb
technomancy authored
58 end
34daa6c @drbrain RDoc style.
drbrain authored
59
e6587c0 @drbrain RDoc style
drbrain authored
60 ##
61 # Default gem load path
62
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
63 def self.default_path
2ad4165 @zenspider Minor style changes
zenspider authored
64 if File.exist? Gem.user_home then
cacdb01 @djberg96 The default path now falls back to only the default_dir if Gem.user_h…
djberg96 authored
65 [user_dir, default_dir]
66 else
67 [default_dir]
68 end
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
69 end
70
e6587c0 @drbrain RDoc style
drbrain authored
71 ##
72 # Deduce Ruby's --program-prefix and --program-suffix from its install name
73
25f7237 @drbrain Apply patch #14688 adding formatting of executables matching ruby's p…
drbrain authored
74 def self.default_exec_format
2310f9c @drbrain BASERUBY isn't what I thought. Bug #24957
drbrain authored
75 exec_format = ConfigMap[:ruby_install_name].sub('ruby', '%s') rescue '%s'
b73f1f4 @drbrain Fix option names. Patch #24971.
drbrain authored
76
acf83a5 @drbrain Sanity check for bug #24958.
drbrain authored
77 unless exec_format =~ /%s/ then
78 raise Gem::Exception,
79 "[BUG] invalid exec_format #{exec_format.inspect}, no %s"
80 end
81
82 exec_format
25f7237 @drbrain Apply patch #14688 adding formatting of executables matching ruby's p…
drbrain authored
83 end
84
e6587c0 @drbrain RDoc style
drbrain authored
85 ##
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
86 # The default directory for binaries
e6587c0 @drbrain RDoc style
drbrain authored
87
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
88 def self.default_bindir
4ca43a4 @drbrain Clean out the patches tracker.
drbrain authored
89 if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
f33345d @zenspider Removed Gem::FS and Gem::Path.
zenspider authored
90 '/usr/bin'
4ca43a4 @drbrain Clean out the patches tracker.
drbrain authored
91 else # generic install
f33345d @zenspider Removed Gem::FS and Gem::Path.
zenspider authored
92 ConfigMap[:bindir]
f8842c4 @drbrain Add special case for RUBY_ENGINE constant when setting Gem.dir.
drbrain authored
93 end
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
94 end
95
e6587c0 @drbrain RDoc style
drbrain authored
96 ##
97 # A wrapper around RUBY_ENGINE const that may not be defined
98
1194442 @technomancy Add Gem.user_dir and make use of it in installer.rb
technomancy authored
99 def self.ruby_engine
e6587c0 @drbrain RDoc style
drbrain authored
100 if defined? RUBY_ENGINE then
1194442 @technomancy Add Gem.user_dir and make use of it in installer.rb
technomancy authored
101 RUBY_ENGINE
102 else
103 'ruby'
104 end
105 end
f51b3d5 @drbrain Consolidate defaults for easier editing. Patch #15150 by Donavan Pan…
drbrain authored
106 end
Something went wrong with that request. Please try again.