rubygems-update 1.5.0 → 1.5.2

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.

data.tar.gz.sig CHANGED
Binary file
data/.autotest CHANGED
@@ -4,6 +4,7 @@ require 'autotest/restart'
4
4
 
5
5
  Autotest.add_hook :initialize do |at|
6
6
  at.testlib = 'minitest/autorun'
7
+ at.unit_diff = "cat -u"
7
8
 
8
9
  at.add_exception %r%/\.git/%
9
10
  at.add_exception %r%/\.svn/%
@@ -25,9 +26,12 @@ Autotest.add_hook :initialize do |at|
25
26
  at.files_matching %r%^test/rubygems/test_(.*)\.rb$%
26
27
  end
27
28
 
28
- # at.add_mapping %r%^test/support/(.*).rb$% do |_, m|
29
- # files_matching %r%^test/test_(.*)\.rb%%
30
- # end
31
-
32
29
  at.find_directories = ARGV unless ARGV.empty?
33
30
  end
31
+
32
+ class Autotest
33
+ alias :old_path_to_classname :path_to_classname
34
+ def path_to_classname s
35
+ old_path_to_classname(s.sub(/test.rubygems.test_/, ""))
36
+ end
37
+ end
@@ -1,4 +1,33 @@
1
- === 1.5.0 / 2011-01-31
1
+ === 1.5.2 / 2011-02-10
2
+
3
+ NOTE: RubyGems 1.5.0 and 1.5.1 have a broken <tt>gem update --system</tt>.
4
+
5
+ To upgrade you'll need to use the manual upgrade recipe. Using sudo/su as
6
+ appropriate:
7
+
8
+ $ gem install rubygems-update
9
+ $ update_rubygems
10
+
11
+ Bug Fixes:
12
+
13
+ * Fixed <tt>gem update --system</tt>. RubyGems can now update itself again.
14
+
15
+ === 1.5.1 / 2011-02-09
16
+
17
+ Minor Enhancement:
18
+
19
+ * Added ability to do gem update --system X.Y.Z.
20
+
21
+ Bug Fixes:
22
+
23
+ * Scrub !!null YAML from 1.9.2 (install and build).
24
+ * Added missing requires for user_interaction.
25
+ * Wrote option processing tests for gem update.
26
+ * Updated upgrading doco for new gem update --system option.
27
+ * Fixed SilentUI for cygwin; try /dev/null first then fall back to NUL.
28
+ * RubyGems now enforces ruby 1.8.7 or newer.
29
+
30
+ === 1.5.0 / 2011-01-31
2
31
 
3
32
  Major Enhancements:
4
33
 
@@ -178,6 +178,7 @@ test/rubygems/test_gem_remote_fetcher.rb
178
178
  test/rubygems/test_gem_requirement.rb
179
179
  test/rubygems/test_gem_security.rb
180
180
  test/rubygems/test_gem_server.rb
181
+ test/rubygems/test_gem_silent_ui.rb
181
182
  test/rubygems/test_gem_source_index.rb
182
183
  test/rubygems/test_gem_spec_fetcher.rb
183
184
  test/rubygems/test_gem_specification.rb
@@ -23,22 +23,6 @@ See UPGRADING.rdoc for more details and alternative instructions.
23
23
 
24
24
  -----
25
25
 
26
- NOTE: Ruby 1.9 ships with rubygems and contains a very buggy
27
- "gem-prelude". It is a gem loading system that can interfere with
28
- updating rubygems itself. We do NOT recommend you update to rubygems
29
- 1.4 if you're running ruby 1.9.x until we get that sorted out in a
30
- future ruby release.
31
-
32
- If you absolutely hate kittens and you _must_ upgrade, you're going to
33
- have to do something really hokey like:
34
-
35
- % alias ruby19="ruby19 --disable-gems"
36
- % alias gem19="ruby19 --disable-gems -S gem"
37
-
38
- Even deleting the stock rubygems in 1.9 doesn't fix this situation.
39
-
40
- -----
41
-
42
26
  If you don't have any RubyGems install, there is still the pre-gem approach to
43
27
  getting software, doing it manually:
44
28
 
data/Rakefile CHANGED
@@ -29,7 +29,7 @@ hoe = Hoe.spec 'rubygems-update' do
29
29
  self.readme_file = 'README.rdoc'
30
30
 
31
31
  spec_extras[:required_rubygems_version] = Gem::Requirement.default
32
- spec_extras[:required_ruby_version] = Gem::Requirement.new '> 1.8.3'
32
+ spec_extras[:required_ruby_version] = Gem::Requirement.new '>= 1.8.7'
33
33
  spec_extras[:executables] = ['update_rubygems']
34
34
 
35
35
  clean_globs.push('**/debug.log',
@@ -82,9 +82,9 @@ end
82
82
  # --------------------------------------------------------------------
83
83
  # Creating a release
84
84
 
85
- task :prerelease => [:clobber, :sanity_check, :test, :test_functional]
85
+ task :prerelease => [:clobber, :check_manifest, :test, :test_functional]
86
86
 
87
- task :postrelease => [:tag, :publish_docs]
87
+ task :postrelease => :publish_docs
88
88
 
89
89
  pkg_dir_path = "pkg/rubygems-update-#{hoe.version}"
90
90
  task :package do
@@ -95,14 +95,6 @@ task :package do
95
95
  end
96
96
  end
97
97
 
98
- task :sanity_check do
99
- abort "svn status dirty. commit or revert them" unless `svn st`.empty?
100
- end
101
-
102
- task :tag => :sanity_check do
103
- raise "need a git version of rake tag written"
104
- end
105
-
106
98
  # Misc Tasks ---------------------------------------------------------
107
99
 
108
100
  # These tasks expect to have the following directory structure:
@@ -179,27 +171,3 @@ task "rcov:for", [:test] do |task, args|
179
171
  ruby "#{flags.join ' '} #{rcov} #{rflags.join ' '} #{args[:test]}"
180
172
  end
181
173
 
182
- task :graph do
183
- $: << File.expand_path("~/Work/p4/zss/src/graph/dev/lib")
184
- require 'graph'
185
- deps = Graph.new
186
- deps.rotate
187
-
188
- current = nil
189
- `rake -P -s`.each_line do |line|
190
- case line
191
- when /^rake (.+)/
192
- current = $1
193
- deps[current] if current # force the node to exist, in case of a leaf
194
- when /^\s+(.+)/
195
- deps[current] << $1 if current
196
- else
197
- warn "unparsed: #{line.chomp}"
198
- end
199
- end
200
-
201
-
202
- deps.boxes
203
- deps.save "graph", nil
204
- end
205
-
@@ -1,5 +1,10 @@
1
1
  = How to upgrade/downgrade Rubygems:
2
2
 
3
+ == For RubyGems 1.5.0 and 1.5.1:
4
+
5
+ RubyGems 1.5.0 and 1.5.1 shipped with a broken <tt>gem update --system</tt>.
6
+ You will need to use the Manual Upgrade Recipe below.
7
+
3
8
  == On Ruby 1.9.x:
4
9
 
5
10
  === From stock ruby shipping with 1.9:
@@ -28,10 +33,16 @@ Use the Normal Upgrade Recipe below.
28
33
 
29
34
  === Normal Downgrade
30
35
 
36
+ ==== With rubygems 1.5.2 and higher:
37
+
38
+ $ gem update --system 1.3.7
39
+
40
+ ==== With rubygems 1.5.1 and lower:
41
+
31
42
  Use sudo/su as appropriate:
32
43
 
33
44
  $ gem install rubygems-update -v 1.3.7
34
- $ update_rubygems
45
+ $ update_rubygems _1.3.7_
35
46
 
36
47
  Replace 1.3.7 with whatever version you want to downgrade to. This
37
48
  recipe can also be used to upgrade to a specific version instead of
data/bin/gem CHANGED
@@ -9,7 +9,7 @@ require 'rubygems'
9
9
  require 'rubygems/gem_runner'
10
10
  require 'rubygems/exceptions'
11
11
 
12
- required_version = Gem::Requirement.new ">= 1.8.6"
12
+ required_version = Gem::Requirement.new ">= 1.8.7"
13
13
 
14
14
  unless required_version.satisfied_by? Gem.ruby_version then
15
15
  abort "Expected Ruby Version #{required_version}, is #{Gem.ruby_version}"
@@ -11,7 +11,9 @@ Project.configure do |project|
11
11
  if Socket.gethostname =~ /cibuilder.pivotallabs.com/
12
12
  # explicitly enable dev list notification only for interpreters which should be green
13
13
  interpreters_with_enabled_notification = [
14
- '1.8.7-p302'
14
+ '1.8.7-p330',
15
+ '1.9.1-p378',
16
+ '1.9.2-p136'
15
17
  ]
16
18
  if interpreters_with_enabled_notification.include?(interpreter)
17
19
  project.email_notifier.emails = ['rubygems-developers@rubyforge.org']
@@ -118,7 +118,7 @@ require 'thread' # HACK: remove me for 1.5 - this is here just for rails
118
118
  # -The RubyGems Team
119
119
 
120
120
  module Gem
121
- RubyGemsVersion = VERSION = '1.5.0'
121
+ RubyGemsVersion = VERSION = '1.5.2'
122
122
 
123
123
  ##
124
124
  # Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -27,13 +27,7 @@ class Gem::Commands::SetupCommand < Gem::Command
27
27
  end
28
28
 
29
29
  add_option '--[no-]vendor',
30
- 'Install into vendorlibdir not sitelibdir',
31
- '(Requires Ruby 1.8.7)' do |vendor, options|
32
- if vendor and Gem.ruby_version < Gem::Version.new('1.8.7') then
33
- raise OptionParser::InvalidOption,
34
- "requires ruby 1.8.7+ (you have #{Gem.ruby_version})"
35
- end
36
-
30
+ 'Install into vendorlibdir not sitelibdir' do |vendor, options|
37
31
  options[:site_or_vendor] = vendor ? :vendorlibdir : :sitelibdir
38
32
  end
39
33
 
@@ -55,7 +49,7 @@ class Gem::Commands::SetupCommand < Gem::Command
55
49
  end
56
50
 
57
51
  def check_ruby_version
58
- required_version = Gem::Requirement.new '>= 1.8.6'
52
+ required_version = Gem::Requirement.new '>= 1.8.7'
59
53
 
60
54
  unless required_version.satisfied_by? Gem.ruby_version then
61
55
  alert_error "Expected Ruby version #{required_version}, is #{Gem.ruby_version}"
@@ -21,8 +21,16 @@ class Gem::Commands::UpdateCommand < Gem::Command
21
21
 
22
22
  add_install_update_options
23
23
 
24
- add_option('--system',
24
+ OptionParser.accept Gem::Version do |value|
25
+ Gem::Version.new value
26
+
27
+ value
28
+ end
29
+
30
+ add_option('--system [VERSION]', Gem::Version,
25
31
  'Update the RubyGems system software') do |value, options|
32
+ value = true unless value
33
+
26
34
  options[:system] = value
27
35
  end
28
36
 
@@ -44,33 +52,13 @@ class Gem::Commands::UpdateCommand < Gem::Command
44
52
  end
45
53
 
46
54
  def execute
55
+ @installer = Gem::DependencyInstaller.new options
56
+ @updated = []
57
+
47
58
  hig = {}
48
59
 
49
60
  if options[:system] then
50
- say "Updating RubyGems"
51
-
52
- unless options[:args].empty? then
53
- raise "No gem names are allowed with the --system option"
54
- end
55
-
56
- rubygems_update = Gem::Specification.new
57
- rubygems_update.name = 'rubygems-update'
58
- rubygems_update.version = Gem::Version.new Gem::VERSION
59
- hig['rubygems-update'] = rubygems_update
60
-
61
- options[:user_install] = false
62
-
63
- Gem.source_index.refresh!
64
-
65
- update_gems = Gem.source_index.find_name 'rubygems-update'
66
-
67
- latest_update_gem = update_gems.sort_by { |s| s.version }.last
68
-
69
- say "Updating RubyGems to #{latest_update_gem.version}"
70
- installed = do_rubygems_update latest_update_gem.version
71
-
72
- say "RubyGems system software updated" if installed
73
-
61
+ update_rubygems
74
62
  return
75
63
  else
76
64
  say "Updating installed gems"
@@ -86,28 +74,7 @@ class Gem::Commands::UpdateCommand < Gem::Command
86
74
 
87
75
  gems_to_update = which_to_update hig, options[:args]
88
76
 
89
- updated = []
90
-
91
- installer = Gem::DependencyInstaller.new options
92
-
93
- gems_to_update.uniq.sort.each do |name|
94
- next if updated.any? { |spec| spec.name == name }
95
- success = false
96
-
97
- say "Updating #{name}"
98
- begin
99
- installer.install name
100
- success = true
101
- rescue Gem::InstallError => e
102
- alert_error "Error installing #{name}:\n\t#{e.message}"
103
- success = false
104
- end
105
-
106
- installer.installed_gems.each do |spec|
107
- updated << spec
108
- say "Successfully installed #{spec.full_name}" if success
109
- end
110
- end
77
+ updated = update_gems gems_to_update
111
78
 
112
79
  if updated.empty? then
113
80
  say "Nothing to update"
@@ -130,12 +97,77 @@ class Gem::Commands::UpdateCommand < Gem::Command
130
97
  end
131
98
  end
132
99
 
100
+ def update_gem name, version = Gem::Requirement.default
101
+ return if @updated.any? { |spec| spec.name == name }
102
+ success = false
103
+
104
+ say "Updating #{name}"
105
+ begin
106
+ @installer.install name, version
107
+ success = true
108
+ rescue Gem::InstallError => e
109
+ alert_error "Error installing #{name}:\n\t#{e.message}"
110
+ success = false
111
+ end
112
+
113
+ @installer.installed_gems.each do |spec|
114
+ @updated << spec
115
+ say "Successfully installed #{spec.full_name}" if success
116
+ end
117
+ end
118
+
119
+ def update_gems gems_to_update
120
+ gems_to_update.uniq.sort.each do |name|
121
+ update_gem name
122
+ end
123
+
124
+ @updated
125
+ end
126
+
133
127
  ##
134
- # Update the RubyGems software to +version+.
128
+ # Update RubyGems software to the latest version.
129
+
130
+ def update_rubygems
131
+ unless options[:args].empty? then
132
+ alert_error "Gem names are not allowed with the --system option"
133
+ terminate_interaction 1
134
+ end
135
+
136
+ options[:user_install] = false
137
+
138
+ version = options[:system]
139
+ if version == true then
140
+ version = Gem::Version.new Gem::VERSION
141
+ requirement = Gem::Requirement.new ">= #{Gem::VERSION}"
142
+ else
143
+ version = Gem::Version.new version
144
+ requirement = Gem::Requirement.new version
145
+ end
146
+
147
+ rubygems_update = Gem::Specification.new
148
+ rubygems_update.name = 'rubygems-update'
149
+ rubygems_update.version = version
150
+
151
+ hig = {
152
+ 'rubygems-update' => rubygems_update
153
+ }
154
+
155
+ gems_to_update = which_to_update hig, options[:args]
156
+
157
+ if gems_to_update.empty? then
158
+ say "Latest version currently installed. Aborting."
159
+ terminate_interaction
160
+ end
161
+
162
+ update_gem gems_to_update.first, requirement
163
+
164
+ Gem.source_index.refresh!
165
+
166
+ installed_gems = Gem.source_index.find_name 'rubygems-update', requirement
167
+ version = installed_gems.last.version
135
168
 
136
- def do_rubygems_update(version)
137
169
  args = []
138
- args.push '--prefix', Gem.prefix unless Gem.prefix.nil?
170
+ args << '--prefix' << Gem.prefix if Gem.prefix
139
171
  args << '--no-rdoc' unless options[:generate_rdoc]
140
172
  args << '--no-ri' unless options[:generate_ri]
141
173
  args << '--no-format-executable' if options[:no_format_executable]
@@ -148,8 +180,9 @@ class Gem::Commands::UpdateCommand < Gem::Command
148
180
 
149
181
  # Make sure old rubygems isn't loaded
150
182
  old = ENV["RUBYOPT"]
151
- ENV.delete("RUBYOPT")
152
- system setup_cmd
183
+ ENV.delete("RUBYOPT") if old
184
+ installed = system setup_cmd
185
+ say "RubyGems system software updated" if installed
153
186
  ENV["RUBYOPT"] = old if old
154
187
  end
155
188
  end
@@ -1,5 +1,6 @@
1
+ # -*- coding: utf-8 -*-
1
2
  #++
2
- # Copyright (C) 2004 Mauricio Julio Fern�ndez Pradier
3
+ # Copyright (C) 2004 Mauricio Julio Fernández Pradier
3
4
  # See LICENSE.txt for additional licensing information.
4
5
  #--
5
6
 
@@ -173,7 +173,7 @@ class Gem::SpecFetcher
173
173
  def suggest_gems_from_name gem_name
174
174
  gem_name = gem_name.downcase
175
175
  max = gem_name.size / 2
176
- specs = list.values.flatten(1) # flatten(1) is 1.8.7 and up
176
+ specs = list.values.flatten 1
177
177
 
178
178
  matches = specs.map { |name, version, platform|
179
179
  next unless Gem::Platform.match platform
@@ -536,8 +536,8 @@ class Gem::Specification
536
536
 
537
537
  def self.normalize_yaml_input(input)
538
538
  result = input.respond_to?(:read) ? input.read : input
539
- result = "--- " + result unless result =~ /^--- /
540
- result
539
+ result = "--- " + result unless result =~ /\A--- /
540
+ result.gsub(/ !!null \n/, " \n")
541
541
  end
542
542
 
543
543
  ##
@@ -720,11 +720,13 @@ class Gem::Specification
720
720
  end
721
721
 
722
722
  def to_yaml(opts = {}) # :nodoc:
723
- return super if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?
724
-
725
- YAML.quick_emit object_id, opts do |out|
726
- out.map taguri, to_yaml_style do |map|
727
- encode_with map
723
+ if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? then
724
+ super.gsub(/ !!null \n/, " \n")
725
+ else
726
+ YAML.quick_emit object_id, opts do |out|
727
+ out.map taguri, to_yaml_style do |map|
728
+ encode_with map
729
+ end
728
730
  end
729
731
  end
730
732
  end
@@ -829,6 +831,7 @@ class Gem::Specification
829
831
  # checks..
830
832
 
831
833
  def validate
834
+ require 'rubygems/user_interaction'
832
835
  extend Gem::UserInteraction
833
836
  normalize
834
837
 
@@ -18,13 +18,8 @@ require 'uri'
18
18
  require 'rubygems/package'
19
19
  require 'rubygems/test_utilities'
20
20
  require 'pp'
21
- require 'yaml'
22
21
  require 'zlib'
23
-
24
- begin
25
- YAML::ENGINE.yamler = 'psych'
26
- rescue LoadError
27
- end if YAML.const_defined? :ENGINE
22
+ Gem.load_yaml
28
23
 
29
24
  begin
30
25
  gem 'rdoc'
@@ -430,6 +425,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
430
425
  # Additional +prerelease+ gems may also be created:
431
426
  #
432
427
  # +@a2_pre+:: gem a version 2.a
428
+ # TODO: nuke this and fix tests. this should speed up a lot
433
429
 
434
430
  def util_make_gems(prerelease = false)
435
431
  @a1 = quick_gem 'a', '1' do |s|
@@ -453,11 +449,12 @@ Also, a list:
453
449
  s.require_paths = %w[lib]
454
450
  end
455
451
 
456
- @a2 = quick_gem('a', '2', &init)
457
- @a3a = quick_gem('a', '3.a', &init)
452
+ @a2 = quick_gem('a', '2', &init)
453
+ @a3a = quick_gem('a', '3.a', &init)
458
454
  @a_evil9 = quick_gem('a_evil', '9', &init)
459
- @b2 = quick_gem('b', '2', &init)
460
- @c1_2 = quick_gem('c', '1.2', &init)
455
+ @b2 = quick_gem('b', '2', &init)
456
+ @c1_2 = quick_gem('c', '1.2', &init)
457
+
461
458
  @pl1 = quick_gem 'pl', '1' do |s| # l for legacy
462
459
  s.files = %w[lib/code.rb]
463
460
  s.require_paths = %w[lib]
@@ -471,12 +468,12 @@ Also, a list:
471
468
  util_build_gem @a2_pre
472
469
  end
473
470
 
474
- write_file File.join(*%W[gems #{@a1.original_name} lib code.rb])
475
- write_file File.join(*%W[gems #{@a2.original_name} lib code.rb])
476
- write_file File.join(*%W[gems #{@a3a.original_name} lib code.rb])
477
- write_file File.join(*%W[gems #{@b2.original_name} lib code.rb])
471
+ write_file File.join(*%W[gems #{@a1.original_name} lib code.rb])
472
+ write_file File.join(*%W[gems #{@a2.original_name} lib code.rb])
473
+ write_file File.join(*%W[gems #{@a3a.original_name} lib code.rb])
474
+ write_file File.join(*%W[gems #{@b2.original_name} lib code.rb])
478
475
  write_file File.join(*%W[gems #{@c1_2.original_name} lib code.rb])
479
- write_file File.join(*%W[gems #{@pl1.original_name} lib code.rb])
476
+ write_file File.join(*%W[gems #{@pl1.original_name} lib code.rb])
480
477
 
481
478
  [@a1, @a2, @a3a, @a_evil9, @b2, @c1_2, @pl1].each do |spec|
482
479
  util_build_gem spec
@@ -530,15 +530,16 @@ class Gem::SilentUI < Gem::StreamUI
530
530
 
531
531
  reader, writer = nil, nil
532
532
 
533
- if Gem.win_platform?
534
- reader = File.open('nul', 'r')
535
- writer = File.open('nul', 'w')
536
- else
533
+ begin
537
534
  reader = File.open('/dev/null', 'r')
538
535
  writer = File.open('/dev/null', 'w')
536
+ rescue Errno::ENOENT
537
+ reader = File.open('nul', 'r')
538
+ writer = File.open('nul', 'w')
539
539
  end
540
540
 
541
541
  super reader, writer, writer
542
542
  end
543
+
543
544
  end
544
545
 
@@ -48,6 +48,150 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
48
48
  assert_empty out
49
49
  end
50
50
 
51
+ def util_setup_rubygem version
52
+ gem = quick_gem('rubygems-update', version.to_s) do |s|
53
+ s.files = %w[setup.rb]
54
+ end
55
+ write_file File.join(*%W[gems #{gem.original_name} setup.rb])
56
+ util_build_gem gem
57
+ util_setup_spec_fetcher gem
58
+ gem
59
+ end
60
+
61
+ def util_setup_rubygem8
62
+ @rubygem8 = util_setup_rubygem 8
63
+ end
64
+
65
+ def util_setup_rubygem9
66
+ @rubygem9 = util_setup_rubygem 9
67
+ end
68
+
69
+ def util_setup_rubygem_current
70
+ @rubygem_current = util_setup_rubygem Gem::VERSION
71
+ end
72
+
73
+ def util_add_to_fetcher *specs
74
+ specs.each do |spec|
75
+ gem_file = File.join @gemhome, 'cache', spec.file_name
76
+
77
+ @fetcher.data["http://gems.example.com/gems/#{spec.file_name}"] =
78
+ Gem.read_binary gem_file
79
+ end
80
+ end
81
+
82
+ def test_execute_system
83
+ util_setup_rubygem9
84
+ util_setup_spec_fetcher @rubygem9
85
+ util_add_to_fetcher @rubygem9
86
+ util_clear_gems
87
+
88
+ @cmd.options[:args] = []
89
+ @cmd.options[:system] = true
90
+ @cmd.options[:generate_rdoc] = false
91
+ @cmd.options[:generate_ri] = false
92
+
93
+ use_ui @ui do
94
+ @cmd.execute
95
+ end
96
+
97
+ out = @ui.output.split "\n"
98
+ assert_equal "Updating rubygems-update", out.shift
99
+ assert_equal "Successfully installed rubygems-update-9", out.shift
100
+ assert_equal "Installing RubyGems 9", out.shift
101
+ assert_equal "RubyGems system software updated", out.shift
102
+
103
+ assert_empty out
104
+ end
105
+
106
+ def test_execute_system_at_latest
107
+ util_setup_rubygem_current
108
+ util_setup_spec_fetcher @rubygem_current
109
+ util_add_to_fetcher @rubygem_current
110
+ util_clear_gems
111
+
112
+ @cmd.options[:args] = []
113
+ @cmd.options[:system] = true
114
+ @cmd.options[:generate_rdoc] = false
115
+ @cmd.options[:generate_ri] = false
116
+
117
+ assert_raises Gem::SystemExitException do
118
+ use_ui @ui do
119
+ @cmd.execute
120
+ end
121
+ end
122
+
123
+ out = @ui.output.split "\n"
124
+ assert_equal "Latest version currently installed. Aborting.", out.shift
125
+ assert_empty out
126
+ end
127
+
128
+ def test_execute_system_multiple
129
+ util_setup_rubygem9
130
+ util_setup_rubygem8
131
+ util_setup_spec_fetcher @rubygem8, @rubygem9
132
+ util_add_to_fetcher @rubygem8, @rubygem9
133
+ util_clear_gems
134
+
135
+ @cmd.options[:args] = []
136
+ @cmd.options[:system] = true
137
+ @cmd.options[:generate_rdoc] = false
138
+ @cmd.options[:generate_ri] = false
139
+
140
+ use_ui @ui do
141
+ @cmd.execute
142
+ end
143
+
144
+ out = @ui.output.split "\n"
145
+ assert_equal "Updating rubygems-update", out.shift
146
+ assert_equal "Successfully installed rubygems-update-9", out.shift
147
+ assert_equal "Installing RubyGems 9", out.shift
148
+ assert_equal "RubyGems system software updated", out.shift
149
+
150
+ assert_empty out
151
+ end
152
+
153
+ def test_execute_system_specific
154
+ util_clear_gems
155
+ util_setup_rubygem9
156
+ util_setup_rubygem8
157
+ util_setup_spec_fetcher @rubygem8, @rubygem9
158
+ util_add_to_fetcher @rubygem8, @rubygem9
159
+
160
+ @cmd.options[:args] = []
161
+ @cmd.options[:system] = "8"
162
+ @cmd.options[:generate_rdoc] = false
163
+ @cmd.options[:generate_ri] = false
164
+
165
+ use_ui @ui do
166
+ @cmd.execute
167
+ end
168
+
169
+ out = @ui.output.split "\n"
170
+ assert_equal "Updating rubygems-update", out.shift
171
+ assert_equal "Successfully installed rubygems-update-8", out.shift
172
+ assert_equal "Installing RubyGems 8", out.shift
173
+ assert_equal "RubyGems system software updated", out.shift
174
+
175
+ assert_empty out
176
+ end
177
+
178
+ def test_execute_system_with_gems
179
+ @cmd.options[:args] = %w[gem]
180
+ @cmd.options[:system] = true
181
+ @cmd.options[:generate_rdoc] = false
182
+ @cmd.options[:generate_ri] = false
183
+
184
+ assert_raises Gem::MockGemUi::TermError do
185
+ use_ui @ui do
186
+ @cmd.execute
187
+ end
188
+ end
189
+
190
+ assert_empty @ui.output
191
+ assert_equal "ERROR: Gem names are not allowed with the --system option\n",
192
+ @ui.error
193
+ end
194
+
51
195
  # before:
52
196
  # a1 -> c1.2
53
197
  # after:
@@ -65,9 +209,9 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
65
209
  @a2.add_dependency 'c', '2'
66
210
  @a2.add_dependency 'b', '2'
67
211
 
68
- @b2_path = File.join @gemhome, 'cache', @b2.file_name
212
+ @b2_path = File.join @gemhome, 'cache', @b2.file_name
69
213
  @c1_2_path = File.join @gemhome, 'cache', @c1_2.file_name
70
- @c2_path = File.join @gemhome, 'cache', @c2.file_name
214
+ @c2_path = File.join @gemhome, 'cache', @c2.file_name
71
215
 
72
216
  @source_index = Gem::SourceIndex.new
73
217
  @source_index.add_spec @a1
@@ -166,4 +310,39 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
166
310
 
167
311
  assert_empty out
168
312
  end
313
+
314
+ def test_handle_options_system
315
+ @cmd.handle_options %w[--system]
316
+
317
+ expected = {
318
+ :generate_ri => true,
319
+ :system => true,
320
+ :force => false,
321
+ :args => [],
322
+ :generate_rdoc => true,
323
+ }
324
+
325
+ assert_equal expected, @cmd.options
326
+ end
327
+
328
+ def test_handle_options_system_non_version
329
+ assert_raises ArgumentError do
330
+ @cmd.handle_options %w[--system non-version]
331
+ end
332
+ end
333
+
334
+ def test_handle_options_system_specific
335
+ @cmd.handle_options %w[--system 1.3.7]
336
+
337
+ expected = {
338
+ :generate_ri => true,
339
+ :system => "1.3.7",
340
+ :force => false,
341
+ :args => [],
342
+ :generate_rdoc => true,
343
+ }
344
+
345
+ assert_equal expected, @cmd.options
346
+ end
347
+
169
348
  end
@@ -88,7 +88,6 @@ class TestGemSilentUI < Gem::TestCase
88
88
  end
89
89
 
90
90
  def test_progress_reporter
91
- value = nil
92
91
  out, err = capture_io do
93
92
  use_ui @sui do
94
93
  @sui.progress_reporter 10, 'hi'
@@ -100,7 +99,6 @@ class TestGemSilentUI < Gem::TestCase
100
99
  end
101
100
 
102
101
  def test_download_reporter
103
- value = nil
104
102
  out, err = capture_io do
105
103
  use_ui @sui do
106
104
  @sui.download_reporter.fetch 'a.gem', 1024
@@ -161,6 +161,13 @@ end
161
161
  Gem::Specification.normalize_yaml_input(StringIO.new(input))
162
162
  end
163
163
 
164
+ def test_self_normalize_yaml_input_with_192_yaml
165
+ input = "--- !ruby/object:Gem::Specification \nblah: !!null \n"
166
+ expected = "--- !ruby/object:Gem::Specification \nblah: \n"
167
+
168
+ assert_equal expected, Gem::Specification.normalize_yaml_input(input)
169
+ end
170
+
164
171
  def test_initialize
165
172
  spec = Gem::Specification.new do |s|
166
173
  s.name = "blah"
@@ -878,6 +885,9 @@ end
878
885
 
879
886
  def test_to_yaml
880
887
  yaml_str = @a1.to_yaml
888
+
889
+ refute_match '!!null', yaml_str
890
+
881
891
  same_spec = YAML.load(yaml_str)
882
892
 
883
893
  assert_equal @a1, same_spec
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: 3
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
- - 0
10
- version: 1.5.0
9
+ - 2
10
+ version: 1.5.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Weirich
@@ -38,7 +38,7 @@ cert_chain:
38
38
  x52qPcexcYZR7w==
39
39
  -----END CERTIFICATE-----
40
40
 
41
- date: 2011-01-31 00:00:00 -08:00
41
+ date: 2011-02-10 00:00:00 -08:00
42
42
  default_executable:
43
43
  dependencies:
44
44
  - !ruby/object:Gem::Dependency
@@ -150,22 +150,6 @@ description: |-
150
150
 
151
151
  -----
152
152
 
153
- NOTE: Ruby 1.9 ships with rubygems and contains a very buggy
154
- "gem-prelude". It is a gem loading system that can interfere with
155
- updating rubygems itself. We do NOT recommend you update to rubygems
156
- 1.4 if you're running ruby 1.9.x until we get that sorted out in a
157
- future ruby release.
158
-
159
- If you absolutely hate kittens and you _must_ upgrade, you're going to
160
- have to do something really hokey like:
161
-
162
- % alias ruby19="ruby19 --disable-gems"
163
- % alias gem19="ruby19 --disable-gems -S gem"
164
-
165
- Even deleting the stock rubygems in 1.9 doesn't fix this situation.
166
-
167
- -----
168
-
169
153
  If you don't have any RubyGems install, there is still the pre-gem approach to
170
154
  getting software, doing it manually:
171
155
 
@@ -371,6 +355,7 @@ files:
371
355
  - test/rubygems/test_gem_requirement.rb
372
356
  - test/rubygems/test_gem_security.rb
373
357
  - test/rubygems/test_gem_server.rb
358
+ - test/rubygems/test_gem_silent_ui.rb
374
359
  - test/rubygems/test_gem_source_index.rb
375
360
  - test/rubygems/test_gem_spec_fetcher.rb
376
361
  - test/rubygems/test_gem_specification.rb
@@ -383,7 +368,6 @@ files:
383
368
  - test/rubygems/test_kernel.rb
384
369
  - util/CL2notes
385
370
  - util/gem_prelude.rb
386
- - test/rubygems/test_gem_silent_ui.rb
387
371
  - .gemtest
388
372
  has_rdoc: true
389
373
  homepage: http://rubygems.org
@@ -393,20 +377,20 @@ post_install_message:
393
377
  rdoc_options:
394
378
  - --main
395
379
  - README.rdoc
396
- - --title=RubyGems 1.5.0 Documentation
380
+ - --title=RubyGems 1.5.2 Documentation
397
381
  require_paths:
398
382
  - hide_lib_for_update
399
383
  required_ruby_version: !ruby/object:Gem::Requirement
400
384
  none: false
401
385
  requirements:
402
- - - ">"
386
+ - - ">="
403
387
  - !ruby/object:Gem::Version
404
- hash: 49
388
+ hash: 57
405
389
  segments:
406
390
  - 1
407
391
  - 8
408
- - 3
409
- version: 1.8.3
392
+ - 7
393
+ version: 1.8.7
410
394
  required_rubygems_version: !ruby/object:Gem::Requirement
411
395
  none: false
412
396
  requirements:
@@ -419,7 +403,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
419
403
  requirements: []
420
404
 
421
405
  rubyforge_project: rubygems
422
- rubygems_version: 1.4.2
406
+ rubygems_version: 1.5.3
423
407
  signing_key:
424
408
  specification_version: 3
425
409
  summary: RubyGems is a package management framework for Ruby
metadata.gz.sig CHANGED
Binary file