rubygems-update 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


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

Files changed (172) hide show
  1. data.tar.gz.sig +0 -0
  2. data/ChangeLog +248 -0
  3. data/README +2 -0
  4. data/Rakefile +47 -23
  5. data/bin/gem +9 -4
  6. data/bin/update_rubygems +15 -1
  7. data/examples/application/bin/myapp +0 -0
  8. data/lib/rubygems.rb +506 -373
  9. data/lib/rubygems/builder.rb +14 -7
  10. data/lib/rubygems/command.rb +9 -9
  11. data/lib/rubygems/command_manager.rb +1 -0
  12. data/lib/rubygems/commands/cleanup_command.rb +67 -69
  13. data/lib/rubygems/commands/environment_command.rb +16 -10
  14. data/lib/rubygems/commands/fetch_command.rb +7 -9
  15. data/lib/rubygems/commands/install_command.rb +9 -3
  16. data/lib/rubygems/commands/list_command.rb +2 -4
  17. data/lib/rubygems/commands/mirror_command.rb +1 -1
  18. data/lib/rubygems/commands/query_command.rb +52 -5
  19. data/lib/rubygems/commands/sources_command.rb +19 -10
  20. data/lib/rubygems/commands/specification_command.rb +10 -6
  21. data/lib/rubygems/commands/uninstall_command.rb +23 -6
  22. data/lib/rubygems/commands/unpack_command.rb +15 -3
  23. data/lib/rubygems/commands/update_command.rb +27 -25
  24. data/lib/rubygems/custom_require.rb +1 -1
  25. data/lib/rubygems/defaults.rb +8 -1
  26. data/lib/rubygems/dependency_installer.rb +72 -104
  27. data/lib/rubygems/digest/digest_adapter.rb +0 -0
  28. data/lib/rubygems/digest/md5.rb +0 -0
  29. data/lib/rubygems/digest/sha1.rb +0 -0
  30. data/lib/rubygems/digest/sha2.rb +0 -0
  31. data/lib/rubygems/exceptions.rb +22 -1
  32. data/lib/rubygems/format.rb +16 -10
  33. data/lib/rubygems/indexer.rb +46 -33
  34. data/lib/rubygems/indexer/abstract_index_builder.rb +10 -2
  35. data/lib/rubygems/indexer/latest_index_builder.rb +35 -0
  36. data/lib/rubygems/indexer/master_index_builder.rb +9 -8
  37. data/lib/rubygems/indexer/quick_index_builder.rb +5 -3
  38. data/lib/rubygems/install_update_options.rb +7 -1
  39. data/lib/rubygems/installer.rb +8 -5
  40. data/lib/rubygems/package.rb +17 -774
  41. data/lib/rubygems/package/f_sync_dir.rb +24 -0
  42. data/lib/rubygems/package/tar_header.rb +245 -0
  43. data/lib/rubygems/package/tar_input.rb +219 -0
  44. data/lib/rubygems/package/tar_output.rb +143 -0
  45. data/lib/rubygems/package/tar_reader.rb +86 -0
  46. data/lib/rubygems/package/tar_reader/entry.rb +99 -0
  47. data/lib/rubygems/package/tar_writer.rb +180 -0
  48. data/lib/rubygems/remote_fetcher.rb +131 -16
  49. data/lib/rubygems/requirement.rb +2 -0
  50. data/lib/rubygems/rubygems_version.rb +1 -1
  51. data/lib/rubygems/security.rb +1 -0
  52. data/lib/rubygems/server.rb +85 -104
  53. data/lib/rubygems/source_index.rb +412 -329
  54. data/lib/rubygems/source_info_cache.rb +232 -99
  55. data/lib/rubygems/source_info_cache_entry.rb +14 -4
  56. data/lib/rubygems/specification.rb +9 -10
  57. data/lib/rubygems/timer.rb +0 -0
  58. data/lib/rubygems/uninstaller.rb +56 -32
  59. data/lib/rubygems/user_interaction.rb +4 -10
  60. data/lib/rubygems/validator.rb +0 -0
  61. data/scripts/gemdoc.rb +0 -0
  62. data/scripts/specdoc.rb +0 -0
  63. data/setup.rb +56 -19
  64. data/test/gem_installer_test_case.rb +86 -0
  65. data/test/gem_installer_test_case.rbc +0 -0
  66. data/test/gem_package_tar_test_case.rb +146 -0
  67. data/test/gem_package_tar_test_case.rbc +0 -0
  68. data/test/gemutilities.rb +123 -38
  69. data/test/gemutilities.rbc +0 -0
  70. data/test/mockgemui.rb +5 -13
  71. data/test/mockgemui.rbc +0 -0
  72. data/test/private_key.pem +27 -0
  73. data/test/public_cert.pem +20 -0
  74. data/test/simple_gem.rbc +0 -0
  75. data/test/test_config.rbc +0 -0
  76. data/test/test_gem.rb +46 -4
  77. data/test/test_gem.rbc +0 -0
  78. data/test/test_gem_builder.rbc +0 -0
  79. data/test/test_gem_command.rbc +0 -0
  80. data/test/test_gem_command_manager.rb +4 -2
  81. data/test/test_gem_command_manager.rbc +0 -0
  82. data/test/test_gem_commands_build_command.rbc +0 -0
  83. data/test/test_gem_commands_cert_command.rb +5 -1
  84. data/test/test_gem_commands_cert_command.rbc +0 -0
  85. data/test/test_gem_commands_check_command.rbc +0 -0
  86. data/test/test_gem_commands_contents_command.rbc +0 -0
  87. data/test/test_gem_commands_dependency_command.rbc +0 -0
  88. data/test/test_gem_commands_environment_command.rb +17 -1
  89. data/test/test_gem_commands_environment_command.rbc +0 -0
  90. data/test/test_gem_commands_fetch_command.rb +6 -5
  91. data/test/test_gem_commands_fetch_command.rbc +0 -0
  92. data/test/test_gem_commands_generate_index_command.rbc +0 -0
  93. data/test/test_gem_commands_install_command.rb +36 -28
  94. data/test/test_gem_commands_install_command.rbc +0 -0
  95. data/test/test_gem_commands_mirror_command.rbc +0 -0
  96. data/test/test_gem_commands_pristine_command.rbc +0 -0
  97. data/test/test_gem_commands_query_command.rb +143 -19
  98. data/test/test_gem_commands_query_command.rbc +0 -0
  99. data/test/test_gem_commands_server_command.rb +1 -1
  100. data/test/test_gem_commands_server_command.rbc +0 -0
  101. data/test/test_gem_commands_sources_command.rb +67 -9
  102. data/test/test_gem_commands_sources_command.rbc +0 -0
  103. data/test/test_gem_commands_specification_command.rb +3 -2
  104. data/test/test_gem_commands_specification_command.rbc +0 -0
  105. data/test/test_gem_commands_unpack_command.rb +46 -4
  106. data/test/test_gem_commands_unpack_command.rbc +0 -0
  107. data/test/test_gem_commands_update_command.rb +174 -0
  108. data/test/test_gem_commands_update_command.rbc +0 -0
  109. data/test/test_gem_config_file.rbc +0 -0
  110. data/test/test_gem_dependency.rbc +0 -0
  111. data/test/test_gem_dependency_installer.rb +172 -187
  112. data/test/test_gem_dependency_installer.rbc +0 -0
  113. data/test/test_gem_dependency_list.rbc +0 -0
  114. data/test/test_gem_digest.rb +0 -0
  115. data/test/test_gem_digest.rbc +0 -0
  116. data/test/test_gem_doc_manager.rbc +0 -0
  117. data/test/test_gem_ext_configure_builder.rb +9 -6
  118. data/test/test_gem_ext_configure_builder.rbc +0 -0
  119. data/test/test_gem_ext_ext_conf_builder.rbc +0 -0
  120. data/test/test_gem_ext_rake_builder.rbc +0 -0
  121. data/test/test_gem_format.rb +1 -1
  122. data/test/test_gem_format.rbc +0 -0
  123. data/test/test_gem_gem_path_searcher.rbc +0 -0
  124. data/test/test_gem_gem_runner.rbc +0 -0
  125. data/test/test_gem_indexer.rb +7 -2
  126. data/test/test_gem_indexer.rbc +0 -0
  127. data/test/test_gem_install_update_options.rbc +0 -0
  128. data/test/test_gem_installer.rb +5 -84
  129. data/test/test_gem_installer.rbc +0 -0
  130. data/test/test_gem_local_remote_options.rbc +0 -0
  131. data/test/test_gem_outdated_command.rbc +0 -0
  132. data/test/test_gem_package_tar_header.rb +137 -0
  133. data/test/test_gem_package_tar_header.rbc +0 -0
  134. data/test/test_gem_package_tar_input.rb +119 -0
  135. data/test/test_gem_package_tar_input.rbc +0 -0
  136. data/test/test_gem_package_tar_output.rb +104 -0
  137. data/test/test_gem_package_tar_output.rbc +0 -0
  138. data/test/test_gem_package_tar_reader.rb +53 -0
  139. data/test/test_gem_package_tar_reader.rbc +0 -0
  140. data/test/test_gem_package_tar_reader_entry.rb +116 -0
  141. data/test/test_gem_package_tar_reader_entry.rbc +0 -0
  142. data/test/test_gem_package_tar_writer.rb +151 -0
  143. data/test/test_gem_package_tar_writer.rbc +0 -0
  144. data/test/test_gem_platform.rbc +0 -0
  145. data/test/test_gem_remote_fetcher.rb +189 -17
  146. data/test/test_gem_remote_fetcher.rbc +0 -0
  147. data/test/test_gem_requirement.rbc +0 -0
  148. data/test/test_gem_server.rb +13 -12
  149. data/test/test_gem_server.rbc +0 -0
  150. data/test/test_gem_source_index.rb +305 -56
  151. data/test/test_gem_source_index.rbc +0 -0
  152. data/test/test_gem_source_info_cache.rb +179 -53
  153. data/test/test_gem_source_info_cache.rbc +0 -0
  154. data/test/test_gem_source_info_cache_entry.rb +41 -10
  155. data/test/test_gem_source_info_cache_entry.rbc +0 -0
  156. data/test/test_gem_specification.rb +7 -7
  157. data/test/test_gem_specification.rbc +0 -0
  158. data/test/test_gem_stream_ui.rbc +0 -0
  159. data/test/test_gem_uninstaller.rb +43 -0
  160. data/test/test_gem_uninstaller.rbc +0 -0
  161. data/test/test_gem_validator.rbc +0 -0
  162. data/test/test_gem_version.rb +1 -1
  163. data/test/test_gem_version.rbc +0 -0
  164. data/test/test_gem_version_option.rbc +0 -0
  165. data/test/test_kernel.rb +1 -0
  166. data/test/test_kernel.rbc +0 -0
  167. metadata +85 -8
  168. metadata.gz.sig +0 -0
  169. data/lib/rubygems/gem_open_uri.rb +0 -7
  170. data/lib/rubygems/open-uri.rb +0 -773
  171. data/test/test_open_uri.rb +0 -13
  172. data/test/test_package.rb +0 -608
@@ -13,7 +13,7 @@ require 'rubygems/platform'
13
13
  if RUBY_VERSION < '1.9' then
14
14
  def Time.today
15
15
  t = Time.now
16
- t - ((t.to_i + t.gmt_offset) % 86400)
16
+ t - ((t.to_f + t.gmt_offset) % 86400)
17
17
  end unless defined? Time.today
18
18
  end
19
19
  # :startdoc:
@@ -457,7 +457,7 @@ module Gem
457
457
 
458
458
  overwrite_accessor :default_executable do
459
459
  begin
460
- if defined? @default_executable and @default_executable
460
+ if defined?(@default_executable) and @default_executable
461
461
  result = @default_executable
462
462
  elsif @executables and @executables.size == 1
463
463
  result = Array(@executables).first
@@ -471,14 +471,12 @@ module Gem
471
471
  end
472
472
 
473
473
  def add_bindir(executables)
474
- if not defined? @executables || @executables.nil?
475
- return nil
476
- end
474
+ return nil if executables.nil?
477
475
 
478
- if defined? @bindir and @bindir then
479
- Array(@executables).map {|e| File.join(@bindir, e) }
476
+ if @bindir then
477
+ Array(executables).map { |e| File.join(@bindir, e) }
480
478
  else
481
- @executables
479
+ executables
482
480
  end
483
481
  rescue
484
482
  return nil
@@ -511,7 +509,7 @@ module Gem
511
509
  @test_files = [@test_suite_file].flatten
512
510
  @test_suite_file = nil
513
511
  end
514
- if defined? @test_files and @test_files then
512
+ if defined?(@test_files) and @test_files then
515
513
  @test_files
516
514
  else
517
515
  @test_files = []
@@ -535,6 +533,7 @@ module Gem
535
533
  @new_platform = nil
536
534
  assign_defaults
537
535
  @loaded = false
536
+ @loaded_from = nil
538
537
  @@list << self
539
538
 
540
539
  yield self if block_given?
@@ -902,7 +901,7 @@ module Gem
902
901
  # Also, the summary and description are converted to a normal
903
902
  # format.
904
903
  def normalize
905
- if defined? @extra_rdoc_files and @extra_rdoc_files then
904
+ if defined?(@extra_rdoc_files) and @extra_rdoc_files then
906
905
  @extra_rdoc_files.uniq!
907
906
  @files ||= []
908
907
  @files.concat(@extra_rdoc_files)
File without changes
@@ -12,7 +12,7 @@ require 'rubygems/user_interaction'
12
12
 
13
13
  ##
14
14
  # An Uninstaller.
15
- #
15
+
16
16
  class Gem::Uninstaller
17
17
 
18
18
  include Gem::UserInteraction
@@ -21,19 +21,22 @@ class Gem::Uninstaller
21
21
  # Constructs an Uninstaller instance
22
22
  #
23
23
  # gem:: [String] The Gem name to uninstall
24
- #
25
- def initialize(gem, options)
24
+
25
+ def initialize(gem, options = {})
26
26
  @gem = gem
27
27
  @version = options[:version] || Gem::Requirement.default
28
+ gem_home = options[:install_dir] || Gem.dir
29
+ @gem_home = File.expand_path gem_home
28
30
  @force_executables = options[:executables]
29
31
  @force_all = options[:all]
30
32
  @force_ignore = options[:ignore]
33
+ @bin_dir = options[:bin_dir]
31
34
  end
32
35
 
33
36
  ##
34
37
  # Performs the uninstall of the Gem. This removes the spec, the
35
38
  # Gem directory, and the cached .gem file,
36
- #
39
+
37
40
  def uninstall
38
41
  list = Gem.source_index.search(/^#{@gem}$/, @version)
39
42
 
@@ -64,66 +67,81 @@ class Gem::Uninstaller
64
67
  end
65
68
 
66
69
  ##
67
- # Remove executables and batch files (windows only) for the gem as
68
- # it is being installed
69
- #
70
- # gemspec::[Specification] the gem whose executables need to be removed.
71
- #
70
+ # Removes installed executables and batch files (windows only) for
71
+ # +gemspec+.
72
+
72
73
  def remove_executables(gemspec)
73
74
  return if gemspec.nil?
74
- if(gemspec.executables.size > 0)
75
- raise Gem::FilePermissionError.new(Gem.bindir) unless
76
- File.writable?(Gem.bindir)
75
+
76
+ if gemspec.executables.size > 0 then
77
+ bindir = @bin_dir ? @bin_dir : (Gem.bindir @gem_home)
78
+
77
79
  list = Gem.source_index.search(gemspec.name).delete_if { |spec|
78
80
  spec.version == gemspec.version
79
81
  }
82
+
80
83
  executables = gemspec.executables.clone
84
+
81
85
  list.each do |spec|
82
86
  spec.executables.each do |exe_name|
83
87
  executables.delete(exe_name)
84
88
  end
85
89
  end
90
+
86
91
  return if executables.size == 0
87
- answer = @force_executables || ask_yes_no(
88
- "Remove executables and scripts for\n" +
89
- "'#{gemspec.executables.join(", ")}' in addition to the gem?",
90
- true) # " # appease ruby-mode - don't ask
91
- unless answer
92
+
93
+ answer = if @force_executables.nil? then
94
+ ask_yes_no("Remove executables:\n" \
95
+ "\t#{gemspec.executables.join(", ")}\n\nin addition to the gem?",
96
+ true) # " # appease ruby-mode - don't ask
97
+ else
98
+ @force_executables
99
+ end
100
+
101
+ unless answer then
92
102
  say "Executables and scripts will remain installed."
93
- return
94
103
  else
104
+ raise Gem::FilePermissionError, bindir unless File.writable? bindir
105
+
95
106
  gemspec.executables.each do |exe_name|
96
107
  say "Removing #{exe_name}"
97
- File.unlink File.join(Gem.bindir, exe_name) rescue nil
98
- File.unlink File.join(Gem.bindir, exe_name + ".bat") rescue nil
108
+ FileUtils.rm_f File.join(bindir, exe_name)
109
+ FileUtils.rm_f File.join(bindir, "#{exe_name}.bat")
99
110
  end
100
111
  end
101
112
  end
102
113
  end
103
114
 
115
+ ##
116
+ # Removes all gems in +list+.
104
117
  #
105
- # list:: the list of all gems to remove
106
- #
107
- # Warning: this method modifies the +list+ parameter. Once it has
108
- # uninstalled a gem, it is removed from that list.
109
- #
118
+ # NOTE: removes uninstalled gems from +list+.
119
+
110
120
  def remove_all(list)
111
- list.dup.each { |gem| remove(gem, list) }
121
+ list.dup.each { |spec| remove spec, list }
112
122
  end
113
123
 
114
- #
124
+ ##
115
125
  # spec:: the spec of the gem to be uninstalled
116
126
  # list:: the list of all such gems
117
127
  #
118
128
  # Warning: this method modifies the +list+ parameter. Once it has
119
129
  # uninstalled a gem, it is removed from that list.
120
- #
130
+
121
131
  def remove(spec, list)
122
- unless ok_to_remove? spec then
132
+ unless dependencies_ok? spec then
123
133
  raise Gem::DependencyRemovalException,
124
134
  "Uninstallation aborted due to dependent gem(s)"
125
135
  end
126
136
 
137
+ unless path_ok? spec then
138
+ e = Gem::GemNotInHomeException.new \
139
+ "Gem is not installed in directory #{@gem_home}"
140
+ e.spec = spec
141
+
142
+ raise e
143
+ end
144
+
127
145
  raise Gem::FilePermissionError, spec.installation_path unless
128
146
  File.writable?(spec.installation_path)
129
147
 
@@ -157,11 +175,17 @@ class Gem::Uninstaller
157
175
  list.delete spec
158
176
  end
159
177
 
160
- def ok_to_remove?(spec)
178
+ def path_ok?(spec)
179
+ match_path = File.join @gem_home, 'gems', spec.full_name
180
+
181
+ match_path == spec.full_gem_path
182
+ end
183
+
184
+ def dependencies_ok?(spec)
161
185
  return true if @force_ignore
162
186
 
163
- srcindex = Gem::SourceIndex.from_installed_gems
164
- deplist = Gem::DependencyList.from_source_index srcindex
187
+ source_index = Gem::SourceIndex.from_installed_gems
188
+ deplist = Gem::DependencyList.from_source_index source_index
165
189
  deplist.ok_to_remove?(spec.full_name) || ask_if_ok(spec)
166
190
  end
167
191
 
@@ -68,14 +68,14 @@ module Gem
68
68
  include DefaultUserInteraction
69
69
  [
70
70
  :choose_from_list, :ask, :ask_yes_no, :say, :alert, :alert_warning,
71
- :alert_error, :terminate_interaction!, :terminate_interaction
71
+ :alert_error, :terminate_interaction
72
72
  ].each do |methname|
73
73
  class_eval %{
74
74
  def #{methname}(*args)
75
75
  ui.#{methname}(*args)
76
76
  end
77
77
  }
78
- end
78
+ end
79
79
  end
80
80
 
81
81
  ####################################################################
@@ -182,16 +182,10 @@ module Gem
182
182
  ask(question) if question
183
183
  end
184
184
 
185
- # Terminate the application immediately without running any exit
186
- # handlers.
187
- def terminate_interaction!(status=-1)
188
- exit!(status)
189
- end
190
-
191
185
  # Terminate the appliation normally, running any exit handlers
192
186
  # that might have been defined.
193
- def terminate_interaction(status=0)
194
- exit(status)
187
+ def terminate_interaction(status = 0)
188
+ raise Gem::SystemExitException, status
195
189
  end
196
190
 
197
191
  # Return a progress reporter object
File without changes
File without changes
File without changes
data/setup.rb CHANGED
@@ -18,18 +18,27 @@ end
18
18
  $:.unshift 'lib'
19
19
  require 'rubygems'
20
20
 
21
- if ARGV.include? '--help' then
21
+ if ARGV.include? '--help' or ARGV.include? '-h' then
22
22
  puts "ruby setup.rb [options]:"
23
23
  puts
24
- puts " --prefix=DIR Prefix path for installing RubyGems"
25
- puts " Will not affect gem repository"
24
+ puts "RubyGems will install the gem command with a name matching ruby's"
25
+ puts "prefix and suffix. If ruby was installed as `ruby18`, gem will be"
26
+ puts "installed as `gem18`."
26
27
  puts
27
- puts " --format-executable Make the gem command's prefix and suffix match ruby's"
28
- puts " If ruby is installed as ruby19, gem will be gem19"
28
+ puts "By default, this RubyGems will install gem as:"
29
29
  puts
30
- puts " --no-rdoc Don't build RDoc for RubyGems"
30
+ puts " #{Gem.default_exec_format % 'gem'}"
31
31
  puts
32
- puts " --no-ri Don't build ri for RubyGems"
32
+ puts "Options:"
33
+ puts
34
+ puts " --prefix=DIR Prefix path for installing RubyGems"
35
+ puts " Will not affect gem repository location"
36
+ puts
37
+ puts " --no-format-executable Force installation as `gem`"
38
+ puts
39
+ puts " --no-rdoc Don't build RDoc for RubyGems"
40
+ puts
41
+ puts " --no-ri Don't build ri for RubyGems"
33
42
 
34
43
  exit
35
44
  end
@@ -91,11 +100,15 @@ Dir.chdir 'lib' do
91
100
  end
92
101
  end
93
102
 
103
+ bin_file_names = []
104
+
94
105
  Dir.chdir 'bin' do
95
106
  bin_files = Dir['*']
96
107
 
108
+ bin_files.delete 'update_rubygems'
109
+
97
110
  bin_files.each do |bin_file|
98
- bin_file_formatted = if ARGV.include? '--format-executable' then
111
+ bin_file_formatted = if ARGV.include? '--no-format-executable' then
99
112
  bin_file
100
113
  else
101
114
  Gem.default_exec_format % bin_file
@@ -114,6 +127,7 @@ Dir.chdir 'bin' do
114
127
  end
115
128
 
116
129
  install bin_tmp_file, dest_file, :mode => 0755
130
+ bin_file_names << dest_file
117
131
  ensure
118
132
  rm bin_tmp_file
119
133
  end
@@ -127,10 +141,10 @@ Dir.chdir 'bin' do
127
141
  file.puts <<-TEXT
128
142
  @ECHO OFF
129
143
  IF NOT "%~f0" == "~f0" GOTO :WinNT
130
- @"#{Gem.ruby}" "#{bin_file}" %1 %2 %3 %4 %5 %6 %7 %8 %9
144
+ @"#{File.basename(Gem.ruby)}" "#{dest_file}" %1 %2 %3 %4 %5 %6 %7 %8 %9
131
145
  GOTO :EOF
132
146
  :WinNT
133
- "%~d0%~p0ruby.exe" "%~d0%~p0%~n0" %*
147
+ @"#{File.basename(Gem.ruby)}" "%~dpn0" %*
134
148
  TEXT
135
149
  end
136
150
 
@@ -180,15 +194,15 @@ require 'rubygems/source_info_cache'
180
194
  user_cache_file = Gem::SourceInfoCache.user_cache_file
181
195
  system_cache_file = Gem::SourceInfoCache.system_cache_file
182
196
 
183
- rm user_cache_file if File.writable? user_cache_file
184
- rm system_cache_file if File.writable? system_cache_file
197
+ rm_f user_cache_file if File.writable? File.dirname(user_cache_file)
198
+ rm_f system_cache_file if File.writable? File.dirname(system_cache_file)
185
199
 
186
200
  # install RDoc
187
201
 
188
202
  gem_doc_dir = File.join Gem.dir, 'doc'
189
203
 
190
204
  if File.writable? gem_doc_dir then
191
- puts "Removing old RubyGems RDoc and ri..."
205
+ puts "Removing old RubyGems RDoc and ri"
192
206
  Dir[File.join(Gem.dir, 'doc', 'rubygems-[0-9]*')].each do |dir|
193
207
  rm_rf dir
194
208
  end
@@ -208,13 +222,13 @@ if File.writable? gem_doc_dir then
208
222
 
209
223
  unless ARGV.include? '--no-ri' then
210
224
  ri_dir = File.join doc_dir, 'ri'
211
- puts "Installing #{rubygems_name} ri into #{ri_dir}..."
225
+ puts "Installing #{rubygems_name} ri into #{ri_dir}"
212
226
  run_rdoc '--ri', '--op', ri_dir
213
227
  end
214
228
 
215
229
  unless ARGV.include? '--no-rdoc' then
216
230
  rdoc_dir = File.join(doc_dir, 'rdoc')
217
- puts "Installing #{rubygems_name} rdoc into #{rdoc_dir}..."
231
+ puts "Installing #{rubygems_name} rdoc into #{rdoc_dir}"
218
232
  run_rdoc '--op', rdoc_dir
219
233
  end
220
234
  else
@@ -230,10 +244,8 @@ def stub?(path)
230
244
  File.readlines(path).size < 20
231
245
  end
232
246
 
233
- puts <<-EOF.gsub(/^ */, '')
234
- As of RubyGems 0.8.0, library stubs are no longer needed.
235
- Searching $LOAD_PATH for stubs to optionally delete (may take a while)...
236
- EOF
247
+ puts "As of RubyGems 0.8.0, library stubs are no longer needed."
248
+ puts "Searching $LOAD_PATH for stubs to optionally delete (may take a while)"
237
249
 
238
250
  gemfiles = Dir[File.join("{#{($LOAD_PATH).join(',')}}", '**', '*.rb')]
239
251
  gemfiles = gemfiles.map { |file| File.expand_path file }.uniq
@@ -268,3 +280,28 @@ else
268
280
  puts "No library stubs found."
269
281
  end
270
282
 
283
+ puts
284
+ puts "-" * 78
285
+ puts
286
+
287
+ release_notes = File.join 'doc', 'release_notes',
288
+ "rel_#{Gem::RubyGemsVersion.gsub '.', '_'}.rdoc"
289
+
290
+ if File.exist? release_notes then
291
+ puts File.read(release_notes)
292
+ else
293
+ puts "Oh-no! Unable to find release notes in:\n\t#{release_notes}"
294
+ end
295
+
296
+ puts
297
+ puts "-" * 78
298
+ puts
299
+
300
+ puts "RubyGems installed the following executables:"
301
+ puts bin_file_names.map { |name| "\t#{name}\n" }
302
+ puts
303
+
304
+ puts "If `gem` was installed by a previous RubyGems installation, you may need"
305
+ puts "to remove it by hand."
306
+ puts
307
+
@@ -0,0 +1,86 @@
1
+ require 'test/unit'
2
+ require File.join(File.expand_path(File.dirname(__FILE__)), 'gemutilities')
3
+ require 'rubygems/installer'
4
+
5
+ class Gem::Installer
6
+ attr_accessor :gem_dir
7
+
8
+ attr_writer :format
9
+ attr_writer :gem_home
10
+ attr_writer :env_shebang
11
+ attr_writer :ignore_dependencies
12
+ attr_writer :format_executable
13
+ attr_writer :security_policy
14
+ attr_writer :spec
15
+ attr_writer :wrappers
16
+ end
17
+
18
+ class GemInstallerTestCase < RubyGemTestCase
19
+
20
+ def setup
21
+ super
22
+
23
+ @spec = quick_gem "a"
24
+ @gem = File.join @tempdir, "#{@spec.full_name}.gem"
25
+
26
+ util_build_gem @spec
27
+ FileUtils.mv File.join(@gemhome, 'cache', "#{@spec.full_name}.gem"),
28
+ @tempdir
29
+
30
+ @installer = Gem::Installer.new @gem
31
+ @installer.gem_dir = util_gem_dir
32
+ @installer.gem_home = @gemhome
33
+ @installer.spec = @spec
34
+ end
35
+
36
+ def util_gem_bindir(version = '2')
37
+ File.join util_gem_dir(version), "bin"
38
+ end
39
+
40
+ def util_gem_dir(version = '2')
41
+ File.join @gemhome, "gems", "a-#{version}" # HACK
42
+ end
43
+
44
+ def util_inst_bindir
45
+ File.join @gemhome, "bin"
46
+ end
47
+
48
+ def util_make_exec(version = '2', shebang = "#!/usr/bin/ruby")
49
+ @spec.executables = ["my_exec"]
50
+
51
+ FileUtils.mkdir_p util_gem_bindir(version)
52
+ exec_file = @installer.formatted_program_filename "my_exec"
53
+ exec_path = File.join util_gem_bindir(version), exec_file
54
+ File.open exec_path, 'w' do |f|
55
+ f.puts shebang
56
+ end
57
+ end
58
+
59
+ def util_setup_gem(ui = @ui) # HACK fix use_ui to make this automatic
60
+ @spec.files = File.join('lib', 'code.rb')
61
+ @spec.executables << 'executable'
62
+ @spec.extensions << File.join('ext', 'a', 'mkrf_conf.rb')
63
+
64
+ Dir.chdir @tempdir do
65
+ FileUtils.mkdir_p 'bin'
66
+ FileUtils.mkdir_p 'lib'
67
+ FileUtils.mkdir_p File.join('ext', 'a')
68
+ File.open File.join('bin', 'executable'), 'w' do |f| f.puts '1' end
69
+ File.open File.join('lib', 'code.rb'), 'w' do |f| f.puts '1' end
70
+ File.open File.join('ext', 'a', 'mkrf_conf.rb'), 'w' do |f|
71
+ f << <<-EOF
72
+ File.open 'Rakefile', 'w' do |rf| rf.puts "task :default" end
73
+ EOF
74
+ end
75
+
76
+ use_ui ui do
77
+ FileUtils.rm @gem
78
+ Gem::Builder.new(@spec).build
79
+ end
80
+ end
81
+
82
+ @installer = Gem::Installer.new @gem
83
+ end
84
+
85
+ end
86
+