rubygems-update 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rubygems-update might be problematic. Click here for more details.

Files changed (65) hide show
  1. data.tar.gz.sig +2 -4
  2. data/ChangeLog +155 -0
  3. data/Rakefile +20 -5
  4. data/doc/release_notes/rel_1_3_0.rdoc +125 -0
  5. data/lib/rubygems.rb +107 -15
  6. data/lib/rubygems/commands/contents_command.rb +1 -1
  7. data/lib/rubygems/commands/environment_command.rb +40 -0
  8. data/lib/rubygems/commands/help_command.rb +2 -2
  9. data/lib/rubygems/commands/install_command.rb +15 -0
  10. data/lib/rubygems/commands/lock_command.rb +15 -6
  11. data/lib/rubygems/commands/outdated_command.rb +1 -1
  12. data/lib/rubygems/commands/pristine_command.rb +1 -1
  13. data/lib/rubygems/commands/query_command.rb +14 -9
  14. data/lib/rubygems/commands/rdoc_command.rb +5 -1
  15. data/lib/rubygems/commands/specification_command.rb +2 -2
  16. data/lib/rubygems/commands/unpack_command.rb +1 -1
  17. data/lib/rubygems/commands/update_command.rb +23 -14
  18. data/lib/rubygems/commands/which_command.rb +4 -3
  19. data/lib/rubygems/config_file.rb +25 -3
  20. data/lib/rubygems/defaults.rb +42 -11
  21. data/lib/rubygems/dependency_installer.rb +19 -15
  22. data/lib/rubygems/doc_manager.rb +162 -115
  23. data/lib/rubygems/ext/builder.rb +2 -2
  24. data/lib/rubygems/ext/rake_builder.rb +1 -1
  25. data/lib/rubygems/gem_path_searcher.rb +35 -19
  26. data/lib/rubygems/indexer.rb +15 -6
  27. data/lib/rubygems/install_update_options.rb +7 -0
  28. data/lib/rubygems/installer.rb +85 -9
  29. data/lib/rubygems/local_remote_options.rb +7 -0
  30. data/lib/rubygems/package/tar_reader.rb +7 -7
  31. data/lib/rubygems/platform.rb +1 -18
  32. data/lib/rubygems/remote_fetcher.rb +45 -54
  33. data/lib/rubygems/rubygems_version.rb +1 -1
  34. data/lib/rubygems/source_index.rb +22 -7
  35. data/lib/rubygems/source_info_cache.rb +9 -0
  36. data/lib/rubygems/spec_fetcher.rb +18 -20
  37. data/lib/rubygems/specification.rb +502 -293
  38. data/lib/rubygems/test_utilities.rb +19 -8
  39. data/lib/rubygems/uninstaller.rb +60 -26
  40. data/setup.rb +15 -7
  41. data/test/gemutilities.rb +84 -0
  42. data/test/mockgemui.rb +22 -2
  43. data/test/test_gem.rb +118 -13
  44. data/test/test_gem_commands_dependency_command.rb +1 -1
  45. data/test/test_gem_commands_list_command.rb +37 -0
  46. data/test/test_gem_commands_lock_command.rb +69 -0
  47. data/test/test_gem_commands_query_command.rb +40 -1
  48. data/test/test_gem_commands_uninstall_command.rb +60 -0
  49. data/test/test_gem_config_file.rb +51 -17
  50. data/test/test_gem_ext_configure_builder.rb +9 -9
  51. data/test/test_gem_ext_rake_builder.rb +21 -12
  52. data/test/test_gem_gem_path_searcher.rb +15 -7
  53. data/test/test_gem_indexer.rb +35 -1
  54. data/test/test_gem_install_update_options.rb +26 -5
  55. data/test/test_gem_installer.rb +93 -21
  56. data/test/test_gem_local_remote_options.rb +12 -0
  57. data/test/test_gem_platform.rb +6 -13
  58. data/test/test_gem_remote_fetcher.rb +121 -31
  59. data/test/test_gem_source_index.rb +74 -21
  60. data/test/test_gem_source_info_cache.rb +2 -1
  61. data/test/test_gem_spec_fetcher.rb +13 -3
  62. data/test/test_gem_specification.rb +13 -7
  63. data/test/test_gem_uninstaller.rb +25 -2
  64. metadata +6 -2
  65. metadata.gz.sig +0 -0
@@ -51,7 +51,7 @@ class Gem::Commands::ContentsCommand < Gem::Command
51
51
 
52
52
  si = Gem::SourceIndex.from_gems_in(*s)
53
53
 
54
- gem_spec = si.search(/\A#{gem}\z/, version).last
54
+ gem_spec = si.find_name(gem, version).last
55
55
 
56
56
  unless gem_spec then
57
57
  say "Unable to find gem '#{gem}' in #{path_kind}"
@@ -18,6 +18,46 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
18
18
  return args.gsub(/^\s+/, '')
19
19
  end
20
20
 
21
+ def description # :nodoc:
22
+ <<-EOF
23
+ The RubyGems environment can be controlled through command line arguments,
24
+ gemrc files, environment variables and built-in defaults.
25
+
26
+ Command line argument defaults and some RubyGems defaults can be set in
27
+ ~/.gemrc file for individual users and a /etc/gemrc for all users. A gemrc
28
+ is a YAML file with the following YAML keys:
29
+
30
+ :sources: A YAML array of remote gem repositories to install gems from
31
+ :verbose: Verbosity of the gem command. false, true, and :really are the
32
+ levels
33
+ :update_sources: Enable/disable automatic updating of repository metadata
34
+ :backtrace: Print backtrace when RubyGems encounters an error
35
+ :bulk_threshold: Switch to a bulk update when this many sources are out of
36
+ date (legacy setting)
37
+ :gempath: The paths in which to look for gems
38
+ gem_command: A string containing arguments for the specified gem command
39
+
40
+ Example:
41
+
42
+ :verbose: false
43
+ install: --no-wrappers
44
+ update: --no-wrappers
45
+
46
+ RubyGems' default local repository can be overriden with the GEM_PATH and
47
+ GEM_HOME environment variables. GEM_HOME sets the default repository to
48
+ install into. GEM_PATH allows multiple local repositories to be searched for
49
+ gems.
50
+
51
+ If you are behind a proxy server, RubyGems uses the HTTP_PROXY,
52
+ HTTP_PROXY_USER and HTTP_PROXY_PASS environment variables to discover the
53
+ proxy server.
54
+
55
+ If you are packaging RubyGems all of RubyGems' defaults are in
56
+ lib/rubygems/defaults.rb. You may override these in
57
+ lib/rubygems/defaults/operating_system.rb
58
+ EOF
59
+ end
60
+
21
61
  def usage # :nodoc:
22
62
  "#{program_name} [arg]"
23
63
  end
@@ -20,9 +20,9 @@ Some examples of 'gem' usage.
20
20
  gem install --remote rake --test --rdoc --ri
21
21
 
22
22
  * Install 'rake', but only version 0.3.1, even if dependencies
23
- are not met, and into a specific directory:
23
+ are not met, and into a user-specific directory:
24
24
 
25
- gem install rake --version 0.3.1 --force --install-dir $HOME/.gems
25
+ gem install rake --version 0.3.1 --force --user-install
26
26
 
27
27
  * List local gems whose name begins with 'D':
28
28
 
@@ -38,6 +38,19 @@ class Gem::Commands::InstallCommand < Gem::Command
38
38
  "--no-test --install-dir #{Gem.dir}"
39
39
  end
40
40
 
41
+ def description # :nodoc:
42
+ <<-EOF
43
+ The install command installs local or remote gem into a gem repository.
44
+
45
+ For gems with executables ruby installs a wrapper file into the executable
46
+ directory by deault. This can be overridden with the --no-wrappers option.
47
+ The wrapper allows you to choose among alternate gem versions using _version_.
48
+
49
+ For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer
50
+ version is also installed.
51
+ EOF
52
+ end
53
+
41
54
  def usage # :nodoc:
42
55
  "#{program_name} GEMNAME [GEMNAME ...] [options] -- --build-flags"
43
56
  end
@@ -106,6 +119,8 @@ class Gem::Commands::InstallCommand < Gem::Command
106
119
  installed_gems.each do |gem|
107
120
  Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
108
121
  end
122
+
123
+ Gem::DocManager.update_ri_cache
109
124
  end
110
125
 
111
126
  if options[:generate_rdoc] then
@@ -58,15 +58,15 @@ lock it down to the exact version.
58
58
  end
59
59
 
60
60
  def complain(message)
61
- if options.strict then
62
- raise message
61
+ if options[:strict] then
62
+ raise Gem::Exception, message
63
63
  else
64
64
  say "# #{message}"
65
65
  end
66
66
  end
67
67
 
68
68
  def execute
69
- say 'require "rubygems"'
69
+ say "require 'rubygems'"
70
70
 
71
71
  locked = {}
72
72
 
@@ -77,15 +77,20 @@ lock it down to the exact version.
77
77
 
78
78
  spec = Gem::SourceIndex.load_specification spec_path(full_name)
79
79
 
80
+ if spec.nil? then
81
+ complain "Could not find gem #{full_name}, try using the full name"
82
+ next
83
+ end
84
+
80
85
  say "gem '#{spec.name}', '= #{spec.version}'" unless locked[spec.name]
81
86
  locked[spec.name] = true
82
87
 
83
88
  spec.runtime_dependencies.each do |dep|
84
89
  next if locked[dep.name]
85
- candidates = Gem.source_index.search dep.name, dep.requirement_list
90
+ candidates = Gem.source_index.search dep
86
91
 
87
92
  if candidates.empty? then
88
- complain "Unable to satisfy '#{dep}' from currently installed gems."
93
+ complain "Unable to satisfy '#{dep}' from currently installed gems"
89
94
  else
90
95
  pending << candidates.last.full_name
91
96
  end
@@ -94,7 +99,11 @@ lock it down to the exact version.
94
99
  end
95
100
 
96
101
  def spec_path(gem_full_name)
97
- File.join Gem.path, "specifications", "#{gem_full_name }.gemspec"
102
+ gemspecs = Gem.path.map do |path|
103
+ File.join path, "specifications", "#{gem_full_name}.gemspec"
104
+ end
105
+
106
+ gemspecs.find { |gemspec| File.exist? gemspec }
98
107
  end
99
108
 
100
109
  end
@@ -19,7 +19,7 @@ class Gem::Commands::OutdatedCommand < Gem::Command
19
19
  locals = Gem::SourceIndex.from_installed_gems
20
20
 
21
21
  locals.outdated.sort.each do |name|
22
- local = locals.search(/^#{name}$/).last
22
+ local = locals.find_name(name).last
23
23
 
24
24
  dep = Gem::Dependency.new local.name, ">= #{local.version}"
25
25
  remotes = Gem::SpecFetcher.fetcher.fetch dep
@@ -57,7 +57,7 @@ revert the gem.
57
57
  end
58
58
  else
59
59
  gem_name = get_one_gem_name
60
- Gem::SourceIndex.from_installed_gems.search(gem_name,
60
+ Gem::SourceIndex.from_installed_gems.find_name(gem_name,
61
61
  options[:version])
62
62
  end
63
63
 
@@ -59,7 +59,7 @@ class Gem::Commands::QueryCommand < Gem::Command
59
59
  if name.source.empty? then
60
60
  alert_error "You must specify a gem name"
61
61
  exit_code |= 4
62
- elsif installed? name.source, options[:version] then
62
+ elsif installed? name, options[:version] then
63
63
  say "true"
64
64
  else
65
65
  say "false"
@@ -69,12 +69,16 @@ class Gem::Commands::QueryCommand < Gem::Command
69
69
  raise Gem::SystemExitException, exit_code
70
70
  end
71
71
 
72
+ dep = Gem::Dependency.new name, Gem::Requirement.default
73
+
72
74
  if local? then
73
- say
74
- say "*** LOCAL GEMS ***"
75
- say
75
+ if ui.outs.tty? or both? then
76
+ say
77
+ say "*** LOCAL GEMS ***"
78
+ say
79
+ end
76
80
 
77
- specs = Gem.source_index.search name
81
+ specs = Gem.source_index.search dep
78
82
 
79
83
  spec_tuples = specs.map do |spec|
80
84
  [[spec.name, spec.version, spec.original_platform, spec], :local]
@@ -84,13 +88,14 @@ class Gem::Commands::QueryCommand < Gem::Command
84
88
  end
85
89
 
86
90
  if remote? then
87
- say
88
- say "*** REMOTE GEMS ***"
89
- say
91
+ if ui.outs.tty? or both? then
92
+ say
93
+ say "*** REMOTE GEMS ***"
94
+ say
95
+ end
90
96
 
91
97
  all = options[:all]
92
98
 
93
- dep = Gem::Dependency.new name, Gem::Requirement.default
94
99
  begin
95
100
  fetcher = Gem::SpecFetcher.fetcher
96
101
  spec_tuples = fetcher.find_matching dep, all, false
@@ -59,11 +59,15 @@ module Gem
59
59
  if specs.empty?
60
60
  fail "Failed to find gem #{gem_name} to generate RDoc for #{options[:version]}"
61
61
  end
62
+
62
63
  if options[:include_ri]
63
64
  specs.each do |spec|
64
65
  Gem::DocManager.new(spec).generate_ri
65
66
  end
67
+
68
+ Gem::DocManager.update_ri_cache
66
69
  end
70
+
67
71
  if options[:include_rdoc]
68
72
  specs.each do |spec|
69
73
  Gem::DocManager.new(spec).generate_rdoc
@@ -73,6 +77,6 @@ module Gem
73
77
  true
74
78
  end
75
79
  end
76
-
80
+
77
81
  end
78
82
  end
@@ -40,6 +40,7 @@ class Gem::Commands::SpecificationCommand < Gem::Command
40
40
  def execute
41
41
  specs = []
42
42
  gem = get_one_gem_name
43
+ dep = Gem::Dependency.new gem, options[:version]
43
44
 
44
45
  if local? then
45
46
  if File.exist? gem then
@@ -47,12 +48,11 @@ class Gem::Commands::SpecificationCommand < Gem::Command
47
48
  end
48
49
 
49
50
  if specs.empty? then
50
- specs.push(*Gem.source_index.search(/\A#{gem}\z/, options[:version]))
51
+ specs.push(*Gem.source_index.search(dep))
51
52
  end
52
53
  end
53
54
 
54
55
  if remote? then
55
- dep = Gem::Dependency.new gem, options[:version]
56
56
  found = Gem::SpecFetcher.fetcher.fetch dep
57
57
 
58
58
  specs.push(*found.map { |spec,| spec })
@@ -68,7 +68,7 @@ class Gem::Commands::UnpackCommand < Gem::Command
68
68
  def get_path(gemname, version_req)
69
69
  return gemname if gemname =~ /\.gem$/i
70
70
 
71
- specs = Gem::source_index.search(/\A#{gemname}\z/, version_req)
71
+ specs = Gem::source_index.find_name gemname, version_req
72
72
 
73
73
  selected = specs.sort_by { |s| s.version }.last
74
74
 
@@ -45,6 +45,8 @@ class Gem::Commands::UpdateCommand < Gem::Command
45
45
  end
46
46
 
47
47
  def execute
48
+ hig = {}
49
+
48
50
  if options[:system] then
49
51
  say "Updating RubyGems"
50
52
 
@@ -52,16 +54,22 @@ class Gem::Commands::UpdateCommand < Gem::Command
52
54
  fail "No gem names are allowed with the --system option"
53
55
  end
54
56
 
55
- options[:args] = ["rubygems-update"]
57
+ spec = Gem::Specification.new
58
+ spec.name = 'rubygems-update'
59
+ spec.version = Gem::Version.new Gem::RubyGemsVersion
60
+ spec.version = Gem::Version.new '1.1.1'
61
+ hig['rubygems-update'] = spec
62
+
63
+ options[:user_install] = false
56
64
  else
57
65
  say "Updating installed gems"
58
- end
59
66
 
60
- hig = {} # highest installed gems
67
+ hig = {} # highest installed gems
61
68
 
62
- Gem.source_index.each do |name, spec|
63
- if hig[spec.name].nil? or hig[spec.name].version < spec.version then
64
- hig[spec.name] = spec
69
+ Gem.source_index.each do |name, spec|
70
+ if hig[spec.name].nil? or hig[spec.name].version < spec.version then
71
+ hig[spec.name] = spec
72
+ end
65
73
  end
66
74
  end
67
75
 
@@ -84,14 +92,14 @@ class Gem::Commands::UpdateCommand < Gem::Command
84
92
  end
85
93
 
86
94
  if gems_to_update.include? "rubygems-update" then
87
- latest_ruby_gem = remote_gemspecs.select do |s|
88
- s.name == 'rubygems-update'
89
- end
95
+ Gem.source_index.refresh!
96
+
97
+ update_gems = Gem.source_index.search 'rubygems-update'
90
98
 
91
- latest_ruby_gem = latest_ruby_gem.sort_by { |s| s.version }.last
99
+ latest_update_gem = update_gems.sort_by { |s| s.version }.last
92
100
 
93
- say "Updating version of RubyGems to #{latest_ruby_gem.version}"
94
- installed = do_rubygems_update latest_ruby_gem.version
101
+ say "Updating RubyGems to #{latest_update_gem.version}"
102
+ installed = do_rubygems_update latest_update_gem.version
95
103
 
96
104
  say "RubyGems system software updated" if installed
97
105
  else
@@ -103,6 +111,9 @@ class Gem::Commands::UpdateCommand < Gem::Command
103
111
  end
104
112
  end
105
113
 
114
+ ##
115
+ # Update the RubyGems software to +version+.
116
+
106
117
  def do_rubygems_update(version)
107
118
  args = []
108
119
  args.push '--prefix', Gem.prefix unless Gem.prefix.nil?
@@ -112,8 +123,6 @@ class Gem::Commands::UpdateCommand < Gem::Command
112
123
 
113
124
  update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}"
114
125
 
115
- success = false
116
-
117
126
  Dir.chdir update_dir do
118
127
  say "Installing RubyGems #{version}"
119
128
  setup_cmd = "#{Gem.ruby} setup.rb #{args.join ' '}"
@@ -3,10 +3,10 @@ require 'rubygems/gem_path_searcher'
3
3
 
4
4
  class Gem::Commands::WhichCommand < Gem::Command
5
5
 
6
- EXT = %w[.rb .rbw .so .dll] # HACK
6
+ EXT = %w[.rb .rbw .so .dll .bundle] # HACK
7
7
 
8
8
  def initialize
9
- super 'which', 'Find the location of a library',
9
+ super 'which', 'Find the location of a library file you can require',
10
10
  :search_gems_first => false, :show_all => false
11
11
 
12
12
  add_option '-a', '--[no-]all', 'show all matching files' do |show_all, options|
@@ -52,7 +52,7 @@ class Gem::Commands::WhichCommand < Gem::Command
52
52
  paths = find_paths arg, dirs
53
53
 
54
54
  if paths.empty? then
55
- say "Can't find #{arg}"
55
+ say "Can't find ruby library file or shared library #{arg}"
56
56
  else
57
57
  say paths
58
58
  end
@@ -84,3 +84,4 @@ class Gem::Commands::WhichCommand < Gem::Command
84
84
  end
85
85
 
86
86
  end
87
+
@@ -18,6 +18,18 @@ class Gem::ConfigFile
18
18
  DEFAULT_VERBOSITY = true
19
19
  DEFAULT_UPDATE_SOURCES = true
20
20
 
21
+ ##
22
+ # For Ruby packagers to set configuration defaults. Set in
23
+ # rubygems/defaults/operating_system.rb
24
+
25
+ OPERATING_SYSTEM_DEFAULTS = {}
26
+
27
+ ##
28
+ # For Ruby implementers to set configuration defaults. Set in
29
+ # rubygems/defaults/#{RUBY_ENGINE}.rb
30
+
31
+ PLATFORM_DEFAULTS = {}
32
+
21
33
  system_config_path =
22
34
  begin
23
35
  require 'Win32API'
@@ -37,6 +49,9 @@ class Gem::ConfigFile
37
49
  # List of arguments supplied to the config file object.
38
50
  attr_reader :args
39
51
 
52
+ # Where to look for gems
53
+ attr_accessor :path
54
+
40
55
  # True if we print backtraces on errors.
41
56
  attr_writer :backtrace
42
57
 
@@ -98,16 +113,23 @@ class Gem::ConfigFile
98
113
  @verbose = DEFAULT_VERBOSITY
99
114
  @update_sources = DEFAULT_UPDATE_SOURCES
100
115
 
101
- @hash = load_file(SYSTEM_WIDE_CONFIG_FILE)
102
- @hash.merge!(load_file(config_file_name.dup.untaint))
116
+ operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS)
117
+ platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
118
+ system_config = load_file SYSTEM_WIDE_CONFIG_FILE
119
+ user_config = load_file config_file_name.dup.untaint
120
+
121
+ @hash = operating_system_config.merge platform_config
122
+ @hash = @hash.merge system_config
123
+ @hash = @hash.merge user_config
103
124
 
104
125
  # HACK these override command-line args, which is bad
105
126
  @backtrace = @hash[:backtrace] if @hash.key? :backtrace
106
127
  @benchmark = @hash[:benchmark] if @hash.key? :benchmark
107
128
  @bulk_threshold = @hash[:bulk_threshold] if @hash.key? :bulk_threshold
108
- Gem.sources.replace @hash[:sources] if @hash.key? :sources
129
+ Gem.sources = @hash[:sources] if @hash.key? :sources
109
130
  @verbose = @hash[:verbose] if @hash.key? :verbose
110
131
  @update_sources = @hash[:update_sources] if @hash.key? :update_sources
132
+ @path = @hash[:gempath]
111
133
 
112
134
  handle_arguments arg_list
113
135
  end
@@ -1,36 +1,52 @@
1
1
  module Gem
2
2
 
3
- # An Array of the default sources that come with RubyGems.
3
+ ##
4
+ # An Array of the default sources that come with RubyGems
5
+
4
6
  def self.default_sources
5
7
  %w[http://gems.rubyforge.org/]
6
8
  end
7
9
 
10
+ ##
8
11
  # Default home directory path to be used if an alternate value is not
9
- # specified in the environment.
12
+ # specified in the environment
13
+
10
14
  def self.default_dir
11
15
  if defined? RUBY_FRAMEWORK_VERSION then
12
16
  File.join File.dirname(ConfigMap[:sitedir]), 'Gems',
13
17
  ConfigMap[:ruby_version]
14
- elsif defined? RUBY_ENGINE then
15
- File.join ConfigMap[:libdir], RUBY_ENGINE, 'gems',
16
- ConfigMap[:ruby_version]
17
18
  else
18
- File.join ConfigMap[:libdir], 'ruby', 'gems', ConfigMap[:ruby_version]
19
+ File.join(ConfigMap[:libdir], ruby_engine, 'gems',
20
+ ConfigMap[:ruby_version])
19
21
  end
20
22
  end
21
23
 
22
- # Default gem path.
24
+ ##
25
+ # Path for gems in the user's home directory
26
+
27
+ def self.user_dir
28
+ File.join(Gem.user_home, '.gem', ruby_engine,
29
+ ConfigMap[:ruby_version])
30
+ end
31
+
32
+ ##
33
+ # Default gem load path
34
+
23
35
  def self.default_path
24
- default_dir
36
+ [user_dir, default_dir]
25
37
  end
26
38
 
27
- # Deduce Ruby's --program-prefix and --program-suffix from its install name.
39
+ ##
40
+ # Deduce Ruby's --program-prefix and --program-suffix from its install name
41
+
28
42
  def self.default_exec_format
29
43
  baseruby = ConfigMap[:BASERUBY] || 'ruby'
30
44
  ConfigMap[:RUBY_INSTALL_NAME].sub(baseruby, '%s') rescue '%s'
31
45
  end
32
46
 
47
+ ##
33
48
  # The default directory for binaries
49
+
34
50
  def self.default_bindir
35
51
  if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
36
52
  '/usr/bin'
@@ -39,15 +55,30 @@ module Gem
39
55
  end
40
56
  end
41
57
 
42
- # The default system-wide source info cache directory.
58
+ ##
59
+ # The default system-wide source info cache directory
60
+
43
61
  def self.default_system_source_cache_dir
44
62
  File.join Gem.dir, 'source_cache'
45
63
  end
46
64
 
47
- # The default user-specific source info cache directory.
65
+ ##
66
+ # The default user-specific source info cache directory
67
+
48
68
  def self.default_user_source_cache_dir
49
69
  File.join Gem.user_home, '.gem', 'source_cache'
50
70
  end
51
71
 
72
+ ##
73
+ # A wrapper around RUBY_ENGINE const that may not be defined
74
+
75
+ def self.ruby_engine
76
+ if defined? RUBY_ENGINE then
77
+ RUBY_ENGINE
78
+ else
79
+ 'ruby'
80
+ end
81
+ end
82
+
52
83
  end
53
84