rubygems-update 1.8.19 → 1.8.20

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.

@@ -1,5 +1,14 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 1.8.20 / 2012-03-21
4
+
5
+ * 4 bug fixes:
6
+
7
+ * Add --force to `gem build` to skip validation. Fixes #297
8
+ * Gracefully deal with YAML::PrivateType objects in Marshal'd gemspecs
9
+ * Treat the source as a proper url base. Fixes #304
10
+ * Warn when updating the specs cache fails. Fixes #300
11
+
3
12
  === 1.8.19 / 2012-03-14
4
13
 
5
14
  * 3 bug fixes:
@@ -86,6 +86,7 @@ lib/rubygems/package/tar_writer.rb
86
86
  lib/rubygems/package_task.rb
87
87
  lib/rubygems/path_support.rb
88
88
  lib/rubygems/platform.rb
89
+ lib/rubygems/psych_additions.rb
89
90
  lib/rubygems/psych_tree.rb
90
91
  lib/rubygems/remote_fetcher.rb
91
92
  lib/rubygems/require_paths_builder.rb
@@ -109,6 +110,7 @@ setup.rb
109
110
  test/rubygems/bogussources.rb
110
111
  test/rubygems/data/gem-private_key.pem
111
112
  test/rubygems/data/gem-public_cert.pem
113
+ test/rubygems/data/null-type.gemspec.rz
112
114
  test/rubygems/fake_certlib/openssl.rb
113
115
  test/rubygems/fix_openssl_warnings.rb
114
116
  test/rubygems/foo/discover.rb
@@ -120,7 +120,7 @@ require "rubygems/deprecate"
120
120
  # -The RubyGems Team
121
121
 
122
122
  module Gem
123
- VERSION = '1.8.19'
123
+ VERSION = '1.8.20'
124
124
 
125
125
  ##
126
126
  # Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -671,6 +671,7 @@ module Gem
671
671
  YAML::ENGINE.yamler = "psych"
672
672
  end
673
673
 
674
+ require 'rubygems/psych_additions'
674
675
  require 'rubygems/psych_tree'
675
676
  end
676
677
  end
@@ -32,9 +32,9 @@ class Gem::Builder
32
32
  # Builds the gem from the specification. Returns the name of the file
33
33
  # written.
34
34
 
35
- def build
35
+ def build(skip_validation=false)
36
36
  @spec.mark_version
37
- @spec.validate
37
+ @spec.validate unless skip_validation
38
38
  @signer = sign
39
39
  write_package
40
40
  say success if Gem.configuration.verbose
@@ -4,7 +4,11 @@ require 'rubygems/builder'
4
4
  class Gem::Commands::BuildCommand < Gem::Command
5
5
 
6
6
  def initialize
7
- super('build', 'Build a gem from a gemspec')
7
+ super 'build', 'Build a gem from a gemspec'
8
+
9
+ add_option '--force', 'skip validation of the spec' do |value, options|
10
+ options[:force] = true
11
+ end
8
12
  end
9
13
 
10
14
  def arguments # :nodoc:
@@ -22,7 +26,7 @@ class Gem::Commands::BuildCommand < Gem::Command
22
26
  spec = load_gemspec gemspec
23
27
 
24
28
  if spec then
25
- Gem::Builder.new(spec).build
29
+ Gem::Builder.new(spec).build options[:force]
26
30
  else
27
31
  alert_error "Error loading gemspec. Aborting."
28
32
  terminate_interaction 1
@@ -59,11 +59,11 @@ class Gem::Commands::FetchCommand < Gem::Command
59
59
  end
60
60
 
61
61
  file = "#{spec.full_name}.gem"
62
- remote_path = source_uri + "gems/#{file}"
62
+ remote_path = URI.parse(source_uri) + "gems/#{file}"
63
63
 
64
64
  fetch = Gem::RemoteFetcher.fetcher
65
65
 
66
- gem = fetch.fetch_path remote_path
66
+ gem = fetch.fetch_path remote_path.to_s
67
67
 
68
68
  File.open file, "wb" do |f|
69
69
  f.write gem
@@ -0,0 +1,9 @@
1
+ # This exists just to satify bugs in marshal'd gemspecs that
2
+ # contain a reference to YAML::PrivateType. We prune these out
3
+ # in Specification._load, but if we don't have the constant, Marshal
4
+ # blows up.
5
+
6
+ module Psych
7
+ class PrivateType
8
+ end
9
+ end
@@ -255,8 +255,12 @@ class Gem::SpecFetcher
255
255
  loaded = false
256
256
 
257
257
  if File.exist? local_file then
258
- spec_dump =
259
- @fetcher.fetch_path(spec_path, File.mtime(local_file)) rescue nil
258
+ begin
259
+ spec_dump =
260
+ @fetcher.fetch_path(spec_path, File.mtime(local_file))
261
+ rescue Gem::RemoteFetcher::FetchError => e
262
+ alert_warning "Error fetching data: #{e.message}"
263
+ end
260
264
 
261
265
  loaded = true if spec_dump
262
266
 
@@ -666,6 +666,11 @@ class Gem::Specification
666
666
  raise TypeError, "invalid Gem::Specification format #{array.inspect}"
667
667
  end
668
668
 
669
+ # Cleanup any YAML::PrivateType. They only show up for an old bug
670
+ # where nil => null, so just convert them to nil based on the type.
671
+
672
+ array.map! { |e| e.kind_of?(YAML::PrivateType) ? nil : e }
673
+
669
674
  spec.instance_variable_set :@rubygems_version, array[0]
670
675
  # spec version
671
676
  spec.instance_variable_set :@name, array[2]
@@ -98,5 +98,21 @@ class TestGemCommandsBuildCommand < Gem::TestCase
98
98
  assert_equal "this is a summary", spec.summary
99
99
  end
100
100
 
101
+ def test_execute_force
102
+ @gem.instance_variable_set :@required_rubygems_version, nil
103
+
104
+ gemspec_file = File.join(@tempdir, @gem.spec_name)
105
+
106
+ File.open gemspec_file, 'w' do |gs|
107
+ gs.write @gem.to_yaml
108
+ end
109
+
110
+ @cmd.options[:args] = [gemspec_file]
111
+ @cmd.options[:force] = true
112
+
113
+ util_test_build_gem @gem, gemspec_file
114
+ end
115
+
116
+
101
117
  end
102
118
 
@@ -73,5 +73,30 @@ class TestGemCommandsFetchCommand < Gem::TestCase
73
73
  "#{@a1.full_name} not fetched"
74
74
  end
75
75
 
76
+ def test_execute_handles_sources_properly
77
+ repo = "http://gems.example.com"
78
+ @uri = URI.parse repo
79
+
80
+ Gem.sources.replace [repo]
81
+
82
+ util_setup_fake_fetcher
83
+ util_setup_spec_fetcher @a1, @a2
84
+
85
+ @fetcher.data["#{@gem_repo}gems/#{@a1.file_name}"] =
86
+ File.read(@a1.cache_file)
87
+
88
+ @cmd.options[:args] = [@a2.name]
89
+ @cmd.options[:version] = Gem::Requirement.new '1'
90
+
91
+ use_ui @ui do
92
+ Dir.chdir @tempdir do
93
+ @cmd.execute
94
+ end
95
+ end
96
+
97
+ assert File.exist?(File.join(@tempdir, @a1.file_name)),
98
+ "#{@a1.full_name} not fetched"
99
+ end
100
+
76
101
  end
77
102
 
@@ -178,6 +178,38 @@ class TestGemCommandsInstallCommand < Gem::TestCase
178
178
  assert_match(/ould not find a valid gem 'nonexistent'/, @ui.error)
179
179
  end
180
180
 
181
+ def test_execute_bad_source
182
+ util_setup_fake_fetcher
183
+ util_setup_spec_fetcher
184
+
185
+ # This is needed because we need to exercise the cache path
186
+ # within SpecFetcher
187
+ path = File.join Gem.user_home, '.gem', 'specs', "not-there.nothing%80",
188
+ "latest_specs.4.8"
189
+
190
+ FileUtils.mkdir_p File.dirname(path)
191
+
192
+ File.open path, "w" do |f|
193
+ f.write Marshal.dump([])
194
+ end
195
+
196
+ Gem.sources.replace ["http://not-there.nothing"]
197
+
198
+ @cmd.options[:args] = %w[nonexistent]
199
+
200
+ use_ui @ui do
201
+ e = assert_raises Gem::SystemExitException do
202
+ @cmd.execute
203
+ end
204
+ assert_equal 2, e.exit_code
205
+ end
206
+
207
+ errs = @ui.error.split("\n")
208
+
209
+ assert_match(/WARNING: Error fetching data/, errs.shift)
210
+ assert_match(/ould not find a valid gem 'nonexistent'/, errs.shift)
211
+ end
212
+
181
213
  def test_execute_nonexistent_with_hint
182
214
  misspelled = "nonexistent_with_hint"
183
215
  correctly_spelled = "non_existent_with_hint"
@@ -406,6 +406,16 @@ dependencies: []
406
406
  assert_equal expected, Gem::Specification.normalize_yaml_input(input)
407
407
  end
408
408
 
409
+ DATA_PATH = File.expand_path "../data", __FILE__
410
+
411
+ def test_handles_private_null_type
412
+ path = File.join DATA_PATH, "null-type.gemspec.rz"
413
+
414
+ data = Marshal.load Gem.inflate(File.read(path))
415
+
416
+ assert_equal nil, data.rubyforge_project
417
+ end
418
+
409
419
  def test_initialize
410
420
  spec = Gem::Specification.new do |s|
411
421
  s.name = "blah"
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: 17
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- - 19
10
- version: 1.8.19
9
+ - 20
10
+ version: 1.8.20
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jim Weirich
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-03-14 00:00:00 Z
20
+ date: 2012-03-21 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: minitest
@@ -269,6 +269,7 @@ files:
269
269
  - lib/rubygems/package_task.rb
270
270
  - lib/rubygems/path_support.rb
271
271
  - lib/rubygems/platform.rb
272
+ - lib/rubygems/psych_additions.rb
272
273
  - lib/rubygems/psych_tree.rb
273
274
  - lib/rubygems/remote_fetcher.rb
274
275
  - lib/rubygems/require_paths_builder.rb
@@ -292,6 +293,7 @@ files:
292
293
  - test/rubygems/bogussources.rb
293
294
  - test/rubygems/data/gem-private_key.pem
294
295
  - test/rubygems/data/gem-public_cert.pem
296
+ - test/rubygems/data/null-type.gemspec.rz
295
297
  - test/rubygems/fake_certlib/openssl.rb
296
298
  - test/rubygems/fix_openssl_warnings.rb
297
299
  - test/rubygems/foo/discover.rb
@@ -385,7 +387,7 @@ post_install_message:
385
387
  rdoc_options:
386
388
  - --main
387
389
  - README.rdoc
388
- - --title=RubyGems 1.8.19 Documentation
390
+ - --title=RubyGems 1.8.20 Documentation
389
391
  require_paths:
390
392
  - hide_lib_for_update
391
393
  required_ruby_version: !ruby/object:Gem::Requirement