rubygems-update 1.8.17 → 1.8.18

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,15 @@
1
1
  # coding: UTF-8
2
2
 
3
+ === 1.8.18 / 2012-03-11
4
+
5
+ * 4 bug fixes:
6
+
7
+ * Use Psych API to emit more compatible YAML
8
+ * Download and write inside `gem fetch` directly. Fixes #289
9
+ * Honor sysconfdir on 1.8. Fixes #291
10
+ * Search everywhere for a spec for `gem spec`. Fixes #288
11
+ * Fix Gem.all_load_path. Fixes #171
12
+
3
13
  === 1.8.17 / 2012-02-17
4
14
 
5
15
  * 2 minor enhancements:
@@ -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_tree.rb
89
90
  lib/rubygems/remote_fetcher.rb
90
91
  lib/rubygems/require_paths_builder.rb
91
92
  lib/rubygems/requirement.rb
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ Hoe::RUBY_FLAGS << " --disable-gems" if RUBY_VERSION > "1.9"
18
18
 
19
19
  Hoe.plugin :minitest
20
20
  Hoe.plugin :git
21
- Hoe.plugin :isolate
21
+ # Hoe.plugin :isolate
22
22
 
23
23
  hoe = Hoe.spec 'rubygems-update' do
24
24
  self.rubyforge_name = 'rubygems'
@@ -93,6 +93,7 @@ task :package do
93
93
  end
94
94
  end
95
95
 
96
+ desc "Upload release to rubyforge"
96
97
  task :upload_to_rubyforge do
97
98
  v = hoe.version
98
99
  sh "rubyforge add_release rubygems rubygems #{v} pkg/rubygems-update-#{v}.gem"
@@ -100,6 +101,15 @@ task :upload_to_rubyforge do
100
101
  sh "rubyforge add_file rubygems rubygems #{v} pkg/rubygems-#{v}.tgz"
101
102
  end
102
103
 
104
+ desc "Upload release to gemcutter S3"
105
+ task :upload_to_gemcutter do
106
+ v = hoe.version
107
+ sh "s3cmd put -P pkg/rubygems-update-#{v}.gem pkg/rubygems-#{v}.zip pkg/rubygems-#{v}.tgz s3://production.s3.rubygems.org/rubygems/"
108
+ end
109
+
110
+ desc "Upload release to rubyforge and gemcutter"
111
+ task :upload => [:upload_to_rubyforge, :upload_to_gemcutter]
112
+
103
113
  # Misc Tasks ---------------------------------------------------------
104
114
 
105
115
  # These tasks expect to have the following directory structure:
@@ -9,7 +9,7 @@ module Gem
9
9
  QUICKLOADER_SUCKAGE = RUBY_VERSION =~ /^1\.9\.1/
10
10
 
11
11
  # Only MRI 1.9.2 has the custom prelude.
12
- GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/ and RUBY_ENGINE == "ruby"
12
+ GEM_PRELUDE_SUCKAGE = RUBY_VERSION =~ /^1\.9\.2/ && RUBY_ENGINE == "ruby"
13
13
  end
14
14
 
15
15
  if Gem::GEM_PRELUDE_SUCKAGE and defined?(Gem::QuickLoader) then
@@ -120,7 +120,7 @@ require "rubygems/deprecate"
120
120
  # -The RubyGems Team
121
121
 
122
122
  module Gem
123
- VERSION = '1.8.17'
123
+ VERSION = '1.8.18'
124
124
 
125
125
  ##
126
126
  # Raised when RubyGems is unable to load or activate a gem. Contains the
@@ -258,7 +258,7 @@ module Gem
258
258
 
259
259
  Gem.path.each do |gemdir|
260
260
  each_load_path all_partials(gemdir) do |load_path|
261
- result << gemdir.add(load_path).expand_path
261
+ result << load_path
262
262
  end
263
263
  end
264
264
 
@@ -664,6 +664,8 @@ module Gem
664
664
  require 'yaml'
665
665
  end
666
666
 
667
+ require 'rubygems/psych_tree'
668
+
667
669
  # Now that we're sure some kind of yaml library is loaded, pull
668
670
  # in our hack to deal with Syck's DefaultKey ugliness.
669
671
  require 'rubygems/syck_hack'
@@ -58,8 +58,16 @@ class Gem::Commands::FetchCommand < Gem::Command
58
58
  next
59
59
  end
60
60
 
61
- path = Gem::RemoteFetcher.fetcher.download spec, source_uri
62
- FileUtils.mv path, File.basename(spec.cache_file)
61
+ file = "#{spec.full_name}.gem"
62
+ remote_path = source_uri + "gems/#{file}"
63
+
64
+ f = Gem::RemoteFetcher.fetcher
65
+
66
+ gem = f.fetch_path remote_path
67
+
68
+ File.open file, "wb" do |f|
69
+ f.write gem
70
+ end
63
71
 
64
72
  say "Downloaded #{spec.full_name}"
65
73
  end
@@ -62,7 +62,25 @@ FIELD name of gemspec field to show
62
62
  "Please specify a gem name or file on the command line"
63
63
  end
64
64
 
65
- dep = Gem::Dependency.new gem, options[:version]
65
+ case options[:version]
66
+ when String
67
+ req = Gem::Requirement.parse options[:version]
68
+ when Gem::Requirement
69
+ req = options[:version]
70
+ else
71
+ raise Gem::CommandLineError, "Unsupported version type: #{options[:version]}"
72
+ end
73
+
74
+ if !req.none? and options[:all]
75
+ alert_error "Specify --all or -v, not both"
76
+ terminate_interaction 1
77
+ end
78
+
79
+ if options[:all]
80
+ dep = Gem::Dependency.new gem
81
+ else
82
+ dep = Gem::Dependency.new gem, options[:version]
83
+ end
66
84
 
67
85
  field = get_one_optional_argument
68
86
 
@@ -80,7 +98,11 @@ FIELD name of gemspec field to show
80
98
  end
81
99
 
82
100
  if remote? then
83
- found = Gem::SpecFetcher.fetcher.fetch dep
101
+ found = Gem::SpecFetcher.fetcher.fetch dep, true
102
+
103
+ if dep.prerelease? or options[:prerelease]
104
+ found += Gem::SpecFetcher.fetcher.fetch dep, false, true, true
105
+ end
84
106
 
85
107
  specs.push(*found.map { |spec,| spec })
86
108
  end
@@ -68,7 +68,7 @@ class Gem::ConfigFile
68
68
 
69
69
  path.strip
70
70
  rescue LoadError
71
- "/etc"
71
+ RbConfig::CONFIG["sysconfdir"] || "/etc"
72
72
  end
73
73
  end
74
74
 
@@ -0,0 +1,16 @@
1
+ module Gem
2
+ if defined? ::Psych
3
+ class NoAliasYAMLTree < Psych::Visitors::YAMLTree
4
+ def visit_String(str)
5
+ return super unless str == '=' # or whatever you want
6
+
7
+ quote = Psych::Nodes::Scalar::SINGLE_QUOTED
8
+ @emitter.scalar str, nil, nil, false, true, quote
9
+ end
10
+
11
+ # Noop this out so there are no anchors
12
+ def register(target, obj)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1923,7 +1923,15 @@ class Gem::Specification
1923
1923
 
1924
1924
  def to_yaml(opts = {}) # :nodoc:
1925
1925
  if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? then
1926
- super.gsub(/ !!null \n/, " \n")
1926
+ builder = Gem::NoAliasYAMLTree.new({})
1927
+ builder << self
1928
+ ast = builder.tree
1929
+
1930
+ io = StringIO.new
1931
+
1932
+ Psych::Visitors::Emitter.new(io).accept(ast)
1933
+
1934
+ io.string.gsub(/ !!null \n/, " \n")
1927
1935
  else
1928
1936
  YAML.quick_emit object_id, opts do |out|
1929
1937
  out.map taguri, to_yaml_style do |map|
@@ -3,6 +3,7 @@ require 'rubygems/commands/install_command'
3
3
 
4
4
  begin
5
5
  gem "rdoc"
6
+ gem "json"
6
7
  rescue Gem::LoadError
7
8
  # ignore
8
9
  end
@@ -43,6 +43,24 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
43
43
  assert_equal '', @ui.error
44
44
  end
45
45
 
46
+ def test_execute_all_conflicts_with_version
47
+ quick_spec 'foo', '0.0.1'
48
+ quick_spec 'foo', '0.0.2'
49
+
50
+ @cmd.options[:args] = %w[foo]
51
+ @cmd.options[:all] = true
52
+ @cmd.options[:version] = "1"
53
+
54
+ assert_raises Gem::MockGemUi::TermError do
55
+ use_ui @ui do
56
+ @cmd.execute
57
+ end
58
+ end
59
+
60
+ assert_equal '', @ui.output
61
+ assert_equal "ERROR: Specify --all or -v, not both\n", @ui.error
62
+ end
63
+
46
64
  def test_execute_bad_name
47
65
  @cmd.options[:args] = %w[foo]
48
66
 
@@ -122,6 +140,86 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
122
140
  assert_match %r|name: foo|, @ui.output
123
141
  end
124
142
 
143
+ def test_execute_remote_with_version
144
+ foo1 = quick_gem 'foo', "1"
145
+ foo2 = quick_gem 'foo', "2"
146
+
147
+ @fetcher = Gem::FakeFetcher.new
148
+ Gem::RemoteFetcher.fetcher = @fetcher
149
+
150
+ util_setup_spec_fetcher foo1, foo2
151
+
152
+ FileUtils.rm File.join(@gemhome, 'specifications', foo1.spec_name)
153
+ FileUtils.rm File.join(@gemhome, 'specifications', foo2.spec_name)
154
+
155
+ @cmd.options[:args] = %w[foo]
156
+ @cmd.options[:version] = "1"
157
+ @cmd.options[:domain] = :remote
158
+
159
+ use_ui @ui do
160
+ @cmd.execute
161
+ end
162
+
163
+ spec = Gem::Specification.from_yaml @ui.output
164
+
165
+ assert_equal Gem::Version.new("1"), spec.version
166
+ end
167
+
168
+ def test_execute_remote_without_prerelease
169
+ foo = new_spec 'foo', '2.0.0'
170
+ foo_pre = new_spec 'foo', '2.0.1.pre'
171
+
172
+ install_specs foo, foo_pre
173
+
174
+ @fetcher = Gem::FakeFetcher.new
175
+ Gem::RemoteFetcher.fetcher = @fetcher
176
+
177
+ util_setup_spec_fetcher foo
178
+ util_setup_spec_fetcher foo_pre
179
+
180
+ @cmd.options[:args] = %w[foo]
181
+ @cmd.options[:domain] = :remote
182
+
183
+ use_ui @ui do
184
+ @cmd.execute
185
+ end
186
+
187
+ assert_match %r|\A--- !ruby/object:Gem::Specification|, @ui.output
188
+ assert_match %r|name: foo|, @ui.output
189
+
190
+ spec = YAML.load @ui.output
191
+
192
+ assert_equal Gem::Version.new("2.0.0"), spec.version
193
+ end
194
+
195
+ def test_execute_remote_with_prerelease
196
+ foo = new_spec 'foo', '2.0.0'
197
+ foo_pre = new_spec 'foo', '2.0.1.pre'
198
+
199
+ install_specs foo, foo_pre
200
+
201
+ @fetcher = Gem::FakeFetcher.new
202
+ Gem::RemoteFetcher.fetcher = @fetcher
203
+
204
+ util_setup_spec_fetcher foo
205
+ util_setup_spec_fetcher foo_pre
206
+
207
+ @cmd.options[:args] = %w[foo]
208
+ @cmd.options[:domain] = :remote
209
+ @cmd.options[:prerelease] = true
210
+
211
+ use_ui @ui do
212
+ @cmd.execute
213
+ end
214
+
215
+ assert_match %r|\A--- !ruby/object:Gem::Specification|, @ui.output
216
+ assert_match %r|name: foo|, @ui.output
217
+
218
+ spec = YAML.load @ui.output
219
+
220
+ assert_equal Gem::Version.new("2.0.1.pre"), spec.version
221
+ end
222
+
125
223
  def test_execute_ruby
126
224
  foo = quick_spec 'foo'
127
225
 
@@ -1136,6 +1136,18 @@ end
1136
1136
  assert_match %r|^platform: ruby$|, @a1.to_yaml
1137
1137
  end
1138
1138
 
1139
+ def test_to_yaml_emits_syck_compat_yaml
1140
+ if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?
1141
+ @a1.add_dependency "gx", "1.0.0"
1142
+
1143
+ y = @a1.to_yaml
1144
+
1145
+ refute_match %r!^\s*- - =!, y
1146
+ else
1147
+ skip "Only validates psych yaml"
1148
+ end
1149
+ end
1150
+
1139
1151
  def test_validate
1140
1152
  util_setup_validate
1141
1153
 
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: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 8
9
- - 17
10
- version: 1.8.17
9
+ - 18
10
+ version: 1.8.18
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-02-17 00:00:00 Z
20
+ date: 2012-03-12 00:00:00 Z
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
23
  name: minitest
@@ -25,14 +25,13 @@ dependencies:
25
25
  requirement: &id001 !ruby/object:Gem::Requirement
26
26
  none: false
27
27
  requirements:
28
- - - ">="
28
+ - - ~>
29
29
  - !ruby/object:Gem::Version
30
- hash: 11
30
+ hash: 21
31
31
  segments:
32
32
  - 2
33
- - 1
34
- - 0
35
- version: 2.1.0
33
+ - 11
34
+ version: "2.11"
36
35
  type: :development
37
36
  version_requirements: *id001
38
37
  - !ruby/object:Gem::Dependency
@@ -126,36 +125,21 @@ dependencies:
126
125
  version: "4.5"
127
126
  type: :development
128
127
  version_requirements: *id007
129
- - !ruby/object:Gem::Dependency
130
- name: rdoc
131
- prerelease: false
132
- requirement: &id008 !ruby/object:Gem::Requirement
133
- none: false
134
- requirements:
135
- - - ~>
136
- - !ruby/object:Gem::Version
137
- hash: 19
138
- segments:
139
- - 3
140
- - 10
141
- version: "3.10"
142
- type: :development
143
- version_requirements: *id008
144
128
  - !ruby/object:Gem::Dependency
145
129
  name: hoe
146
130
  prerelease: false
147
- requirement: &id009 !ruby/object:Gem::Requirement
131
+ requirement: &id008 !ruby/object:Gem::Requirement
148
132
  none: false
149
133
  requirements:
150
134
  - - ~>
151
135
  - !ruby/object:Gem::Version
152
- hash: 27
136
+ hash: 31
153
137
  segments:
154
138
  - 2
155
- - 12
156
- version: "2.12"
139
+ - 14
140
+ version: "2.14"
157
141
  type: :development
158
- version_requirements: *id009
142
+ version_requirements: *id008
159
143
  description: |-
160
144
  RubyGems is a package management framework for Ruby.
161
145
 
@@ -192,9 +176,9 @@ extra_rdoc_files:
192
176
  - LICENSE.txt
193
177
  - MIT.txt
194
178
  - Manifest.txt
195
- - hide_lib_for_update/note.txt
196
179
  - README.rdoc
197
180
  - UPGRADING.rdoc
181
+ - hide_lib_for_update/note.txt
198
182
  files:
199
183
  - .autotest
200
184
  - .document
@@ -284,6 +268,7 @@ files:
284
268
  - lib/rubygems/package_task.rb
285
269
  - lib/rubygems/path_support.rb
286
270
  - lib/rubygems/platform.rb
271
+ - lib/rubygems/psych_tree.rb
287
272
  - lib/rubygems/remote_fetcher.rb
288
273
  - lib/rubygems/require_paths_builder.rb
289
274
  - lib/rubygems/requirement.rb
@@ -399,7 +384,7 @@ post_install_message:
399
384
  rdoc_options:
400
385
  - --main
401
386
  - README.rdoc
402
- - --title=RubyGems 1.8.17 Documentation
387
+ - --title=RubyGems 1.8.18 Documentation
403
388
  require_paths:
404
389
  - hide_lib_for_update
405
390
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -425,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
425
410
  requirements: []
426
411
 
427
412
  rubyforge_project: rubygems
428
- rubygems_version: 1.8.16
413
+ rubygems_version: 1.8.15
429
414
  signing_key:
430
415
  specification_version: 3
431
416
  summary: RubyGems is a package management framework for Ruby