rubygems-update 1.8.6 → 1.8.7

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.

Binary file
@@ -1,16 +1,29 @@
1
- === 1.8.6 / 2011-07-25
1
+ # coding: UTF-8
2
2
 
3
- * 1 major enhancement:
3
+ === 1.8.7 / 2011-08-02
4
4
 
5
- * Restore behavior of Gem::Specification#loaded? Ruby Bug #5032
5
+ * 5 bug fixes:
6
+ * Added missing require for `gem uninstall --format-executable`
7
+ * The correct name of the executable being uninstalled is now displayed with
8
+ --format-executable
9
+ * Fixed `gem unpack uninstalled_gem` default version picker
10
+ * RubyGems no longer claims a nonexistent gem can be uninstalled
11
+ * `gem which` no longer claims directories are requirable files
12
+ * `gem cleanup` continues cleaning up gems if one can't be uninstalled due
13
+ to permissions. Issue #82
14
+ * Gem repository directories are no longer created world-writable. Patch by
15
+ Sakuro OZAWA. Ruby Bug #4930
16
+
17
+ === 1.8.6 / 2011-07-25
6
18
 
7
19
  * 1 minor enhancement:
8
20
 
9
21
  * Add autorequires and delay startup of RubyGems until require is called.
10
22
  See Ruby bug #4962
11
23
 
12
- * 1 bug fix:
24
+ * 9 bug fixes:
13
25
 
26
+ * Restore behavior of Gem::Specification#loaded? Ruby Bug #5032
14
27
  * Clean up SourceIndex.add_specs to not be so damn noisy. (tadman)
15
28
  * Added missing APPLE_GEM_HOME in paths.
16
29
  * Extend YAML::Syck::DefaultKey fixing to `marshal_dump` as well.
@@ -192,4 +192,3 @@ test/rubygems/test_gem_version.rb
192
192
  test/rubygems/test_gem_version_option.rb
193
193
  test/rubygems/test_kernel.rb
194
194
  util/CL2notes
195
- util/gem_prelude.rb
data/Rakefile CHANGED
@@ -116,8 +116,7 @@ def rsync_with dir
116
116
  " --exclude '*.rej' --exclude '*.orig' --exclude 'lib/rubygems/defaults/*'"
117
117
  sh "rsync #{rsync_options} bin/gem #{dir}/bin/gem"
118
118
  sh "rsync #{rsync_options} lib/ #{dir}/lib"
119
- sh "rsync #{rsync_options} test/ #{dir}/test/rubygems"
120
- sh "rsync #{rsync_options} util/gem_prelude.rb #{dir}/gem_prelude.rb"
119
+ sh "rsync #{rsync_options} test/ #{dir}/test"
121
120
  end
122
121
 
123
122
  def diff_with dir
@@ -128,11 +127,10 @@ def diff_with dir
128
127
  sh "diff #{diff_options} lib/rubygems #{dir}/lib/rubygems; true"
129
128
  sh "diff #{diff_options} lib/rbconfig #{dir}/lib/rbconfig; true"
130
129
  sh "diff #{diff_options} test #{dir}/test/rubygems; true"
131
- sh "diff #{diff_options} util/gem_prelude.rb #{dir}/gem_prelude.rb; true"
132
130
  end
133
131
 
134
- rubinius_dir = ENV['RUBINIUS_PATH'] || '../../../git/git.rubini.us/code'
135
- ruby_dir = ENV['RUBY_PATH'] || '../../ruby/trunk'
132
+ rubinius_dir = ENV['RUBINIUS_PATH'] || '../git.rubini.us/code'
133
+ ruby_dir = ENV['RUBY_PATH'] || '../../svn/ruby/trunk'
136
134
 
137
135
  desc "Updates Ruby HEAD with the currently checked-out copy of RubyGems."
138
136
  task :update_ruby do
@@ -118,7 +118,7 @@ require "rubygems/deprecate"
118
118
  # -The RubyGems Team
119
119
 
120
120
  module Gem
121
- VERSION = '1.8.6'
121
+ VERSION = '1.8.7'
122
122
 
123
123
  ##
124
124
  # Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -444,11 +444,16 @@ module Gem
444
444
  def self.ensure_gem_subdirectories dir = Gem.dir
445
445
  require 'fileutils'
446
446
 
447
+ old_umask = File.umask
448
+ File.umask old_umask | 022
449
+
447
450
  %w[cache doc gems specifications].each do |name|
448
451
  subdir = File.join dir, name
449
452
  next if File.exist? subdir
450
453
  FileUtils.mkdir_p subdir rescue nil # in case of perms issues -- lame
451
454
  end
455
+ ensure
456
+ File.umask old_umask
452
457
  end
453
458
 
454
459
  ##
@@ -1206,7 +1211,7 @@ end
1206
1211
  # Otherwise return a path to the share area as define by
1207
1212
  # "#{ConfigMap[:datadir]}/#{package_name}".
1208
1213
 
1209
- def RbConfig.datadir(package_name)
1214
+ def RbConfig.datadir(package_name) # :nodoc:
1210
1215
  warn "#{Gem.location_of_caller.join ':'}:Warning: " \
1211
1216
  "RbConfig.datadir is deprecated and will be removed on or after " \
1212
1217
  "August 2011. " \
@@ -61,6 +61,8 @@ installed elsewhere in GEM_PATH the cleanup command won't touch it.
61
61
 
62
62
  deps = deplist.strongly_connected_components.flatten.reverse
63
63
 
64
+ original_path = Gem.path
65
+
64
66
  deps.each do |spec|
65
67
  if options[:dryrun] then
66
68
  say "Dry Run Mode: Would uninstall #{spec.full_name}"
@@ -74,20 +76,21 @@ installed elsewhere in GEM_PATH the cleanup command won't touch it.
74
76
  :version => "= #{spec.version}",
75
77
  }
76
78
 
77
- if Gem.user_dir == spec.base_dir then
78
- uninstall_options[:install_dir] = spec.base_dir
79
- end
79
+ uninstall_options[:user_install] = Gem.user_dir == spec.base_dir
80
80
 
81
81
  uninstaller = Gem::Uninstaller.new spec.name, uninstall_options
82
82
 
83
83
  begin
84
84
  uninstaller.uninstall
85
85
  rescue Gem::DependencyRemovalException, Gem::InstallError,
86
- Gem::GemNotInHomeException => e
86
+ Gem::GemNotInHomeException, Gem::FilePermissionError => e
87
87
  say "Unable to uninstall #{spec.full_name}:"
88
88
  say "\t#{e.class}: #{e.message}"
89
89
  end
90
90
  end
91
+
92
+ # Restore path Gem::Uninstaller may have change
93
+ Gem.use_paths(*original_path)
91
94
  end
92
95
 
93
96
  say "Clean Up Complete"
@@ -124,7 +124,7 @@ By default, this RubyGems will install gem as:
124
124
  open release_notes do |io|
125
125
  text = io.gets '==='
126
126
  text << io.gets('===')
127
- text[0...-3]
127
+ text[0...-3].sub(/^# coding:.*?^=/m, '')
128
128
  end
129
129
  else
130
130
  "Oh-no! Unable to find release notes!"
@@ -60,7 +60,7 @@ class Gem::Commands::WhichCommand < Gem::Command
60
60
  dirs.each do |dir|
61
61
  Gem.suffixes.each do |ext|
62
62
  full_path = File.join dir, "#{package_name}#{ext}"
63
- if File.exist? full_path then
63
+ if File.exist? full_path and not File.directory? full_path then
64
64
  result << full_path
65
65
  return result unless options[:show_all]
66
66
  end
@@ -36,6 +36,8 @@ module Gem
36
36
  end
37
37
  end
38
38
 
39
+ # :stopdoc:
40
+
39
41
  begin
40
42
  require 'openssl'
41
43
 
@@ -44,7 +46,7 @@ begin
44
46
 
45
47
  Gem.ssl_available = !!OpenSSL::Digest::SHA1
46
48
 
47
- class OpenSSL::X509::Certificate # :nodoc:
49
+ class OpenSSL::X509::Certificate
48
50
  # Check the validity of this certificate.
49
51
  def check_validity(issuer_cert = nil, time = Time.now)
50
52
  ret = if @not_before && @not_before > time
@@ -66,8 +68,6 @@ rescue LoadError, StandardError
66
68
  Gem.ssl_available = false
67
69
  end
68
70
 
69
- # :stopdoc:
70
-
71
71
  module Gem::SSL
72
72
 
73
73
  # We make our own versions of the constants here. This allows us
@@ -88,5 +88,3 @@ module Gem::SSL
88
88
 
89
89
  end
90
90
 
91
- # :startdoc:
92
-
@@ -434,6 +434,7 @@ class Gem::Installer
434
434
 
435
435
  def check_that_user_bin_dir_is_in_path
436
436
  user_bin_dir = @bin_dir || Gem.bindir(gem_home)
437
+ user_bin_dir.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
437
438
  unless ENV['PATH'].split(File::PATH_SEPARATOR).include? user_bin_dir then
438
439
  unless self.class.path_warning then
439
440
  alert_warning "You don't have #{user_bin_dir} in your PATH,\n\t gem executables will not run."
@@ -85,7 +85,7 @@ class Gem::RemoteFetcher
85
85
 
86
86
  return if found.empty?
87
87
 
88
- spec, source_uri = found.first
88
+ spec, source_uri = found.sort_by { |(s,_)| s.version }.last
89
89
 
90
90
  download spec, source_uri
91
91
  end
@@ -1,5 +1,7 @@
1
1
  require "rubygems/version"
2
2
 
3
+ # :stopdoc:
4
+
3
5
  # Hack to handle syck's DefaultKey bug with psych
4
6
  #
5
7
  # Quick note! If/when psych loads in 1.9, it will redefine
@@ -19,6 +21,8 @@ module YAML
19
21
  end
20
22
  end
21
23
 
24
+ # :startdoc:
25
+
22
26
  ##
23
27
  # A Requirement is a set of one or more version restrictions. It supports a
24
28
  # few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators.
@@ -97,7 +97,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
97
97
  undef_method :default_test if instance_methods.include? 'default_test' or
98
98
  instance_methods.include? :default_test
99
99
 
100
- @@project_dir = Dir.pwd
100
+ @@project_dir = Dir.pwd unless defined?(@@project_dir)
101
101
 
102
102
  ##
103
103
  # #setup prepares a sandboxed location to install gems. All installs are
@@ -116,6 +116,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
116
116
  @orig_gem_home = ENV['GEM_HOME']
117
117
  @orig_gem_path = ENV['GEM_PATH']
118
118
 
119
+ @current_dir = Dir.pwd
119
120
  @ui = Gem::MockGemUi.new
120
121
 
121
122
  tmpdir = nil
@@ -222,7 +223,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
222
223
  Gem::RemoteFetcher.fetcher = nil
223
224
  end
224
225
 
225
- Dir.chdir @@project_dir
226
+ Dir.chdir @current_dir
226
227
 
227
228
  FileUtils.rm_rf @tempdir unless ENV['KEEP_FILES']
228
229
 
@@ -256,6 +257,25 @@ class Gem::TestCase < MiniTest::Unit::TestCase
256
257
  Gem::Installer.new(gem, :wrappers => true).install
257
258
  end
258
259
 
260
+ ##
261
+ # Builds and installs the Gem::Specification +spec+ into the user dir
262
+
263
+ def install_gem_user spec
264
+ require 'rubygems/installer'
265
+
266
+ use_ui Gem::MockGemUi.new do
267
+ Dir.chdir @tempdir do
268
+ Gem::Builder.new(spec).build
269
+ end
270
+ end
271
+
272
+ gem = File.join(@tempdir, File.basename(spec.cache_file)).untaint
273
+
274
+ i = Gem::Installer.new(gem, :wrappers => true, :user_install => true)
275
+ i.install
276
+ i.spec
277
+ end
278
+
259
279
  ##
260
280
  # Uninstalls the Gem::Specification +spec+
261
281
  def uninstall_gem spec
@@ -677,12 +697,13 @@ Also, a list:
677
697
  end
678
698
 
679
699
  v = Gem.marshal_version
700
+
680
701
  Gem::Specification.each do |spec|
681
702
  path = "#{@gem_repo}quick/Marshal.#{v}/#{spec.original_name}.gemspec.rz"
682
703
  data = Marshal.dump spec
683
704
  data_deflate = Zlib::Deflate.deflate data
684
705
  @fetcher.data[path] = data_deflate
685
- end
706
+ end unless Gem::RemoteFetcher === @fetcher # HACK for test_download_to_cache
686
707
 
687
708
  nil # force errors
688
709
  end
@@ -139,6 +139,8 @@ end
139
139
  ##
140
140
  # A StringIO duck-typed class that uses Tempfile instead of String as the
141
141
  # backing store.
142
+ #
143
+ # This is available when rubygems/test_utilities is required.
142
144
  #--
143
145
  # This class was added to flush out problems in Rubinius' IO implementation.
144
146
 
@@ -70,7 +70,7 @@ class Gem::Uninstaller
70
70
  list = Gem::Specification.find_all_by_name(@gem, @version)
71
71
 
72
72
  if list.empty? then
73
- raise Gem::InstallError, "cannot uninstall, check `gem list -d #{@gem}`"
73
+ raise Gem::InstallError, "gem #{@gem.inspect} is not installed"
74
74
 
75
75
  elsif list.size > 1 and @force_all then
76
76
  remove_all list
@@ -141,9 +141,11 @@ class Gem::Uninstaller
141
141
 
142
142
  return if executables.empty?
143
143
 
144
+ executables = executables.map { |exec| formatted_program_filename exec }
145
+
144
146
  remove = if @force_executables.nil? then
145
147
  ask_yes_no("Remove executables:\n" \
146
- "\t#{spec.executables.join ', '}\n\n" \
148
+ "\t#{executables.join ', '}\n\n" \
147
149
  "in addition to the gem?",
148
150
  true)
149
151
  else
@@ -153,14 +155,17 @@ class Gem::Uninstaller
153
155
  unless remove then
154
156
  say "Executables and scripts will remain installed."
155
157
  else
156
- bindir = @bin_dir || Gem.bindir(spec.base_dir)
158
+ bin_dir = @bin_dir || Gem.bindir(spec.base_dir)
157
159
 
158
- raise Gem::FilePermissionError, bindir unless File.writable? bindir
160
+ raise Gem::FilePermissionError, bin_dir unless File.writable? bin_dir
159
161
 
160
- spec.executables.each do |exe_name|
162
+ executables.each do |exe_name|
161
163
  say "Removing #{exe_name}"
162
- FileUtils.rm_f File.join(bindir, formatted_program_filename(exe_name))
163
- FileUtils.rm_f File.join(bindir, "#{formatted_program_filename(exe_name)}.bat")
164
+
165
+ exe_file = File.join bin_dir, exe_name
166
+
167
+ FileUtils.rm_f exe_file
168
+ FileUtils.rm_f "#{exe_file}.bat"
164
169
  end
165
170
  end
166
171
  end
@@ -257,6 +262,7 @@ class Gem::Uninstaller
257
262
 
258
263
  def formatted_program_filename(filename)
259
264
  if @format_executable then
265
+ require 'rubygems/installer'
260
266
  Gem::Installer.exec_format % File.basename(filename)
261
267
  else
262
268
  filename
@@ -136,7 +136,7 @@ class Gem::StreamUI
136
136
  end
137
137
 
138
138
  def tty?
139
- if RUBY_PLATFORM =~ /mingw|mswin/
139
+ if RUBY_VERSION < '1.9.3' and RUBY_PLATFORM =~ /mingw|mswin/ then
140
140
  @usetty
141
141
  else
142
142
  @usetty && @ins.tty?
@@ -598,6 +598,20 @@ class TestGem < Gem::TestCase
598
598
  assert File.directory? File.join(@gemhome, "cache")
599
599
  end
600
600
 
601
+ def test_self_ensure_gem_directories_safe_permissions
602
+ FileUtils.rm_r @gemhome
603
+ Gem.use_paths @gemhome
604
+
605
+ old_umask = File.umask
606
+ File.umask 0
607
+ Gem.ensure_gem_subdirectories @gemhome
608
+
609
+ assert_equal 0, File::Stat.new(@gemhome).mode & 022
610
+ assert_equal 0, File::Stat.new(File.join(@gemhome, "cache")).mode & 022
611
+ ensure
612
+ File.umask old_umask
613
+ end unless win_platform?
614
+
601
615
  def test_self_ensure_gem_directories_missing_parents
602
616
  gemdir = File.join @tempdir, 'a/b/c/gemdir'
603
617
  FileUtils.rm_rf File.join(@tempdir, 'a') rescue nil
@@ -985,9 +999,9 @@ class TestGem < Gem::TestCase
985
999
  end
986
1000
  end
987
1001
 
988
- if Gem.win_platform? then
1002
+ if Gem.win_platform? && '1.9' > RUBY_VERSION
1003
+ # Ruby 1.9 properly handles ~ path expansion, so no need to run such tests.
989
1004
  def test_self_user_home_userprofile
990
- skip 'Ruby 1.9 properly handles ~ path expansion' unless '1.9' > RUBY_VERSION
991
1005
 
992
1006
  Gem.clear_paths
993
1007
 
@@ -1006,8 +1020,6 @@ class TestGem < Gem::TestCase
1006
1020
  end
1007
1021
 
1008
1022
  def test_self_user_home_user_drive_and_path
1009
- skip 'Ruby 1.9 properly handles ~ path expansion' unless '1.9' > RUBY_VERSION
1010
-
1011
1023
  Gem.clear_paths
1012
1024
 
1013
1025
  # safe-keep env variables
@@ -38,6 +38,44 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
38
38
  refute_path_exists @b_1.gem_dir
39
39
  end
40
40
 
41
+ def test_execute_all_user
42
+ @a_1_1 = quick_spec 'a', '1.1'
43
+ @a_1_1 = install_gem_user @a_1_1 # pick up user install path
44
+
45
+ Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
46
+
47
+ assert_path_exists @a_1.gem_dir
48
+ assert_path_exists @a_1_1.gem_dir
49
+
50
+ @cmd.options[:args] = %w[a]
51
+
52
+ @cmd.execute
53
+
54
+ refute_path_exists @a_1.gem_dir
55
+ refute_path_exists @a_1_1.gem_dir
56
+ end
57
+
58
+ def test_execute_all_user_no_sudo
59
+ FileUtils.chmod 0555, @gemhome
60
+
61
+ @a_1_1 = quick_spec 'a', '1.1'
62
+ @a_1_1 = install_gem_user @a_1_1 # pick up user install path
63
+
64
+ Gem::Specification.dirs = [Gem.dir, Gem.user_dir]
65
+
66
+ assert_path_exists @a_1.gem_dir
67
+ assert_path_exists @a_1_1.gem_dir
68
+
69
+ @cmd.options[:args] = %w[a]
70
+
71
+ @cmd.execute
72
+
73
+ assert_path_exists @a_1.gem_dir
74
+ refute_path_exists @a_1_1.gem_dir
75
+ ensure
76
+ FileUtils.chmod 0755, @gemhome
77
+ end unless win_platform?
78
+
41
79
  def test_execute_dry_run
42
80
  @cmd.options[:args] = %w[a]
43
81
  @cmd.options[:dryrun] = true
@@ -6,6 +6,8 @@ class TestGemCommandsSourcesCommand < Gem::TestCase
6
6
  def setup
7
7
  super
8
8
 
9
+ util_setup_fake_fetcher
10
+
9
11
  @cmd = Gem::Commands::SourcesCommand.new
10
12
 
11
13
  @new_repo = "http://beta-gems.example.com"
@@ -69,19 +69,6 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
69
69
  Gem::Installer.exec_format = nil
70
70
  end
71
71
 
72
- def test_execute_not_installed
73
- @cmd.options[:args] = ["foo"]
74
- e = assert_raises Gem::InstallError do
75
- use_ui @ui do
76
- @cmd.execute
77
- end
78
- end
79
-
80
- assert_match(/\Acannot uninstall, check `gem list -d foo`$/, e.message)
81
- output = @ui.output.split "\n"
82
- assert_empty output, "UI output should be empty after an uninstall error"
83
- end
84
-
85
72
  def test_execute_prerelease
86
73
  @spec = quick_spec "pre", "2.b"
87
74
  @gem = File.join @tempdir, @spec.file_name
@@ -22,6 +22,20 @@ class TestGemCommandsWhichCommand < Gem::TestCase
22
22
  assert_equal '', @ui.error
23
23
  end
24
24
 
25
+ def test_execute_directory
26
+ @cmd.handle_options %w[directory]
27
+
28
+ use_ui @ui do
29
+ assert_raises Gem::MockGemUi::TermError do
30
+ @cmd.execute
31
+ end
32
+ end
33
+
34
+ assert_equal '', @ui.output
35
+ assert_match %r%Can.t find ruby library file or shared library directory\n%,
36
+ @ui.error
37
+ end
38
+
25
39
  def test_execute_one_missing
26
40
  # TODO: this test fails in isolation
27
41
 
@@ -53,7 +67,7 @@ class TestGemCommandsWhichCommand < Gem::TestCase
53
67
  end
54
68
 
55
69
  def util_foo_bar
56
- files = %w[lib/foo_bar.rb Rakefile]
70
+ files = %w[lib/foo_bar.rb lib/directory/baz.rb Rakefile]
57
71
  @foo_bar = quick_spec 'foo_bar' do |gem|
58
72
  gem.files = files
59
73
  end
@@ -208,9 +208,10 @@ load Gem.bin_path('a', 'executable', version)
208
208
  end
209
209
 
210
210
  def test_generate_bin_bindir_with_user_install_warning
211
+ bin_dir = Gem.win_platform? ? File.expand_path(ENV["WINDIR"]) : "/usr/bin"
211
212
 
212
213
  options = {
213
- :bin_dir => "/usr/bin",
214
+ :bin_dir => bin_dir,
214
215
  :install_dir => "/non/existant"
215
216
  }
216
217
 
@@ -346,6 +346,28 @@ gems:
346
346
  assert_equal 'unsupported URI scheme ftp', e.message
347
347
  end
348
348
 
349
+ def test_download_to_cache
350
+ @a2, @a2_gem = util_gem 'a', '2'
351
+
352
+ util_setup_spec_fetcher @a1, @a2
353
+ @fetcher.instance_variable_set :@a1, @a1
354
+ @fetcher.instance_variable_set :@a2, @a2
355
+ def @fetcher.fetch_path uri, mtime = nil, head = false
356
+ case uri.request_uri
357
+ when /#{@a1.spec_name}/ then
358
+ Gem.deflate Marshal.dump @a1
359
+ when /#{@a2.spec_name}/ then
360
+ Gem.deflate Marshal.dump @a2
361
+ else
362
+ uri.to_s
363
+ end
364
+ end
365
+
366
+ gem = Gem::RemoteFetcher.fetcher.download_to_cache dep 'a'
367
+
368
+ assert_equal @a2.file_name, File.basename(gem)
369
+ end
370
+
349
371
  def test_explicit_proxy
350
372
  use_ui @ui do
351
373
  fetcher = Gem::RemoteFetcher.new @proxy_uri
@@ -35,7 +35,8 @@ class TestGemStreamUI < Gem::TestCase
35
35
  end
36
36
 
37
37
  def test_ask
38
- skip 'TTY detection broken on windows' if Gem.win_platform?
38
+ skip 'TTY detection broken on windows' if
39
+ Gem.win_platform? unless RUBY_VERSION > '1.9.2'
39
40
 
40
41
  timeout(1) do
41
42
  expected_answer = "Arthur, King of the Britons"
@@ -46,7 +47,8 @@ class TestGemStreamUI < Gem::TestCase
46
47
  end
47
48
 
48
49
  def test_ask_no_tty
49
- skip 'TTY handling is broken on windows' if Gem.win_platform?
50
+ skip 'TTY detection broken on windows' if
51
+ Gem.win_platform? unless RUBY_VERSION > '1.9.2'
50
52
 
51
53
  @in.tty = false
52
54
 
@@ -57,7 +59,8 @@ class TestGemStreamUI < Gem::TestCase
57
59
  end
58
60
 
59
61
  def test_ask_for_password
60
- skip 'Always uses $stdin on windows' if Gem.win_platform?
62
+ skip 'Always uses $stdin on windows' if
63
+ Gem.win_platform? unless RUBY_VERSION > '1.9.2'
61
64
 
62
65
  timeout(1) do
63
66
  expected_answer = "Arthur, King of the Britons"
@@ -68,7 +71,8 @@ class TestGemStreamUI < Gem::TestCase
68
71
  end
69
72
 
70
73
  def test_ask_for_password_no_tty
71
- skip 'TTY handling is broken on windows' if Gem.win_platform?
74
+ skip 'TTY handling is broken on windows' if
75
+ Gem.win_platform? unless RUBY_VERSION > '1.9.2'
72
76
 
73
77
  @in.tty = false
74
78
 
@@ -79,7 +83,8 @@ class TestGemStreamUI < Gem::TestCase
79
83
  end
80
84
 
81
85
  def test_ask_yes_no_no_tty_with_default
82
- skip 'TTY handling is broken on windows' if Gem.win_platform?
86
+ skip 'TTY handling is broken on windows' if
87
+ Gem.win_platform? unless RUBY_VERSION > '1.9.2'
83
88
 
84
89
  @in.tty = false
85
90
 
@@ -93,7 +98,8 @@ class TestGemStreamUI < Gem::TestCase
93
98
  end
94
99
 
95
100
  def test_ask_yes_no_no_tty_without_default
96
- skip 'TTY handling is broken on windows' if Gem.win_platform?
101
+ skip 'TTY handling is broken on windows' if
102
+ Gem.win_platform? unless RUBY_VERSION > '1.9.2'
97
103
 
98
104
  @in.tty = false
99
105
 
@@ -94,7 +94,7 @@ class TestGemUninstaller < Gem::InstallerTestCase
94
94
  exec_path = File.join Gem.user_dir, 'bin', 'foo-executable-bar'
95
95
  assert_equal false, File.exist?(exec_path), 'removed exec from bin dir'
96
96
 
97
- assert_equal "Removing executable\n", @ui.output
97
+ assert_equal "Removing foo-executable-bar\n", @ui.output
98
98
  ensure
99
99
  Gem::Installer.exec_format = nil
100
100
  end
@@ -158,6 +158,16 @@ class TestGemUninstaller < Gem::InstallerTestCase
158
158
  assert_same uninstaller, @post_uninstall_hook_arg
159
159
  end
160
160
 
161
+ def test_uninstall_nonexistent
162
+ uninstaller = Gem::Uninstaller.new 'bogus', :executables => true
163
+
164
+ e = assert_raises Gem::InstallError do
165
+ uninstaller.uninstall
166
+ end
167
+
168
+ assert_equal 'gem "bogus" is not installed', e.message
169
+ end
170
+
161
171
  def test_uninstall_not_ok
162
172
  quick_gem 'z' do |s|
163
173
  s.add_runtime_dependency @spec.name
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubygems-update
3
3
  version: !ruby/object:Gem::Version
4
- hash: 59
4
+ hash: 57
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- - 6
10
- version: 1.8.6
9
+ - 7
10
+ version: 1.8.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Weirich
@@ -15,9 +15,30 @@ authors:
15
15
  - Eric Hodel
16
16
  autorequire:
17
17
  bindir: bin
18
- cert_chain: []
18
+ cert_chain:
19
+ - |
20
+ -----BEGIN CERTIFICATE-----
21
+ MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMRAwDgYDVQQDDAdkcmJy
22
+ YWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZFgNu
23
+ ZXQwHhcNMDcxMjIxMDIwNDE0WhcNMDgxMjIwMDIwNDE0WjBBMRAwDgYDVQQDDAdk
24
+ cmJyYWluMRgwFgYKCZImiZPyLGQBGRYIc2VnbWVudDcxEzARBgoJkiaJk/IsZAEZ
25
+ FgNuZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCbbgLrGLGIDE76
26
+ LV/cvxdEzCuYuS3oG9PrSZnuDweySUfdp/so0cDq+j8bqy6OzZSw07gdjwFMSd6J
27
+ U5ddZCVywn5nnAQ+Ui7jMW54CYt5/H6f2US6U0hQOjJR6cpfiymgxGdfyTiVcvTm
28
+ Gj/okWrQl0NjYOYBpDi+9PPmaH2RmLJu0dB/NylsDnW5j6yN1BEI8MfJRR+HRKZY
29
+ mUtgzBwF1V4KIZQ8EuL6I/nHVu07i6IkrpAgxpXUfdJQJi0oZAqXurAV3yTxkFwd
30
+ g62YrrW26mDe+pZBzR6bpLE+PmXCzz7UxUq3AE0gPHbiMXie3EFE0oxnsU3lIduh
31
+ sCANiQ8BAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
32
+ BBS5k4Z75VSpdM0AclG2UvzFA/VW5DANBgkqhkiG9w0BAQUFAAOCAQEAHagT4lfX
33
+ kP/hDaiwGct7XPuVGbrOsKRVD59FF5kETBxEc9UQ1clKWngf8JoVuEoKD774dW19
34
+ bU0GOVWO+J6FMmT/Cp7nuFJ79egMf/gy4gfUfQMuvfcr6DvZUPIs9P/TlK59iMYF
35
+ DIOQ3DxdF3rMzztNUCizN4taVscEsjCcgW6WkUJnGdqlu3OHWpQxZBJkBTjPCoc6
36
+ UW6on70SFPmAy/5Cq0OJNGEWBfgD9q7rrs/X8GGwUWqXb85RXnUVi/P8Up75E0ag
37
+ 14jEc90kN+C7oI/AGCBN0j6JnEtYIEJZibjjDJTSMWlUKKkj30kq7hlUC2CepJ4v
38
+ x52qPcexcYZR7w==
39
+ -----END CERTIFICATE-----
19
40
 
20
- date: 2011-07-26 00:00:00 Z
41
+ date: 2011-08-05 00:00:00 Z
21
42
  dependencies:
22
43
  - !ruby/object:Gem::Dependency
23
44
  name: minitest
@@ -27,12 +48,12 @@ dependencies:
27
48
  requirements:
28
49
  - - ">="
29
50
  - !ruby/object:Gem::Version
30
- hash: 11
51
+ hash: 1
31
52
  segments:
32
53
  - 2
54
+ - 3
33
55
  - 1
34
- - 0
35
- version: 2.1.0
56
+ version: 2.3.1
36
57
  type: :development
37
58
  version_requirements: *id001
38
59
  - !ruby/object:Gem::Dependency
@@ -132,14 +153,13 @@ dependencies:
132
153
  requirement: &id008 !ruby/object:Gem::Requirement
133
154
  none: false
134
155
  requirements:
135
- - - ">="
156
+ - - ~>
136
157
  - !ruby/object:Gem::Version
137
- hash: 35
158
+ hash: 17
138
159
  segments:
139
160
  - 2
140
161
  - 9
141
- - 4
142
- version: 2.9.4
162
+ version: "2.9"
143
163
  type: :development
144
164
  version_requirements: *id008
145
165
  description: |-
@@ -376,16 +396,17 @@ files:
376
396
  - test/rubygems/test_gem_version_option.rb
377
397
  - test/rubygems/test_kernel.rb
378
398
  - util/CL2notes
379
- - util/gem_prelude.rb
380
399
  - .gemtest
381
400
  homepage: http://rubygems.org
382
401
  licenses: []
383
402
 
403
+ metadata: {}
404
+
384
405
  post_install_message:
385
406
  rdoc_options:
386
407
  - --main
387
408
  - README.rdoc
388
- - --title=RubyGems 1.8.6 Documentation
409
+ - --title=RubyGems 1.8.7 Documentation
389
410
  require_paths:
390
411
  - hide_lib_for_update
391
412
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -411,9 +432,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
411
432
  requirements: []
412
433
 
413
434
  rubyforge_project: rubygems
414
- rubygems_version: 1.8.5
435
+ rubygems_version: 1.8.6
415
436
  signing_key:
416
- specification_version: 3
437
+ specification_version: 4
417
438
  summary: RubyGems is a package management framework for Ruby
418
439
  test_files:
419
440
  - test/rubygems/test_config.rb
Binary file
@@ -1,304 +0,0 @@
1
- # depends on: array.rb dir.rb env.rb file.rb hash.rb module.rb regexp.rb
2
- # vim: filetype=ruby
3
-
4
- # NOTICE: Ruby is during initialization here.
5
- # * Encoding.default_external does not reflects -E.
6
- # * Should not expect Encoding.default_internal.
7
- # * Locale encoding is available.
8
-
9
- if defined?(Gem) then
10
-
11
- # :stopdoc:
12
-
13
- module Kernel
14
-
15
- def gem(gem_name, *requirements)
16
- Gem.push_gem_version_on_load_path(gem_name, *requirements)
17
- end
18
- private :gem
19
- end
20
-
21
- module Gem
22
-
23
- ConfigMap = {
24
- :EXEEXT => RbConfig::CONFIG["EXEEXT"],
25
- :RUBY_SO_NAME => RbConfig::CONFIG["RUBY_SO_NAME"],
26
- :arch => RbConfig::CONFIG["arch"],
27
- :bindir => RbConfig::CONFIG["bindir"],
28
- :libdir => RbConfig::CONFIG["libdir"],
29
- :ruby_install_name => RbConfig::CONFIG["ruby_install_name"],
30
- :ruby_version => RbConfig::CONFIG["ruby_version"],
31
- :rubylibprefix => RbConfig::CONFIG["rubylibprefix"],
32
- :sitedir => RbConfig::CONFIG["sitedir"],
33
- :sitelibdir => RbConfig::CONFIG["sitelibdir"],
34
- }
35
-
36
- def self.dir
37
- @gem_home ||= nil
38
- set_home(ENV['GEM_HOME'] || default_dir) unless @gem_home
39
- @gem_home
40
- end
41
-
42
- def self.path
43
- @gem_path ||= nil
44
- unless @gem_path
45
- paths = [ENV['GEM_PATH'] || default_path]
46
- paths << APPLE_GEM_HOME if defined? APPLE_GEM_HOME
47
- set_paths(paths.compact.join(File::PATH_SEPARATOR))
48
- end
49
- @gem_path
50
- end
51
-
52
- def self.post_install(&hook)
53
- @post_install_hooks << hook
54
- end
55
-
56
- def self.post_uninstall(&hook)
57
- @post_uninstall_hooks << hook
58
- end
59
-
60
- def self.pre_install(&hook)
61
- @pre_install_hooks << hook
62
- end
63
-
64
- def self.pre_uninstall(&hook)
65
- @pre_uninstall_hooks << hook
66
- end
67
-
68
- def self.set_home(home)
69
- home = home.dup.force_encoding(Encoding.find('filesystem'))
70
- home.gsub!(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
71
- @gem_home = home
72
- end
73
-
74
- def self.set_paths(gpaths)
75
- if gpaths
76
- @gem_path = gpaths.split(File::PATH_SEPARATOR)
77
-
78
- if File::ALT_SEPARATOR then
79
- @gem_path.map! do |path|
80
- path.gsub File::ALT_SEPARATOR, File::SEPARATOR
81
- end
82
- end
83
-
84
- @gem_path << Gem.dir
85
- else
86
- # TODO: should this be Gem.default_path instead?
87
- @gem_path = [Gem.dir]
88
- end
89
-
90
- @gem_path.uniq!
91
- @gem_path.map!{|x|x.force_encoding(Encoding.find('filesystem'))}
92
- end
93
-
94
- def self.user_home
95
- @user_home ||= File.expand_path("~").force_encoding(Encoding.find('filesystem'))
96
- rescue
97
- if File::ALT_SEPARATOR then
98
- "C:/"
99
- else
100
- "/"
101
- end
102
- end
103
-
104
- # begin rubygems/defaults
105
- # NOTE: this require will be replaced with in-place eval before compilation.
106
- require 'lib/rubygems/defaults.rb'
107
- # end rubygems/defaults
108
-
109
-
110
- ##
111
- # Methods before this line will be removed when QuickLoader is replaced
112
- # with the real RubyGems
113
-
114
- GEM_PRELUDE_METHODS = Gem.methods(false)
115
-
116
- begin
117
- verbose, debug = $VERBOSE, $DEBUG
118
- $VERBOSE = $DEBUG = nil
119
-
120
- begin
121
- require 'rubygems/defaults/operating_system'
122
- rescue ::LoadError
123
- end
124
-
125
- if defined?(RUBY_ENGINE) then
126
- begin
127
- require "rubygems/defaults/#{RUBY_ENGINE}"
128
- rescue ::LoadError
129
- end
130
- end
131
- ensure
132
- $VERBOSE, $DEBUG = verbose, debug
133
- end
134
-
135
- module QuickLoader
136
-
137
- @loaded_full_rubygems_library = false
138
-
139
- def self.load_full_rubygems_library
140
- return if @loaded_full_rubygems_library
141
-
142
- @loaded_full_rubygems_library = true
143
-
144
- class << Gem
145
- Gem::GEM_PRELUDE_METHODS.each do |method_name|
146
- undef_method method_name
147
- end
148
- undef_method :const_missing
149
- undef_method :method_missing
150
- end
151
-
152
- Kernel.module_eval do
153
- undef_method :gem if method_defined? :gem
154
- end
155
-
156
- $".delete path_to_full_rubygems_library
157
- $".each do |path|
158
- if /#{Regexp.escape File::SEPARATOR}rubygems\.rb\z/ =~ path
159
- raise LoadError, "another rubygems is already loaded from #{path}"
160
- end
161
- end
162
- require 'rubygems'
163
- end
164
-
165
- def self.fake_rubygems_as_loaded
166
- path = path_to_full_rubygems_library
167
- $" << path unless $".include?(path)
168
- end
169
-
170
- def self.path_to_full_rubygems_library
171
- installed_path = File.join(Gem::ConfigMap[:rubylibprefix], Gem::ConfigMap[:ruby_version])
172
- if $:.include?(installed_path)
173
- return File.join(installed_path, 'rubygems.rb')
174
- else # e.g., on test-all
175
- $:.each do |dir|
176
- if File.exist?( path = File.join(dir, 'rubygems.rb') )
177
- return path
178
- end
179
- end
180
- raise LoadError, 'rubygems.rb'
181
- end
182
- end
183
-
184
- GemPaths = {}
185
- GemVersions = {}
186
-
187
- def push_gem_version_on_load_path(gem_name, *requirements)
188
- if requirements.empty?
189
- unless GemPaths.has_key?(gem_name) then
190
- raise Gem::LoadError, "Could not find RubyGem #{gem_name} (>= 0)\n"
191
- end
192
-
193
- # highest version gems already active
194
- return false
195
- else
196
- if requirements.length > 1 then
197
- QuickLoader.load_full_rubygems_library
198
- return gem(gem_name, *requirements)
199
- end
200
-
201
- requirement, version = requirements[0].split
202
- requirement.strip!
203
-
204
- if loaded_version = GemVersions[gem_name] then
205
- case requirement
206
- when ">", ">=" then
207
- return false if
208
- (loaded_version <=> Gem.integers_for(version)) >= 0
209
- when "~>" then
210
- required_version = Gem.integers_for version
211
-
212
- return false if loaded_version.first == required_version.first
213
- end
214
- end
215
-
216
- QuickLoader.load_full_rubygems_library
217
- gem gem_name, *requirements
218
- end
219
- end
220
-
221
- def integers_for(gem_version)
222
- numbers = gem_version.split(".").collect {|n| n.to_i}
223
- numbers.pop while numbers.last == 0
224
- numbers << 0 if numbers.empty?
225
- numbers
226
- end
227
-
228
- def push_all_highest_version_gems_on_load_path
229
- Gem.path.each do |path|
230
- gems_directory = File.join(path, "gems")
231
-
232
- if File.exist?(gems_directory) then
233
- Dir.entries(gems_directory).each do |gem_directory_name|
234
- next if gem_directory_name == "." || gem_directory_name == ".."
235
-
236
- next unless gem_name = gem_directory_name[/(.*)-(.*)/, 1]
237
- new_version = integers_for($2)
238
- current_version = GemVersions[gem_name]
239
-
240
- if !current_version or (current_version <=> new_version) < 0 then
241
- GemVersions[gem_name] = new_version
242
- GemPaths[gem_name] = File.join(gems_directory, gem_directory_name)
243
- end
244
- end
245
- end
246
- end
247
-
248
- require_paths = []
249
-
250
- GemPaths.each_value do |path|
251
- if File.exist?(file = File.join(path, ".require_paths")) then
252
- paths = File.read(file).split.map do |require_path|
253
- File.join path, require_path
254
- end
255
-
256
- require_paths.concat paths
257
- else
258
- require_paths << file if File.exist?(file = File.join(path, "bin"))
259
- require_paths << file if File.exist?(file = File.join(path, "lib"))
260
- end
261
- end
262
-
263
- # "tag" the first require_path inserted into the $LOAD_PATH to enable
264
- # indexing correctly with rubygems proper when it inserts an explicitly
265
- # gem version
266
- unless require_paths.empty? then
267
- require_paths.first.instance_variable_set(:@gem_prelude_index, true)
268
- end
269
- # gem directories must come after -I and ENV['RUBYLIB']
270
- $:[$:.index{|e|e.instance_variable_defined?(:@gem_prelude_index)}||-1,0] = require_paths
271
- end
272
-
273
- def const_missing(constant)
274
- QuickLoader.load_full_rubygems_library
275
-
276
- if Gem.const_defined?(constant) then
277
- Gem.const_get constant
278
- else
279
- super
280
- end
281
- end
282
-
283
- def method_missing(method, *args, &block)
284
- QuickLoader.load_full_rubygems_library
285
- super unless Gem.respond_to?(method)
286
- Gem.send(method, *args, &block)
287
- end
288
- end
289
-
290
- extend QuickLoader
291
-
292
- end
293
-
294
- begin
295
- Gem.push_all_highest_version_gems_on_load_path
296
- Gem::QuickLoader.fake_rubygems_as_loaded
297
- rescue Exception => e
298
- puts "Error loading gem paths on load path in gem_prelude"
299
- puts e
300
- puts e.backtrace.join("\n")
301
- end
302
-
303
- end
304
-