rubygems-update 2.2.1 → 2.2.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.txt +29 -0
- data/Manifest.txt +1 -0
- data/lib/rubygems.rb +1 -1
- data/lib/rubygems/available_set.rb +3 -0
- data/lib/rubygems/commands/generate_index_command.rb +1 -1
- data/lib/rubygems/config_file.rb +3 -2
- data/lib/rubygems/dependency_installer.rb +1 -0
- data/lib/rubygems/ext/ext_conf_builder.rb +5 -1
- data/lib/rubygems/installer.rb +1 -1
- data/lib/rubygems/package/tar_header.rb +1 -1
- data/lib/rubygems/remote_fetcher.rb +24 -16
- data/lib/rubygems/request.rb +4 -4
- data/lib/rubygems/request_set.rb +8 -0
- data/lib/rubygems/resolver.rb +2 -0
- data/lib/rubygems/resolver/api_set.rb +6 -1
- data/lib/rubygems/resolver/best_set.rb +20 -1
- data/lib/rubygems/resolver/composed_set.rb +11 -0
- data/lib/rubygems/resolver/git_set.rb +3 -0
- data/lib/rubygems/resolver/index_set.rb +4 -0
- data/lib/rubygems/resolver/installer_set.rb +15 -1
- data/lib/rubygems/resolver/lock_set.rb +2 -0
- data/lib/rubygems/resolver/set.rb +17 -0
- data/lib/rubygems/resolver/vendor_set.rb +2 -0
- data/lib/rubygems/security.rb +3 -3
- data/lib/rubygems/source/git.rb +14 -0
- data/lib/rubygems/specification.rb +22 -22
- data/lib/rubygems/test_case.rb +29 -1
- data/lib/rubygems/version.rb +17 -11
- data/test/rubygems/test_gem.rb +28 -30
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +41 -27
- data/test/rubygems/test_gem_installer.rb +6 -2
- data/test/rubygems/test_gem_package_tar_header.rb +14 -0
- data/test/rubygems/test_gem_platform.rb +5 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +3 -3
- data/test/rubygems/test_gem_request.rb +69 -0
- data/test/rubygems/test_gem_request_set.rb +21 -0
- data/test/rubygems/test_gem_resolver.rb +8 -0
- data/test/rubygems/test_gem_resolver_api_set.rb +41 -0
- data/test/rubygems/test_gem_resolver_best_set.rb +50 -0
- data/test/rubygems/test_gem_resolver_composed_set.rb +18 -0
- data/test/rubygems/test_gem_resolver_git_set.rb +15 -0
- data/test/rubygems/test_gem_resolver_index_set.rb +35 -0
- data/test/rubygems/test_gem_resolver_installer_set.rb +70 -0
- data/test/rubygems/test_gem_source_git.rb +43 -0
- data/test/rubygems/test_gem_specification.rb +9 -12
- data/test/rubygems/test_gem_version.rb +10 -0
- metadata +5 -3
- metadata.gz.sig +0 -0
@@ -4,6 +4,15 @@
|
|
4
4
|
|
5
5
|
class Gem::Resolver::Set
|
6
6
|
|
7
|
+
##
|
8
|
+
# Set to true to disable network access for this set
|
9
|
+
|
10
|
+
attr_accessor :remote
|
11
|
+
|
12
|
+
def initialize # :nodoc:
|
13
|
+
@remote = true
|
14
|
+
end
|
15
|
+
|
7
16
|
##
|
8
17
|
# The find_all method must be implemented. It returns all Resolver
|
9
18
|
# Specification objects matching the given DependencyRequest +req+.
|
@@ -23,5 +32,13 @@ class Gem::Resolver::Set
|
|
23
32
|
def prefetch reqs
|
24
33
|
end
|
25
34
|
|
35
|
+
##
|
36
|
+
# When true, this set is allowed to access the network when looking up
|
37
|
+
# specifications or dependencies.
|
38
|
+
|
39
|
+
def remote? # :nodoc:
|
40
|
+
@remote
|
41
|
+
end
|
42
|
+
|
26
43
|
end
|
27
44
|
|
data/lib/rubygems/security.rb
CHANGED
@@ -120,11 +120,11 @@ end
|
|
120
120
|
# * HighSecurity - Here's the bugger that got us into this mess.
|
121
121
|
# The HighSecurity policy is identical to the MediumSecurity policy,
|
122
122
|
# except that it does not allow unsigned gems. A malicious user
|
123
|
-
# doesn't have a whole lot of options here;
|
124
|
-
# package contents without invalidating the signature, and
|
123
|
+
# doesn't have a whole lot of options here; they can't modify the
|
124
|
+
# package contents without invalidating the signature, and they can't
|
125
125
|
# modify or remove signature or the signing certificate chain, or
|
126
126
|
# RubyGems will simply refuse to install the package. Oh well, maybe
|
127
|
-
#
|
127
|
+
# they'll have better luck causing problems for CPAN users instead :).
|
128
128
|
#
|
129
129
|
# The reason RubyGems refused to install your shiny new signed gem was because
|
130
130
|
# it was from an untrusted source. Well, your code is infallible (naturally),
|
data/lib/rubygems/source/git.rb
CHANGED
@@ -23,6 +23,11 @@ class Gem::Source::Git < Gem::Source
|
|
23
23
|
|
24
24
|
attr_reader :reference
|
25
25
|
|
26
|
+
##
|
27
|
+
# When false the cache for this repository will not be updated.
|
28
|
+
|
29
|
+
attr_accessor :remote
|
30
|
+
|
26
31
|
##
|
27
32
|
# The git repository this gem is sourced from.
|
28
33
|
|
@@ -53,6 +58,7 @@ class Gem::Source::Git < Gem::Source
|
|
53
58
|
@reference = reference
|
54
59
|
@need_submodules = submodules
|
55
60
|
|
61
|
+
@remote = true
|
56
62
|
@root_dir = Gem.dir
|
57
63
|
@git = ENV['git'] || 'git'
|
58
64
|
end
|
@@ -85,6 +91,8 @@ class Gem::Source::Git < Gem::Source
|
|
85
91
|
def checkout # :nodoc:
|
86
92
|
cache
|
87
93
|
|
94
|
+
return false unless File.exist? repo_cache_dir
|
95
|
+
|
88
96
|
unless File.exist? install_dir then
|
89
97
|
system @git, 'clone', '--quiet', '--no-checkout',
|
90
98
|
repo_cache_dir, install_dir
|
@@ -107,6 +115,8 @@ class Gem::Source::Git < Gem::Source
|
|
107
115
|
# Creates a local cache repository for the git gem.
|
108
116
|
|
109
117
|
def cache # :nodoc:
|
118
|
+
return unless @remote
|
119
|
+
|
110
120
|
if File.exist? repo_cache_dir then
|
111
121
|
Dir.chdir repo_cache_dir do
|
112
122
|
system @git, 'fetch', '--quiet', '--force', '--tags',
|
@@ -142,6 +152,8 @@ class Gem::Source::Git < Gem::Source
|
|
142
152
|
# The directory where the git gem will be installed.
|
143
153
|
|
144
154
|
def install_dir # :nodoc:
|
155
|
+
return unless File.exist? repo_cache_dir
|
156
|
+
|
145
157
|
File.join base_dir, 'gems', "#{@name}-#{dir_shortref}"
|
146
158
|
end
|
147
159
|
|
@@ -177,6 +189,8 @@ class Gem::Source::Git < Gem::Source
|
|
177
189
|
def specs
|
178
190
|
checkout
|
179
191
|
|
192
|
+
return [] unless install_dir
|
193
|
+
|
180
194
|
Dir.chdir install_dir do
|
181
195
|
Dir['{,*,*/*}.gemspec'].map do |spec_file|
|
182
196
|
directory = File.dirname spec_file
|
@@ -240,6 +240,28 @@ class Gem::Specification < Gem::BasicSpecification
|
|
240
240
|
|
241
241
|
attr_reader :summary
|
242
242
|
|
243
|
+
##
|
244
|
+
# Singular writer for #authors
|
245
|
+
#
|
246
|
+
# Usage:
|
247
|
+
#
|
248
|
+
# spec.author = 'John Jones'
|
249
|
+
|
250
|
+
def author= o
|
251
|
+
self.authors = [o]
|
252
|
+
end
|
253
|
+
|
254
|
+
##
|
255
|
+
# Sets the list of authors, ensuring it is an array.
|
256
|
+
#
|
257
|
+
# Usage:
|
258
|
+
#
|
259
|
+
# spec.authors = ['John Jones', 'Mary Smith']
|
260
|
+
|
261
|
+
def authors= value
|
262
|
+
@authors = Array(value).flatten.grep(String)
|
263
|
+
end
|
264
|
+
|
243
265
|
##
|
244
266
|
# The platform this gem runs on.
|
245
267
|
#
|
@@ -442,28 +464,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
442
464
|
add_dependency_with_type(gem, :runtime, *requirements)
|
443
465
|
end
|
444
466
|
|
445
|
-
##
|
446
|
-
# Singular writer for #authors
|
447
|
-
#
|
448
|
-
# Usage:
|
449
|
-
#
|
450
|
-
# spec.author = 'John Jones'
|
451
|
-
|
452
|
-
def author= o
|
453
|
-
self.authors = [o]
|
454
|
-
end
|
455
|
-
|
456
|
-
##
|
457
|
-
# Sets the list of authors, ensuring it is an array.
|
458
|
-
#
|
459
|
-
# Usage:
|
460
|
-
#
|
461
|
-
# spec.authors = ['John Jones', 'Mary Smith']
|
462
|
-
|
463
|
-
def authors= value
|
464
|
-
@authors = Array(value).flatten.grep(String)
|
465
|
-
end
|
466
|
-
|
467
467
|
##
|
468
468
|
# Executables included in the gem.
|
469
469
|
#
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -115,6 +115,23 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
115
115
|
assert File.exist?(path), msg
|
116
116
|
end
|
117
117
|
|
118
|
+
##
|
119
|
+
# Sets the ENABLE_SHARED entry in RbConfig::CONFIG to +value+ and restores
|
120
|
+
# the original value when the block ends
|
121
|
+
|
122
|
+
def enable_shared value
|
123
|
+
enable_shared = RbConfig::CONFIG['ENABLE_SHARED']
|
124
|
+
RbConfig::CONFIG['ENABLE_SHARED'] = value
|
125
|
+
|
126
|
+
yield
|
127
|
+
ensure
|
128
|
+
if enable_shared then
|
129
|
+
RbConfig::CONFIG['enable_shared'] = enable_shared
|
130
|
+
else
|
131
|
+
RbConfig::CONFIG.delete 'enable_shared'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
118
135
|
# TODO: move to minitest
|
119
136
|
def refute_path_exists path, msg = nil
|
120
137
|
msg = message(msg) { "Expected path '#{path}' to not exist" }
|
@@ -315,7 +332,11 @@ class Gem::TestCase < MiniTest::Unit::TestCase
|
|
315
332
|
def teardown
|
316
333
|
$LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH
|
317
334
|
|
318
|
-
|
335
|
+
if @orig_BASERUBY
|
336
|
+
RbConfig::CONFIG['BASERUBY'] = @orig_BASERUBY
|
337
|
+
else
|
338
|
+
RbConfig::CONFIG.delete('BASERUBY')
|
339
|
+
end
|
319
340
|
RbConfig::CONFIG['arch'] = @orig_arch
|
320
341
|
|
321
342
|
if defined? Gem::RemoteFetcher then
|
@@ -1244,11 +1265,18 @@ Also, a list:
|
|
1244
1265
|
|
1245
1266
|
class StaticSet
|
1246
1267
|
|
1268
|
+
##
|
1269
|
+
# A StaticSet ignores remote because it has a fixed set of gems.
|
1270
|
+
|
1271
|
+
attr_accessor :remote
|
1272
|
+
|
1247
1273
|
##
|
1248
1274
|
# Creates a new StaticSet for the given +specs+
|
1249
1275
|
|
1250
1276
|
def initialize(specs)
|
1251
1277
|
@specs = specs
|
1278
|
+
|
1279
|
+
@remote = true
|
1252
1280
|
end
|
1253
1281
|
|
1254
1282
|
##
|
data/lib/rubygems/version.rb
CHANGED
@@ -22,6 +22,11 @@
|
|
22
22
|
# 3. 1.0.a.2
|
23
23
|
# 4. 0.9
|
24
24
|
#
|
25
|
+
# If you want to specify a version restriction that includes both prereleases
|
26
|
+
# and regular releases of the 1.x series this is the best way:
|
27
|
+
#
|
28
|
+
# s.add_dependency 'example', '>= 1.0.0.a', '< 2.0.0'
|
29
|
+
#
|
25
30
|
# == How Software Changes
|
26
31
|
#
|
27
32
|
# Users expect to be able to specify a version constraint that gives them
|
@@ -81,8 +86,8 @@
|
|
81
86
|
#
|
82
87
|
# * Any "public" release of a gem should have a different version. Normally
|
83
88
|
# that means incrementing the build number. This means a developer can
|
84
|
-
# generate builds all day long
|
85
|
-
#
|
89
|
+
# generate builds all day long, but as soon as they make a public release,
|
90
|
+
# the version must be updated.
|
86
91
|
#
|
87
92
|
# === Examples
|
88
93
|
#
|
@@ -99,26 +104,25 @@
|
|
99
104
|
# Version 1.1.1:: Fixed a bug in the linked list implementation.
|
100
105
|
# Version 1.1.2:: Fixed a bug introduced in the last fix.
|
101
106
|
#
|
102
|
-
# Client A needs a stack with basic push/pop capability.
|
103
|
-
# original interface (no <tt>top</tt>), so
|
104
|
-
# like:
|
107
|
+
# Client A needs a stack with basic push/pop capability. They write to the
|
108
|
+
# original interface (no <tt>top</tt>), so their version constraint looks like:
|
105
109
|
#
|
106
110
|
# gem 'stack', '~> 0.0'
|
107
111
|
#
|
108
112
|
# Essentially, any version is OK with Client A. An incompatible change to
|
109
|
-
# the library will cause
|
110
|
-
# call Client A optimistic).
|
113
|
+
# the library will cause them grief, but they are willing to take the chance
|
114
|
+
# (we call Client A optimistic).
|
111
115
|
#
|
112
|
-
# Client B is just like Client A except for two things: (1)
|
113
|
-
# <tt>depth</tt> method and (2)
|
114
|
-
# incompatibilities, so
|
116
|
+
# Client B is just like Client A except for two things: (1) They use the
|
117
|
+
# <tt>depth</tt> method and (2) they are worried about future
|
118
|
+
# incompatibilities, so they write their version constraint like this:
|
115
119
|
#
|
116
120
|
# gem 'stack', '~> 0.1'
|
117
121
|
#
|
118
122
|
# The <tt>depth</tt> method was introduced in version 0.1.0, so that version
|
119
123
|
# or anything later is fine, as long as the version stays below version 1.0
|
120
124
|
# where incompatibilities are introduced. We call Client B pessimistic
|
121
|
-
# because
|
125
|
+
# because they are worried about incompatible future changes (it is OK to be
|
122
126
|
# pessimistic!).
|
123
127
|
#
|
124
128
|
# == Preventing Version Catastrophe:
|
@@ -185,6 +189,8 @@ class Gem::Version
|
|
185
189
|
@@all = {}
|
186
190
|
|
187
191
|
def self.new version # :nodoc:
|
192
|
+
return super unless Gem::VERSION == self.class
|
193
|
+
|
188
194
|
@@all[version] ||= super
|
189
195
|
end
|
190
196
|
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -199,30 +199,21 @@ class TestGem < Gem::TestCase
|
|
199
199
|
end
|
200
200
|
|
201
201
|
def test_self_default_exec_format
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
assert_equal '%s', Gem.default_exec_format
|
206
|
-
ensure
|
207
|
-
RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
|
202
|
+
ruby_install_name 'ruby' do
|
203
|
+
assert_equal '%s', Gem.default_exec_format
|
204
|
+
end
|
208
205
|
end
|
209
206
|
|
210
207
|
def test_self_default_exec_format_18
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
assert_equal '%s18', Gem.default_exec_format
|
215
|
-
ensure
|
216
|
-
RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
|
208
|
+
ruby_install_name 'ruby18' do
|
209
|
+
assert_equal '%s18', Gem.default_exec_format
|
210
|
+
end
|
217
211
|
end
|
218
212
|
|
219
213
|
def test_self_default_exec_format_jruby
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
assert_equal 'j%s', Gem.default_exec_format
|
224
|
-
ensure
|
225
|
-
RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
|
214
|
+
ruby_install_name 'jruby' do
|
215
|
+
assert_equal 'j%s', Gem.default_exec_format
|
216
|
+
end
|
226
217
|
end
|
227
218
|
|
228
219
|
def test_self_default_sources
|
@@ -340,21 +331,15 @@ class TestGem < Gem::TestCase
|
|
340
331
|
end
|
341
332
|
|
342
333
|
def test_self_extension_dir_shared
|
343
|
-
enable_shared
|
344
|
-
|
345
|
-
|
346
|
-
assert_equal Gem.ruby_api_version, Gem.extension_api_version
|
347
|
-
ensure
|
348
|
-
RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
|
334
|
+
enable_shared 'yes' do
|
335
|
+
assert_equal Gem.ruby_api_version, Gem.extension_api_version
|
336
|
+
end
|
349
337
|
end
|
350
338
|
|
351
339
|
def test_self_extension_dir_static
|
352
|
-
enable_shared
|
353
|
-
|
354
|
-
|
355
|
-
assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
|
356
|
-
ensure
|
357
|
-
RbConfig::CONFIG['ENABLE_SHARED'] = enable_shared
|
340
|
+
enable_shared 'no' do
|
341
|
+
assert_equal "#{Gem.ruby_api_version}-static", Gem.extension_api_version
|
342
|
+
end
|
358
343
|
end
|
359
344
|
|
360
345
|
def test_self_find_files
|
@@ -1339,6 +1324,19 @@ class TestGem < Gem::TestCase
|
|
1339
1324
|
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
1340
1325
|
end
|
1341
1326
|
|
1327
|
+
def ruby_install_name name
|
1328
|
+
orig_RUBY_INSTALL_NAME = RbConfig::CONFIG['ruby_install_name']
|
1329
|
+
RbConfig::CONFIG['ruby_install_name'] = name
|
1330
|
+
|
1331
|
+
yield
|
1332
|
+
ensure
|
1333
|
+
if orig_RUBY_INSTALL_NAME then
|
1334
|
+
RbConfig::CONFIG['ruby_install_name'] = orig_RUBY_INSTALL_NAME
|
1335
|
+
else
|
1336
|
+
RbConfig::CONFIG.delete 'ruby_install_name'
|
1337
|
+
end
|
1338
|
+
end
|
1339
|
+
|
1342
1340
|
def with_plugin(path)
|
1343
1341
|
test_plugin_path = File.expand_path("test/rubygems/plugin/#{path}",
|
1344
1342
|
@@project_dir)
|
@@ -42,47 +42,46 @@ class TestGemExtExtConfBuilder < Gem::TestCase
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_class_build_rbconfig_make_prog
|
45
|
-
configure_args
|
45
|
+
configure_args do
|
46
46
|
|
47
|
-
|
48
|
-
|
49
|
-
|
47
|
+
File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
|
48
|
+
extconf.puts "require 'mkmf'\ncreate_makefile 'foo'"
|
49
|
+
end
|
50
50
|
|
51
|
-
|
51
|
+
output = []
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
53
|
+
Dir.chdir @ext do
|
54
|
+
Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
|
55
|
+
end
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
RbConfig::CONFIG['configure_args'] = configure_args
|
57
|
+
assert_equal "creating Makefile\n", output[1]
|
58
|
+
assert_contains_make_command 'clean', output[2]
|
59
|
+
assert_contains_make_command '', output[4]
|
60
|
+
assert_contains_make_command 'install', output[6]
|
61
|
+
end
|
63
62
|
end
|
64
63
|
|
65
64
|
def test_class_build_env_make
|
66
|
-
|
67
|
-
RbConfig::CONFIG['configure_args'] = ''
|
65
|
+
env_make = ENV.delete 'make'
|
68
66
|
ENV['make'] = 'anothermake'
|
69
67
|
|
70
|
-
|
71
|
-
|
72
|
-
|
68
|
+
configure_args '' do
|
69
|
+
File.open File.join(@ext, 'extconf.rb'), 'w' do |extconf|
|
70
|
+
extconf.puts "require 'mkmf'\ncreate_makefile 'foo'"
|
71
|
+
end
|
73
72
|
|
74
|
-
|
73
|
+
output = []
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
|
75
|
+
assert_raises Gem::InstallError do
|
76
|
+
Dir.chdir @ext do
|
77
|
+
Gem::Ext::ExtConfBuilder.build 'extconf.rb', nil, @dest_path, output
|
78
|
+
end
|
79
79
|
end
|
80
|
-
end
|
81
80
|
|
82
|
-
|
83
|
-
|
81
|
+
assert_equal "creating Makefile\n", output[1]
|
82
|
+
assert_contains_make_command 'clean', output[2]
|
83
|
+
end
|
84
84
|
ensure
|
85
|
-
RbConfig::CONFIG['configure_args'] = configure_args
|
86
85
|
ENV['make'] = env_make
|
87
86
|
end
|
88
87
|
|
@@ -108,6 +107,7 @@ class TestGemExtExtConfBuilder < Gem::TestCase
|
|
108
107
|
assert_equal 'extconf failed, exit code 1', error.message
|
109
108
|
|
110
109
|
assert_equal("#{Gem.ruby} extconf.rb", output[0])
|
110
|
+
assert_path_exists File.join @dest_path, 'mkmf.log'
|
111
111
|
end
|
112
112
|
|
113
113
|
def test_class_build_unconventional
|
@@ -188,5 +188,19 @@ end
|
|
188
188
|
assert_equal 'Makefile not found', error.message
|
189
189
|
end
|
190
190
|
|
191
|
+
def configure_args args = nil
|
192
|
+
configure_args = RbConfig::CONFIG['configure_args']
|
193
|
+
RbConfig::CONFIG['configure_args'] = args if args
|
194
|
+
|
195
|
+
yield
|
196
|
+
|
197
|
+
ensure
|
198
|
+
if configure_args then
|
199
|
+
RbConfig::CONFIG['configure_args'] = configure_args
|
200
|
+
else
|
201
|
+
RbConfig::CONFIG.delete 'configure_args'
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
191
205
|
end
|
192
206
|
|