rubygems-update 1.8.15 → 1.8.16
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/History.txt +8 -0
- data/lib/rubygems.rb +2 -2
- data/lib/rubygems/specification.rb +6 -5
- data/lib/rubygems/test_case.rb +3 -16
- data/test/rubygems/test_gem.rb +82 -2
- data/test/rubygems/test_gem_specification.rb +30 -0
- metadata +5 -5
data/History.txt
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# coding: UTF-8
|
2
2
|
|
3
|
+
=== 1.8.16 / 2012-02-12
|
4
|
+
|
5
|
+
* 3 bug fixes:
|
6
|
+
|
7
|
+
* Fix gem specification loading when encoding is not UTF-8. #146
|
8
|
+
* Allow group writable if umask allows it already.
|
9
|
+
* Uniquify the spec list based on directory order priority
|
10
|
+
|
3
11
|
=== 1.8.15 / 2012-01-06
|
4
12
|
|
5
13
|
* 1 bug fix:
|
data/lib/rubygems.rb
CHANGED
@@ -118,7 +118,7 @@ require "rubygems/deprecate"
|
|
118
118
|
# -The RubyGems Team
|
119
119
|
|
120
120
|
module Gem
|
121
|
-
VERSION = '1.8.
|
121
|
+
VERSION = '1.8.16'
|
122
122
|
|
123
123
|
##
|
124
124
|
# Raised when RubyGems is unable to load or activate a gem. Contains the
|
@@ -445,7 +445,7 @@ module Gem
|
|
445
445
|
require 'fileutils'
|
446
446
|
|
447
447
|
old_umask = File.umask
|
448
|
-
File.umask old_umask |
|
448
|
+
File.umask old_umask | 002
|
449
449
|
|
450
450
|
%w[cache doc gems specifications].each do |name|
|
451
451
|
subdir = File.join dir, name
|
@@ -262,18 +262,19 @@ class Gem::Specification
|
|
262
262
|
|
263
263
|
def self._all # :nodoc:
|
264
264
|
unless defined?(@@all) && @@all then
|
265
|
-
specs =
|
265
|
+
specs = {}
|
266
266
|
|
267
|
-
self.dirs.
|
267
|
+
self.dirs.each { |dir|
|
268
268
|
Dir[File.join(dir, "*.gemspec")].each { |path|
|
269
269
|
spec = Gem::Specification.load path.untaint
|
270
270
|
# #load returns nil if the spec is bad, so we just ignore
|
271
271
|
# it at this stage
|
272
|
-
specs
|
272
|
+
specs[spec.full_name] ||= spec if spec
|
273
273
|
}
|
274
274
|
}
|
275
275
|
|
276
|
-
@@all = specs
|
276
|
+
@@all = specs.values
|
277
|
+
|
277
278
|
_resort!
|
278
279
|
end
|
279
280
|
@@all
|
@@ -537,7 +538,7 @@ class Gem::Specification
|
|
537
538
|
file = file.dup.untaint
|
538
539
|
|
539
540
|
code = if defined? Encoding
|
540
|
-
File.read file, :
|
541
|
+
File.read file, :mode => 'r:UTF-8:-'
|
541
542
|
else
|
542
543
|
File.read file
|
543
544
|
end
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -243,7 +243,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
243
243
|
##
|
244
244
|
# Builds and installs the Gem::Specification +spec+
|
245
245
|
|
246
|
-
def install_gem spec
|
246
|
+
def install_gem spec, options = {}
|
247
247
|
require 'rubygems/installer'
|
248
248
|
|
249
249
|
use_ui Gem::MockGemUi.new do
|
@@ -254,26 +254,14 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
254
254
|
|
255
255
|
gem = File.join(@tempdir, File.basename(spec.cache_file)).untaint
|
256
256
|
|
257
|
-
Gem::Installer.new(gem, :wrappers => true).install
|
257
|
+
Gem::Installer.new(gem, options.merge({:wrappers => true})).install
|
258
258
|
end
|
259
259
|
|
260
260
|
##
|
261
261
|
# Builds and installs the Gem::Specification +spec+ into the user dir
|
262
262
|
|
263
263
|
def install_gem_user spec
|
264
|
-
|
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
|
264
|
+
install_gem spec, :user_install => true
|
277
265
|
end
|
278
266
|
|
279
267
|
##
|
@@ -880,4 +868,3 @@ Also, a list:
|
|
880
868
|
end
|
881
869
|
|
882
870
|
end
|
883
|
-
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -629,8 +629,8 @@ class TestGem < Gem::TestCase
|
|
629
629
|
File.umask 0
|
630
630
|
Gem.ensure_gem_subdirectories @gemhome
|
631
631
|
|
632
|
-
assert_equal 0, File::Stat.new(@gemhome).mode &
|
633
|
-
assert_equal 0, File::Stat.new(File.join(@gemhome, "cache")).mode &
|
632
|
+
assert_equal 0, File::Stat.new(@gemhome).mode & 002
|
633
|
+
assert_equal 0, File::Stat.new(File.join(@gemhome, "cache")).mode & 002
|
634
634
|
ensure
|
635
635
|
File.umask old_umask
|
636
636
|
end unless win_platform?
|
@@ -1122,6 +1122,86 @@ class TestGem < Gem::TestCase
|
|
1122
1122
|
end
|
1123
1123
|
end
|
1124
1124
|
|
1125
|
+
def test_gem_path_ordering
|
1126
|
+
refute_equal Gem.dir, Gem.user_dir
|
1127
|
+
|
1128
|
+
write_file File.join(@tempdir, 'lib', "g.rb") { |fp| fp.puts "" }
|
1129
|
+
write_file File.join(@tempdir, 'lib', 'm.rb') { |fp| fp.puts "" }
|
1130
|
+
|
1131
|
+
g = new_spec 'g', '1', nil, "lib/g.rb"
|
1132
|
+
m = new_spec 'm', '1', nil, "lib/m.rb"
|
1133
|
+
|
1134
|
+
install_gem g, :install_dir => Gem.dir
|
1135
|
+
m0 = install_gem m, :install_dir => Gem.dir
|
1136
|
+
m1 = install_gem m, :install_dir => Gem.user_dir
|
1137
|
+
|
1138
|
+
assert_equal m0.gem_dir, File.join(Gem.dir, "gems", "m-1")
|
1139
|
+
assert_equal m1.gem_dir, File.join(Gem.user_dir, "gems", "m-1")
|
1140
|
+
|
1141
|
+
tests = [
|
1142
|
+
[:dir0, [ Gem.dir, Gem.user_dir], m0],
|
1143
|
+
[:dir1, [ Gem.user_dir, Gem.dir], m1]
|
1144
|
+
]
|
1145
|
+
|
1146
|
+
tests.each do |_name, _paths, expected|
|
1147
|
+
Gem.paths = { 'GEM_HOME' => _paths.first, 'GEM_PATH' => _paths }
|
1148
|
+
Gem::Specification.reset
|
1149
|
+
Gem.searcher = nil
|
1150
|
+
|
1151
|
+
assert_equal Gem::Dependency.new('m','1').to_specs,
|
1152
|
+
Gem::Dependency.new('m','1').to_specs.sort
|
1153
|
+
|
1154
|
+
assert_equal \
|
1155
|
+
[expected.gem_dir],
|
1156
|
+
Gem::Dependency.new('m','1').to_specs.map(&:gem_dir).sort,
|
1157
|
+
"Wrong specs for #{_name}"
|
1158
|
+
|
1159
|
+
spec = Gem::Dependency.new('m','1').to_spec
|
1160
|
+
|
1161
|
+
assert_equal \
|
1162
|
+
File.join(_paths.first, "gems", "m-1"),
|
1163
|
+
spec.gem_dir,
|
1164
|
+
"Wrong spec before require for #{_name}"
|
1165
|
+
refute spec.activated?, "dependency already activated for #{_name}"
|
1166
|
+
|
1167
|
+
gem "m"
|
1168
|
+
|
1169
|
+
spec = Gem::Dependency.new('m','1').to_spec
|
1170
|
+
assert spec.activated?, "dependency not activated for #{_name}"
|
1171
|
+
|
1172
|
+
assert_equal \
|
1173
|
+
File.join(_paths.first, "gems", "m-1"),
|
1174
|
+
spec.gem_dir,
|
1175
|
+
"Wrong spec after require for #{_name}"
|
1176
|
+
|
1177
|
+
spec.instance_variable_set :@activated, false
|
1178
|
+
Gem.loaded_specs.delete(spec.name)
|
1179
|
+
$:.delete(File.join(spec.gem_dir, "lib"))
|
1180
|
+
end
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
def test_gem_path_ordering_short
|
1184
|
+
write_file File.join(@tempdir, 'lib', "g.rb") { |fp| fp.puts "" }
|
1185
|
+
write_file File.join(@tempdir, 'lib', 'm.rb') { |fp| fp.puts "" }
|
1186
|
+
|
1187
|
+
g = new_spec 'g', '1', nil, "lib/g.rb"
|
1188
|
+
m = new_spec 'm', '1', nil, "lib/m.rb"
|
1189
|
+
|
1190
|
+
install_gem g, :install_dir => Gem.dir
|
1191
|
+
install_gem m, :install_dir => Gem.dir
|
1192
|
+
install_gem m, :install_dir => Gem.user_dir
|
1193
|
+
|
1194
|
+
Gem.paths = {
|
1195
|
+
'GEM_HOME' => Gem.dir,
|
1196
|
+
'GEM_PATH' => [ Gem.dir, Gem.user_dir]
|
1197
|
+
}
|
1198
|
+
|
1199
|
+
assert_equal \
|
1200
|
+
File.join(Gem.dir, "gems", "m-1"),
|
1201
|
+
Gem::Dependency.new('m','1').to_spec.gem_dir,
|
1202
|
+
"Wrong spec selected"
|
1203
|
+
end
|
1204
|
+
|
1125
1205
|
def with_plugin(path)
|
1126
1206
|
test_plugin_path = File.expand_path("test/rubygems/plugin/#{path}",
|
1127
1207
|
@@project_dir)
|
@@ -292,6 +292,29 @@ bindir:
|
|
292
292
|
assert_equal @a2, spec
|
293
293
|
end
|
294
294
|
|
295
|
+
if defined?(Encoding)
|
296
|
+
def test_self_load_utf8_with_ascii_encoding
|
297
|
+
int_enc = Encoding.default_internal
|
298
|
+
silence_warnings { Encoding.default_internal = 'US-ASCII' }
|
299
|
+
|
300
|
+
spec2 = @a2.dup
|
301
|
+
bin = "\u5678"
|
302
|
+
spec2.authors = [bin]
|
303
|
+
full_path = spec2.spec_file
|
304
|
+
write_file full_path do |io|
|
305
|
+
io.write spec2.to_ruby_for_cache.force_encoding('BINARY').sub("\\u{5678}", bin.force_encoding('BINARY'))
|
306
|
+
end
|
307
|
+
|
308
|
+
spec = Gem::Specification.load full_path
|
309
|
+
|
310
|
+
spec2.files.clear
|
311
|
+
|
312
|
+
assert_equal spec2, spec
|
313
|
+
ensure
|
314
|
+
silence_warnings { Encoding.default_internal = int_enc }
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
295
318
|
def test_self_load_legacy_ruby
|
296
319
|
spec = Gem::Deprecate.skip_during do
|
297
320
|
eval LEGACY_RUBY_SPEC
|
@@ -1577,4 +1600,11 @@ end
|
|
1577
1600
|
# ignore
|
1578
1601
|
end
|
1579
1602
|
end
|
1603
|
+
|
1604
|
+
def silence_warnings
|
1605
|
+
old_verbose, $VERBOSE = $VERBOSE, false
|
1606
|
+
yield
|
1607
|
+
ensure
|
1608
|
+
$VERBOSE = old_verbose
|
1609
|
+
end
|
1580
1610
|
end
|
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 1.8.
|
9
|
+
- 16
|
10
|
+
version: 1.8.16
|
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-
|
20
|
+
date: 2012-02-10 00:00:00 Z
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
23
23
|
name: minitest
|
@@ -399,7 +399,7 @@ post_install_message:
|
|
399
399
|
rdoc_options:
|
400
400
|
- --main
|
401
401
|
- README.rdoc
|
402
|
-
- --title=RubyGems 1.8.
|
402
|
+
- --title=RubyGems 1.8.16 Documentation
|
403
403
|
require_paths:
|
404
404
|
- hide_lib_for_update
|
405
405
|
required_ruby_version: !ruby/object:Gem::Requirement
|