rubygems-update 2.4.5 → 2.4.6
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
- data/History.txt +27 -0
- data/Manifest.txt +4 -0
- data/lib/rubygems.rb +2 -2
- data/lib/rubygems/basic_specification.rb +2 -3
- data/lib/rubygems/commands/help_command.rb +2 -2
- data/lib/rubygems/commands/open_command.rb +3 -1
- data/lib/rubygems/commands/yank_command.rb +1 -1
- data/lib/rubygems/compatibility.rb +1 -2
- data/lib/rubygems/dependency_installer.rb +11 -1
- data/lib/rubygems/installer.rb +1 -1
- data/lib/rubygems/package.rb +2 -1
- data/lib/rubygems/package/tar_writer.rb +4 -4
- data/lib/rubygems/path_support.rb +0 -7
- data/lib/rubygems/psych_additions.rb +1 -1
- data/lib/rubygems/remote_fetcher.rb +1 -1
- data/lib/rubygems/request_set.rb +10 -4
- data/lib/rubygems/request_set/gem_dependency_api.rb +4 -4
- data/lib/rubygems/request_set/lockfile.rb +52 -464
- data/lib/rubygems/request_set/lockfile/parser.rb +334 -0
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +108 -0
- data/lib/rubygems/requirement.rb +12 -1
- data/lib/rubygems/security/signer.rb +1 -1
- data/lib/rubygems/specification.rb +12 -12
- data/lib/rubygems/test_case.rb +18 -1
- data/lib/rubygems/user_interaction.rb +0 -8
- data/test/rubygems/test_gem.rb +2 -5
- data/test/rubygems/test_gem_commands_open_command.rb +9 -3
- data/test/rubygems/test_gem_commands_pristine_command.rb +2 -2
- data/test/rubygems/test_gem_commands_unpack_command.rb +2 -2
- data/test/rubygems/test_gem_dependency_installer.rb +27 -1
- data/test/rubygems/test_gem_ext_cmake_builder.rb +1 -1
- data/test/rubygems/test_gem_installer.rb +1 -1
- data/test/rubygems/test_gem_package.rb +1 -1
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +30 -11
- data/test/rubygems/test_gem_request_set_lockfile.rb +19 -824
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +543 -0
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +305 -0
- data/test/rubygems/test_gem_requirement.rb +10 -0
- data/test/rubygems/test_gem_specification.rb +7 -1
- data/test/rubygems/test_gem_stub_specification.rb +1 -1
- data/test/rubygems/test_gem_uninstaller.rb +2 -2
- metadata +8 -2
@@ -122,7 +122,7 @@ class Gem::Security::Signer
|
|
122
122
|
# ~/.gem/gem-public_cert.pem.expired.%Y%m%d%H%M%S
|
123
123
|
#
|
124
124
|
# If the signing certificate can be re-signed the expired certificate will
|
125
|
-
# be saved as ~/.gem/gem-
|
125
|
+
# be saved as ~/.gem/gem-public_cert.pem.expired.%Y%m%d%H%M%S where the
|
126
126
|
# expiry time (not after) is used for the timestamp.
|
127
127
|
|
128
128
|
def re_sign_key # :nodoc:
|
@@ -1028,8 +1028,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1028
1028
|
file = file.dup.untaint
|
1029
1029
|
return unless File.file?(file)
|
1030
1030
|
|
1031
|
-
|
1032
|
-
return
|
1031
|
+
_spec = LOAD_CACHE[file]
|
1032
|
+
return _spec if _spec
|
1033
1033
|
|
1034
1034
|
code = if defined? Encoding
|
1035
1035
|
File.read file, :mode => 'r:UTF-8:-'
|
@@ -1040,15 +1040,15 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1040
1040
|
code.untaint
|
1041
1041
|
|
1042
1042
|
begin
|
1043
|
-
|
1043
|
+
_spec = eval code, binding, file
|
1044
1044
|
|
1045
|
-
if Gem::Specification ===
|
1046
|
-
|
1047
|
-
LOAD_CACHE[file] =
|
1048
|
-
return
|
1045
|
+
if Gem::Specification === _spec
|
1046
|
+
_spec.loaded_from = File.expand_path file.to_s
|
1047
|
+
LOAD_CACHE[file] = _spec
|
1048
|
+
return _spec
|
1049
1049
|
end
|
1050
1050
|
|
1051
|
-
warn "[#{file}] isn't a Gem::Specification (#{
|
1051
|
+
warn "[#{file}] isn't a Gem::Specification (#{_spec.class} instead)."
|
1052
1052
|
rescue SignalException, SystemExit
|
1053
1053
|
raise
|
1054
1054
|
rescue SyntaxError, Exception => e
|
@@ -1350,7 +1350,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1350
1350
|
end
|
1351
1351
|
|
1352
1352
|
unless dependency.respond_to?(:name) &&
|
1353
|
-
dependency.respond_to?(:
|
1353
|
+
dependency.respond_to?(:requirement)
|
1354
1354
|
dependency = Gem::Dependency.new(dependency.to_s, requirements, type)
|
1355
1355
|
end
|
1356
1356
|
|
@@ -1932,7 +1932,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1932
1932
|
# Singular accessor for #licenses
|
1933
1933
|
|
1934
1934
|
def license
|
1935
|
-
|
1935
|
+
licenses.first
|
1936
1936
|
end
|
1937
1937
|
|
1938
1938
|
##
|
@@ -2456,8 +2456,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2456
2456
|
extend Gem::UserInteraction
|
2457
2457
|
normalize
|
2458
2458
|
|
2459
|
-
nil_attributes = self.class.non_nil_attributes.find_all do |
|
2460
|
-
instance_variable_get("@#{
|
2459
|
+
nil_attributes = self.class.non_nil_attributes.find_all do |attrname|
|
2460
|
+
instance_variable_get("@#{attrname}").nil?
|
2461
2461
|
end
|
2462
2462
|
|
2463
2463
|
unless nil_attributes.empty? then
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -1426,5 +1426,22 @@ Also, a list:
|
|
1426
1426
|
|
1427
1427
|
end
|
1428
1428
|
|
1429
|
-
require
|
1429
|
+
# require dependencies that are not discoverable once GEM_HOME and GEM_PATH
|
1430
|
+
# are wiped
|
1431
|
+
begin
|
1432
|
+
gem 'rake'
|
1433
|
+
rescue Gem::LoadError
|
1434
|
+
end
|
1435
|
+
|
1436
|
+
require 'rake/packagetask'
|
1430
1437
|
|
1438
|
+
begin
|
1439
|
+
gem 'rdoc'
|
1440
|
+
require 'rdoc'
|
1441
|
+
rescue LoadError, Gem::LoadError
|
1442
|
+
end
|
1443
|
+
|
1444
|
+
require 'rubygems/test_utilities'
|
1445
|
+
ENV['GEM_HOME'] = Dir.mktmpdir "home"
|
1446
|
+
ENV['GEM_PATH'] = Dir.mktmpdir "path"
|
1447
|
+
Gem.clear_paths
|
@@ -396,10 +396,6 @@ class Gem::StreamUI
|
|
396
396
|
# Return a progress reporter object chosen from the current verbosity.
|
397
397
|
|
398
398
|
def progress_reporter(*args)
|
399
|
-
if self.kind_of?(Gem::SilentUI)
|
400
|
-
return SilentProgressReporter.new(@outs, *args)
|
401
|
-
end
|
402
|
-
|
403
399
|
case Gem.configuration.verbose
|
404
400
|
when nil, false
|
405
401
|
SilentProgressReporter.new(@outs, *args)
|
@@ -533,10 +529,6 @@ class Gem::StreamUI
|
|
533
529
|
# Return a download reporter object chosen from the current verbosity
|
534
530
|
|
535
531
|
def download_reporter(*args)
|
536
|
-
if self.kind_of?(Gem::SilentUI)
|
537
|
-
return SilentDownloadReporter.new(@outs, *args)
|
538
|
-
end
|
539
|
-
|
540
532
|
case Gem.configuration.verbose
|
541
533
|
when nil, false
|
542
534
|
SilentDownloadReporter.new(@outs, *args)
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -1145,7 +1145,7 @@ class TestGem < Gem::TestCase
|
|
1145
1145
|
]
|
1146
1146
|
|
1147
1147
|
tests.each do |_name, _paths, expected|
|
1148
|
-
Gem.
|
1148
|
+
Gem.use_paths _paths.first, _paths
|
1149
1149
|
Gem::Specification.reset
|
1150
1150
|
Gem.searcher = nil
|
1151
1151
|
|
@@ -1192,10 +1192,7 @@ class TestGem < Gem::TestCase
|
|
1192
1192
|
install_gem m, :install_dir => Gem.dir
|
1193
1193
|
install_gem m, :install_dir => Gem.user_dir
|
1194
1194
|
|
1195
|
-
Gem.
|
1196
|
-
'GEM_HOME' => Gem.dir,
|
1197
|
-
'GEM_PATH' => [ Gem.dir, Gem.user_dir]
|
1198
|
-
}
|
1195
|
+
Gem.use_paths Gem.dir, [ Gem.dir, Gem.user_dir]
|
1199
1196
|
|
1200
1197
|
assert_equal \
|
1201
1198
|
File.join(Gem.dir, "gems", "m-1"),
|
@@ -15,18 +15,24 @@ class TestGemCommandsOpenCommand < Gem::TestCase
|
|
15
15
|
end
|
16
16
|
write_file File.join(*%W[gems #{spec.full_name} lib #{name}.rb])
|
17
17
|
write_file File.join(*%W[gems #{spec.full_name} Rakefile])
|
18
|
+
spec
|
18
19
|
end
|
19
20
|
|
20
21
|
def test_execute
|
21
22
|
@cmd.options[:args] = %w[foo]
|
22
23
|
@cmd.options[:editor] = "#{Gem.ruby} -e0 --"
|
23
24
|
|
24
|
-
gem 'foo'
|
25
|
+
spec = gem 'foo'
|
26
|
+
mock = MiniTest::Mock.new
|
27
|
+
mock.expect(:call, true, [spec.full_gem_path])
|
25
28
|
|
26
|
-
|
27
|
-
@
|
29
|
+
Dir.stub(:chdir, mock) do
|
30
|
+
use_ui @ui do
|
31
|
+
@cmd.execute
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
35
|
+
assert mock.verify
|
30
36
|
assert_equal "", @ui.error
|
31
37
|
end
|
32
38
|
|
@@ -231,7 +231,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
231
231
|
|
232
232
|
Gem.clear_paths
|
233
233
|
gemhome2 = File.join @tempdir, 'gemhome2'
|
234
|
-
Gem.
|
234
|
+
Gem.use_paths gemhome2, [gemhome2, @gemhome]
|
235
235
|
|
236
236
|
b = util_spec 'b'
|
237
237
|
install_gem b
|
@@ -301,7 +301,7 @@ class TestGemCommandsPristineCommand < Gem::TestCase
|
|
301
301
|
|
302
302
|
Gem.clear_paths
|
303
303
|
gemhome2 = File.join(@tempdir, 'gemhome2')
|
304
|
-
Gem.
|
304
|
+
Gem.use_paths gemhome2, [gemhome2, @gemhome]
|
305
305
|
|
306
306
|
install_gem specs["b-1"]
|
307
307
|
FileUtils.rm File.join(gemhome2, 'cache', 'b-1.gem')
|
@@ -66,7 +66,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
|
|
66
66
|
|
67
67
|
gemhome2 = File.join @tempdir, 'gemhome2'
|
68
68
|
|
69
|
-
Gem.
|
69
|
+
Gem.use_paths gemhome2, [gemhome2, @gemhome]
|
70
70
|
|
71
71
|
@cmd.options[:args] = %w[a]
|
72
72
|
|
@@ -86,7 +86,7 @@ class TestGemCommandsUnpackCommand < Gem::TestCase
|
|
86
86
|
|
87
87
|
gemhome2 = File.join @tempdir, 'gemhome2'
|
88
88
|
|
89
|
-
Gem.
|
89
|
+
Gem.use_paths gemhome2, [gemhome2, @gemhome]
|
90
90
|
|
91
91
|
@cmd.options[:args] = %w[z]
|
92
92
|
|
@@ -14,6 +14,14 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
14
14
|
FileUtils.mkdir @gems_dir
|
15
15
|
|
16
16
|
Gem::RemoteFetcher.fetcher = @fetcher = Gem::FakeFetcher.new
|
17
|
+
|
18
|
+
@original_platforms = Gem.platforms
|
19
|
+
Gem.platforms = []
|
20
|
+
end
|
21
|
+
|
22
|
+
def teardown
|
23
|
+
Gem.platforms = @original_platforms
|
24
|
+
super
|
17
25
|
end
|
18
26
|
|
19
27
|
def util_setup_gems
|
@@ -272,7 +280,7 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
272
280
|
# This asserts that if a gem's dependency is satisfied by an
|
273
281
|
# already installed gem, RubyGems doesn't installed a newer
|
274
282
|
# version
|
275
|
-
def
|
283
|
+
def test_install_doesnt_upgrade_installed_dependencies
|
276
284
|
util_setup_gems
|
277
285
|
|
278
286
|
a2, a2_gem = util_gem 'a', '2'
|
@@ -1084,6 +1092,24 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
1084
1092
|
assert_equal [@a1_pre, @a1], prereleases
|
1085
1093
|
end
|
1086
1094
|
|
1095
|
+
def test_find_gems_with_sources_with_best_only_and_platform
|
1096
|
+
util_setup_gems
|
1097
|
+
a1_x86_mingw32, = util_gem 'a', '1' do |s|
|
1098
|
+
s.platform = 'x86-mingw32'
|
1099
|
+
end
|
1100
|
+
util_setup_spec_fetcher @a1, a1_x86_mingw32
|
1101
|
+
Gem.platforms << Gem::Platform.new('x86-mingw32')
|
1102
|
+
|
1103
|
+
installer = Gem::DependencyInstaller.new
|
1104
|
+
|
1105
|
+
dependency = Gem::Dependency.new('a', Gem::Requirement.default)
|
1106
|
+
|
1107
|
+
releases =
|
1108
|
+
installer.find_gems_with_sources(dependency, true).all_specs
|
1109
|
+
|
1110
|
+
assert_equal [a1_x86_mingw32], releases
|
1111
|
+
end
|
1112
|
+
|
1087
1113
|
def test_find_gems_with_sources_with_bad_source
|
1088
1114
|
Gem.sources.replace ["http://not-there.nothing"]
|
1089
1115
|
|
@@ -20,7 +20,7 @@ class TestGemExtCmakeBuilder < Gem::TestCase
|
|
20
20
|
def test_self_build
|
21
21
|
File.open File.join(@ext, 'CMakeLists.txt'), 'w' do |cmakelists|
|
22
22
|
cmakelists.write <<-eo_cmake
|
23
|
-
cmake_minimum_required(VERSION 2.
|
23
|
+
cmake_minimum_required(VERSION 2.6)
|
24
24
|
install (FILES test.txt DESTINATION bin)
|
25
25
|
eo_cmake
|
26
26
|
end
|
@@ -298,7 +298,7 @@ class TestGemPackage < Gem::Package::TarTestCase
|
|
298
298
|
assert_equal %w[lib/code.rb], reader.contents
|
299
299
|
end
|
300
300
|
|
301
|
-
def
|
301
|
+
def test_build_signed_encrypted_key
|
302
302
|
skip 'openssl is missing' unless defined?(OpenSSL::SSL)
|
303
303
|
|
304
304
|
spec = Gem::Specification.new 'build', '1'
|
@@ -50,6 +50,25 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
50
50
|
Gem.instance_variables.include? :@ruby_version
|
51
51
|
end
|
52
52
|
|
53
|
+
def test_gempspec_with_multiple_runtime_deps
|
54
|
+
gda = Class.new(@GDA) do
|
55
|
+
# implement find_gemspec so we don't need one on the FS
|
56
|
+
def find_gemspec name, path
|
57
|
+
Gem::Specification.new do |s|
|
58
|
+
s.name = 'foo'
|
59
|
+
s.version = '1.0'
|
60
|
+
s.add_runtime_dependency 'bar', '>= 1.6.0', '< 1.6.4'
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
instance = gda.new @set, __FILE__
|
65
|
+
instance.gemspec
|
66
|
+
assert_equal %w{ foo bar }.sort, @set.dependencies.map(&:name).sort
|
67
|
+
bar = @set.dependencies.find { |d| d.name == 'bar' }
|
68
|
+
assert_equal [[">=", Gem::Version.create('1.6.0')],
|
69
|
+
["<", Gem::Version.create('1.6.4')]], bar.requirement.requirements
|
70
|
+
end
|
71
|
+
|
53
72
|
def test_gemspec_without_group
|
54
73
|
@gda.send :add_dependencies, [:development], [dep('a', '= 1')]
|
55
74
|
|
@@ -69,7 +88,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
69
88
|
|
70
89
|
assert_equal %w[a], @gda.requires['a']
|
71
90
|
|
72
|
-
expected = { 'a' =>
|
91
|
+
expected = { 'a' => Gem::Requirement.default }
|
73
92
|
|
74
93
|
assert_equal expected, @gda.dependencies
|
75
94
|
end
|
@@ -93,7 +112,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
93
112
|
|
94
113
|
assert_equal %w[git/a master], @git_set.repositories['a']
|
95
114
|
|
96
|
-
expected = { 'a' => '!' }
|
115
|
+
expected = { 'a' => Gem::Requirement.create('!') }
|
97
116
|
|
98
117
|
assert_equal expected, @gda.dependencies
|
99
118
|
end
|
@@ -106,7 +125,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
106
125
|
assert_equal %w[https://example@bitbucket.org/example/repository.git master],
|
107
126
|
@git_set.repositories['a']
|
108
127
|
|
109
|
-
expected = { 'a' => '!' }
|
128
|
+
expected = { 'a' => Gem::Requirement.create('!') }
|
110
129
|
|
111
130
|
assert_equal expected, @gda.dependencies
|
112
131
|
end
|
@@ -119,7 +138,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
119
138
|
assert_equal %w[https://example@bitbucket.org/example/example.git master],
|
120
139
|
@git_set.repositories['a']
|
121
140
|
|
122
|
-
expected = { 'a' => '!' }
|
141
|
+
expected = { 'a' => Gem::Requirement.create('!') }
|
123
142
|
|
124
143
|
assert_equal expected, @gda.dependencies
|
125
144
|
end
|
@@ -174,7 +193,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
174
193
|
assert_equal %w[git://github.com/example/repository.git master],
|
175
194
|
@git_set.repositories['a']
|
176
195
|
|
177
|
-
expected = { 'a' => '!' }
|
196
|
+
expected = { 'a' => Gem::Requirement.create('!') }
|
178
197
|
|
179
198
|
assert_equal expected, @gda.dependencies
|
180
199
|
end
|
@@ -187,7 +206,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
187
206
|
assert_equal %w[git://github.com/example/example.git master],
|
188
207
|
@git_set.repositories['a']
|
189
208
|
|
190
|
-
expected = { 'a' => '!' }
|
209
|
+
expected = { 'a' => Gem::Requirement.create('!') }
|
191
210
|
|
192
211
|
assert_equal expected, @gda.dependencies
|
193
212
|
end
|
@@ -205,7 +224,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
205
224
|
|
206
225
|
assert_empty @set.dependencies
|
207
226
|
|
208
|
-
expected = { 'a' =>
|
227
|
+
expected = { 'a' => Gem::Requirement.default }
|
209
228
|
|
210
229
|
assert_equal expected, @gda.dependencies
|
211
230
|
end
|
@@ -227,7 +246,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
227
246
|
|
228
247
|
assert_equal "#{name}-#{version}", loaded.full_name
|
229
248
|
|
230
|
-
expected = { name => '!' }
|
249
|
+
expected = { name => Gem::Requirement.create('!') }
|
231
250
|
|
232
251
|
assert_equal expected, @gda.dependencies
|
233
252
|
end
|
@@ -386,7 +405,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
386
405
|
|
387
406
|
assert_equal [dep('a', '~> 1.0')], @set.dependencies
|
388
407
|
|
389
|
-
expected = { 'a' => ['~> 1.0'] }
|
408
|
+
expected = { 'a' => Gem::Requirement.create(['~> 1.0']) }
|
390
409
|
|
391
410
|
assert_equal expected, @gda.dependencies
|
392
411
|
end
|
@@ -396,7 +415,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
396
415
|
|
397
416
|
assert_equal [dep('b', '~> 1.0', '>= 1.0.2')], @set.dependencies
|
398
417
|
|
399
|
-
expected = { 'b' => ['~> 1.0', '>= 1.0.2'] }
|
418
|
+
expected = { 'b' => Gem::Requirement.create(['~> 1.0', '>= 1.0.2']) }
|
400
419
|
|
401
420
|
assert_equal expected, @gda.dependencies
|
402
421
|
end
|
@@ -466,7 +485,7 @@ class TestGemRequestSetGemDependencyAPI < Gem::TestCase
|
|
466
485
|
assert_equal %w[a], @gda.requires['a']
|
467
486
|
|
468
487
|
expected = {
|
469
|
-
'a' => '!',
|
488
|
+
'a' => Gem::Requirement.create('!'),
|
470
489
|
'b' => req('= 2'),
|
471
490
|
'c' => req('= 3'),
|
472
491
|
}
|
@@ -21,13 +21,10 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|
21
21
|
|
22
22
|
@gem_deps_file = 'gem.deps.rb'
|
23
23
|
|
24
|
-
@lockfile = Gem::RequestSet::Lockfile.new @set, @gem_deps_file
|
25
24
|
end
|
26
25
|
|
27
|
-
def
|
28
|
-
|
29
|
-
io.write gem_deps
|
30
|
-
end
|
26
|
+
def lockfile
|
27
|
+
Gem::RequestSet::Lockfile.build @set, @gem_deps_file
|
31
28
|
end
|
32
29
|
|
33
30
|
def write_lockfile lockfile
|
@@ -47,11 +44,10 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|
47
44
|
|
48
45
|
@set.gem 'a'
|
49
46
|
@set.resolve
|
50
|
-
@lockfile.instance_variable_set :@requests, @set.sorted_requests
|
51
47
|
|
52
48
|
out = []
|
53
49
|
|
54
|
-
|
50
|
+
lockfile.add_DEPENDENCIES out
|
55
51
|
|
56
52
|
expected = [
|
57
53
|
'DEPENDENCIES',
|
@@ -69,13 +65,12 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|
69
65
|
end
|
70
66
|
end
|
71
67
|
|
72
|
-
dependencies = { 'a' => '~> 2.0' }
|
68
|
+
dependencies = { 'a' => Gem::Requirement.new('~> 2.0') }
|
73
69
|
|
74
70
|
@set.gem 'a'
|
75
71
|
@set.resolve
|
76
72
|
@lockfile =
|
77
73
|
Gem::RequestSet::Lockfile.new @set, @gem_deps_file, dependencies
|
78
|
-
@lockfile.instance_variable_set :@requests, @set.sorted_requests
|
79
74
|
|
80
75
|
out = []
|
81
76
|
|
@@ -105,17 +100,10 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|
105
100
|
@set.gem 'a'
|
106
101
|
@set.gem 'bundler'
|
107
102
|
@set.resolve
|
108
|
-
@lockfile.instance_variable_set :@requests, @set.sorted_requests
|
109
|
-
|
110
|
-
spec_groups = @set.sorted_requests.group_by do |request|
|
111
|
-
request.spec.class
|
112
|
-
end
|
113
|
-
@lockfile.instance_variable_set :@spec_groups, spec_groups
|
114
|
-
|
115
103
|
|
116
104
|
out = []
|
117
105
|
|
118
|
-
|
106
|
+
lockfile.add_GEM out, lockfile.spec_groups
|
119
107
|
|
120
108
|
expected = [
|
121
109
|
'GEM',
|
@@ -143,11 +131,10 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|
143
131
|
|
144
132
|
@set.gem 'a'
|
145
133
|
@set.resolve
|
146
|
-
@lockfile.instance_variable_set :@requests, @set.sorted_requests
|
147
134
|
|
148
135
|
out = []
|
149
136
|
|
150
|
-
|
137
|
+
lockfile.add_PLATFORMS out
|
151
138
|
|
152
139
|
expected = [
|
153
140
|
'PLATFORMS',
|
@@ -159,798 +146,16 @@ class TestGemRequestSetLockfile < Gem::TestCase
|
|
159
146
|
assert_equal expected, out
|
160
147
|
end
|
161
148
|
|
162
|
-
def test_get
|
163
|
-
@lockfile.instance_variable_set :@tokens, [:token]
|
164
|
-
|
165
|
-
assert_equal :token, @lockfile.get
|
166
|
-
end
|
167
|
-
|
168
|
-
def test_get_type_mismatch
|
169
|
-
@lockfile.instance_variable_set :@tokens, [[:section, 'x', 5, 1]]
|
170
|
-
|
171
|
-
e = assert_raises Gem::RequestSet::Lockfile::ParseError do
|
172
|
-
@lockfile.get :text
|
173
|
-
end
|
174
|
-
|
175
|
-
expected =
|
176
|
-
'unexpected token [:section, "x"], expected :text (at line 1 column 5)'
|
177
|
-
|
178
|
-
assert_equal expected, e.message
|
179
|
-
|
180
|
-
assert_equal 1, e.line
|
181
|
-
assert_equal 5, e.column
|
182
|
-
assert_equal File.expand_path("#{@gem_deps_file}.lock"), e.path
|
183
|
-
end
|
184
|
-
|
185
|
-
def test_get_type_multiple
|
186
|
-
@lockfile.instance_variable_set :@tokens, [[:section, 'x', 5, 1]]
|
187
|
-
|
188
|
-
assert @lockfile.get [:text, :section]
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_get_type_value_mismatch
|
192
|
-
@lockfile.instance_variable_set :@tokens, [[:section, 'x', 5, 1]]
|
193
|
-
|
194
|
-
e = assert_raises Gem::RequestSet::Lockfile::ParseError do
|
195
|
-
@lockfile.get :section, 'y'
|
196
|
-
end
|
197
|
-
|
198
|
-
expected =
|
199
|
-
'unexpected token [:section, "x"], expected [:section, "y"] (at line 1 column 5)'
|
200
|
-
|
201
|
-
assert_equal expected, e.message
|
202
|
-
|
203
|
-
assert_equal 1, e.line
|
204
|
-
assert_equal 5, e.column
|
205
|
-
assert_equal File.expand_path("#{@gem_deps_file}.lock"), e.path
|
206
|
-
end
|
207
|
-
|
208
|
-
def test_parse
|
209
|
-
write_lockfile <<-LOCKFILE.strip
|
210
|
-
GEM
|
211
|
-
remote: #{@gem_repo}
|
212
|
-
specs:
|
213
|
-
a (2)
|
214
|
-
|
215
|
-
PLATFORMS
|
216
|
-
#{Gem::Platform::RUBY}
|
217
|
-
|
218
|
-
DEPENDENCIES
|
219
|
-
a
|
220
|
-
LOCKFILE
|
221
|
-
|
222
|
-
@lockfile.parse
|
223
|
-
|
224
|
-
assert_equal [dep('a')], @set.dependencies
|
225
|
-
|
226
|
-
assert_equal [Gem::Platform::RUBY], @lockfile.platforms
|
227
|
-
|
228
|
-
lockfile_set = @set.sets.find do |set|
|
229
|
-
Gem::Resolver::LockSet === set
|
230
|
-
end
|
231
|
-
|
232
|
-
assert lockfile_set, 'could not find a LockSet'
|
233
|
-
|
234
|
-
assert_equal %w[a-2], lockfile_set.specs.map { |tuple| tuple.full_name }
|
235
|
-
end
|
236
|
-
|
237
|
-
def test_parse_dependencies
|
238
|
-
write_lockfile <<-LOCKFILE
|
239
|
-
GEM
|
240
|
-
remote: #{@gem_repo}
|
241
|
-
specs:
|
242
|
-
a (2)
|
243
|
-
|
244
|
-
PLATFORMS
|
245
|
-
#{Gem::Platform::RUBY}
|
246
|
-
|
247
|
-
DEPENDENCIES
|
248
|
-
a (>= 1, <= 2)
|
249
|
-
LOCKFILE
|
250
|
-
|
251
|
-
@lockfile.parse
|
252
|
-
|
253
|
-
assert_equal [dep('a', '>= 1', '<= 2')], @set.dependencies
|
254
|
-
|
255
|
-
assert_equal [Gem::Platform::RUBY], @lockfile.platforms
|
256
|
-
|
257
|
-
lockfile_set = @set.sets.find do |set|
|
258
|
-
Gem::Resolver::LockSet === set
|
259
|
-
end
|
260
|
-
|
261
|
-
assert lockfile_set, 'could not find a LockSet'
|
262
|
-
|
263
|
-
assert_equal %w[a-2], lockfile_set.specs.map { |tuple| tuple.full_name }
|
264
|
-
end
|
265
|
-
|
266
|
-
def test_parse_DEPENDENCIES_git
|
267
|
-
write_lockfile <<-LOCKFILE
|
268
|
-
GIT
|
269
|
-
remote: git://git.example/josevalim/rails-footnotes.git
|
270
|
-
revision: 3a6ac1971e91d822f057650cc5916ebfcbd6ee37
|
271
|
-
specs:
|
272
|
-
rails-footnotes (3.7.9)
|
273
|
-
rails (>= 3.0.0)
|
274
|
-
|
275
|
-
GIT
|
276
|
-
remote: git://git.example/svenfuchs/i18n-active_record.git
|
277
|
-
revision: 55507cf59f8f2173d38e07e18df0e90d25b1f0f6
|
278
|
-
specs:
|
279
|
-
i18n-active_record (0.0.2)
|
280
|
-
i18n (>= 0.5.0)
|
281
|
-
|
282
|
-
GEM
|
283
|
-
remote: http://gems.example/
|
284
|
-
specs:
|
285
|
-
i18n (0.6.9)
|
286
|
-
rails (4.0.0)
|
287
|
-
|
288
|
-
PLATFORMS
|
289
|
-
ruby
|
290
|
-
|
291
|
-
DEPENDENCIES
|
292
|
-
i18n-active_record!
|
293
|
-
rails-footnotes!
|
294
|
-
LOCKFILE
|
295
|
-
|
296
|
-
@lockfile.parse
|
297
|
-
|
298
|
-
expected = [
|
299
|
-
dep('i18n-active_record', '= 0.0.2'),
|
300
|
-
dep('rails-footnotes', '= 3.7.9'),
|
301
|
-
]
|
302
|
-
|
303
|
-
assert_equal expected, @set.dependencies
|
304
|
-
end
|
305
|
-
|
306
|
-
def test_parse_DEPENDENCIES_git_version
|
307
|
-
write_lockfile <<-LOCKFILE
|
308
|
-
GIT
|
309
|
-
remote: git://github.com/progrium/ruby-jwt.git
|
310
|
-
revision: 8d74770c6cd92ea234b428b5d0c1f18306a4f41c
|
311
|
-
specs:
|
312
|
-
jwt (1.1)
|
313
|
-
|
314
|
-
GEM
|
315
|
-
remote: http://gems.example/
|
316
|
-
specs:
|
317
|
-
|
318
|
-
PLATFORMS
|
319
|
-
ruby
|
320
|
-
|
321
|
-
DEPENDENCIES
|
322
|
-
jwt (= 1.1)!
|
323
|
-
LOCKFILE
|
324
|
-
|
325
|
-
@lockfile.parse
|
326
|
-
|
327
|
-
expected = [
|
328
|
-
dep('jwt', '= 1.1'),
|
329
|
-
]
|
330
|
-
|
331
|
-
assert_equal expected, @set.dependencies
|
332
|
-
end
|
333
|
-
|
334
|
-
def test_parse_GEM
|
335
|
-
write_lockfile <<-LOCKFILE
|
336
|
-
GEM
|
337
|
-
specs:
|
338
|
-
a (2)
|
339
|
-
|
340
|
-
PLATFORMS
|
341
|
-
ruby
|
342
|
-
|
343
|
-
DEPENDENCIES
|
344
|
-
a
|
345
|
-
LOCKFILE
|
346
|
-
|
347
|
-
@lockfile.parse
|
348
|
-
|
349
|
-
assert_equal [dep('a', '>= 0')], @set.dependencies
|
350
|
-
|
351
|
-
lockfile_set = @set.sets.find do |set|
|
352
|
-
Gem::Resolver::LockSet === set
|
353
|
-
end
|
354
|
-
|
355
|
-
assert lockfile_set, 'found a LockSet'
|
356
|
-
|
357
|
-
assert_equal %w[a-2], lockfile_set.specs.map { |s| s.full_name }
|
358
|
-
end
|
359
|
-
|
360
|
-
def test_parse_GEM_remote_multiple
|
361
|
-
write_lockfile <<-LOCKFILE
|
362
|
-
GEM
|
363
|
-
remote: https://gems.example/
|
364
|
-
remote: https://other.example/
|
365
|
-
specs:
|
366
|
-
a (2)
|
367
|
-
|
368
|
-
PLATFORMS
|
369
|
-
ruby
|
370
|
-
|
371
|
-
DEPENDENCIES
|
372
|
-
a
|
373
|
-
LOCKFILE
|
374
|
-
|
375
|
-
@lockfile.parse
|
376
|
-
|
377
|
-
assert_equal [dep('a', '>= 0')], @set.dependencies
|
378
|
-
|
379
|
-
lockfile_set = @set.sets.find do |set|
|
380
|
-
Gem::Resolver::LockSet === set
|
381
|
-
end
|
382
|
-
|
383
|
-
assert lockfile_set, 'found a LockSet'
|
384
|
-
|
385
|
-
assert_equal %w[a-2 a-2], lockfile_set.specs.map { |s| s.full_name }
|
386
|
-
|
387
|
-
assert_equal %w[https://gems.example/ https://other.example/],
|
388
|
-
lockfile_set.specs.map { |s| s.source.uri.to_s }
|
389
|
-
end
|
390
|
-
|
391
|
-
def test_parse_GIT
|
392
|
-
@set.instance_variable_set :@install_dir, 'install_dir'
|
393
|
-
|
394
|
-
write_lockfile <<-LOCKFILE
|
395
|
-
GIT
|
396
|
-
remote: git://example/a.git
|
397
|
-
revision: master
|
398
|
-
specs:
|
399
|
-
a (2)
|
400
|
-
b (>= 3)
|
401
|
-
c
|
402
|
-
|
403
|
-
DEPENDENCIES
|
404
|
-
a!
|
405
|
-
LOCKFILE
|
406
|
-
|
407
|
-
@lockfile.parse
|
408
|
-
|
409
|
-
assert_equal [dep('a', '= 2')], @set.dependencies
|
410
|
-
|
411
|
-
lockfile_set = @set.sets.find do |set|
|
412
|
-
Gem::Resolver::LockSet === set
|
413
|
-
end
|
414
|
-
|
415
|
-
refute lockfile_set, 'fount a LockSet'
|
416
|
-
|
417
|
-
git_set = @set.sets.find do |set|
|
418
|
-
Gem::Resolver::GitSet === set
|
419
|
-
end
|
420
|
-
|
421
|
-
assert git_set, 'could not find a GitSet'
|
422
|
-
|
423
|
-
assert_equal %w[a-2], git_set.specs.values.map { |s| s.full_name }
|
424
|
-
|
425
|
-
assert_equal [dep('b', '>= 3'), dep('c')],
|
426
|
-
git_set.specs.values.first.dependencies
|
427
|
-
|
428
|
-
expected = {
|
429
|
-
'a' => %w[git://example/a.git master],
|
430
|
-
}
|
431
|
-
|
432
|
-
assert_equal expected, git_set.repositories
|
433
|
-
assert_equal 'install_dir', git_set.root_dir
|
434
|
-
end
|
435
|
-
|
436
|
-
def test_parse_GIT_branch
|
437
|
-
write_lockfile <<-LOCKFILE
|
438
|
-
GIT
|
439
|
-
remote: git://example/a.git
|
440
|
-
revision: 1234abc
|
441
|
-
branch: 0-9-12-stable
|
442
|
-
specs:
|
443
|
-
a (2)
|
444
|
-
b (>= 3)
|
445
|
-
|
446
|
-
DEPENDENCIES
|
447
|
-
a!
|
448
|
-
LOCKFILE
|
449
|
-
|
450
|
-
@lockfile.parse
|
451
|
-
|
452
|
-
assert_equal [dep('a', '= 2')], @set.dependencies
|
453
|
-
|
454
|
-
lockfile_set = @set.sets.find do |set|
|
455
|
-
Gem::Resolver::LockSet === set
|
456
|
-
end
|
457
|
-
|
458
|
-
refute lockfile_set, 'fount a LockSet'
|
459
|
-
|
460
|
-
git_set = @set.sets.find do |set|
|
461
|
-
Gem::Resolver::GitSet === set
|
462
|
-
end
|
463
|
-
|
464
|
-
assert git_set, 'could not find a GitSet'
|
465
|
-
|
466
|
-
expected = {
|
467
|
-
'a' => %w[git://example/a.git 1234abc],
|
468
|
-
}
|
469
|
-
|
470
|
-
assert_equal expected, git_set.repositories
|
471
|
-
end
|
472
|
-
|
473
|
-
def test_parse_GIT_ref
|
474
|
-
write_lockfile <<-LOCKFILE
|
475
|
-
GIT
|
476
|
-
remote: git://example/a.git
|
477
|
-
revision: 1234abc
|
478
|
-
ref: 1234abc
|
479
|
-
specs:
|
480
|
-
a (2)
|
481
|
-
b (>= 3)
|
482
|
-
|
483
|
-
DEPENDENCIES
|
484
|
-
a!
|
485
|
-
LOCKFILE
|
486
|
-
|
487
|
-
@lockfile.parse
|
488
|
-
|
489
|
-
assert_equal [dep('a', '= 2')], @set.dependencies
|
490
|
-
|
491
|
-
lockfile_set = @set.sets.find do |set|
|
492
|
-
Gem::Resolver::LockSet === set
|
493
|
-
end
|
494
|
-
|
495
|
-
refute lockfile_set, 'fount a LockSet'
|
496
|
-
|
497
|
-
git_set = @set.sets.find do |set|
|
498
|
-
Gem::Resolver::GitSet === set
|
499
|
-
end
|
500
|
-
|
501
|
-
assert git_set, 'could not find a GitSet'
|
502
|
-
|
503
|
-
expected = {
|
504
|
-
'a' => %w[git://example/a.git 1234abc],
|
505
|
-
}
|
506
|
-
|
507
|
-
assert_equal expected, git_set.repositories
|
508
|
-
end
|
509
|
-
|
510
|
-
def test_parse_GIT_tag
|
511
|
-
write_lockfile <<-LOCKFILE
|
512
|
-
GIT
|
513
|
-
remote: git://example/a.git
|
514
|
-
revision: 1234abc
|
515
|
-
tag: v0.9.12
|
516
|
-
specs:
|
517
|
-
a (2)
|
518
|
-
b (>= 3)
|
519
|
-
|
520
|
-
DEPENDENCIES
|
521
|
-
a!
|
522
|
-
LOCKFILE
|
523
|
-
|
524
|
-
@lockfile.parse
|
525
|
-
|
526
|
-
assert_equal [dep('a', '= 2')], @set.dependencies
|
527
|
-
|
528
|
-
lockfile_set = @set.sets.find do |set|
|
529
|
-
Gem::Resolver::LockSet === set
|
530
|
-
end
|
531
|
-
|
532
|
-
refute lockfile_set, 'fount a LockSet'
|
533
|
-
|
534
|
-
git_set = @set.sets.find do |set|
|
535
|
-
Gem::Resolver::GitSet === set
|
536
|
-
end
|
537
|
-
|
538
|
-
assert git_set, 'could not find a GitSet'
|
539
|
-
|
540
|
-
expected = {
|
541
|
-
'a' => %w[git://example/a.git 1234abc],
|
542
|
-
}
|
543
|
-
|
544
|
-
assert_equal expected, git_set.repositories
|
545
|
-
end
|
546
|
-
|
547
|
-
def test_parse_PATH
|
548
|
-
_, _, directory = vendor_gem
|
549
|
-
|
550
|
-
write_lockfile <<-LOCKFILE
|
551
|
-
PATH
|
552
|
-
remote: #{directory}
|
553
|
-
specs:
|
554
|
-
a (1)
|
555
|
-
b (2)
|
556
|
-
|
557
|
-
DEPENDENCIES
|
558
|
-
a!
|
559
|
-
LOCKFILE
|
560
|
-
|
561
|
-
@lockfile.parse
|
562
|
-
|
563
|
-
assert_equal [dep('a', '= 1')], @set.dependencies
|
564
|
-
|
565
|
-
lockfile_set = @set.sets.find do |set|
|
566
|
-
Gem::Resolver::LockSet === set
|
567
|
-
end
|
568
|
-
|
569
|
-
refute lockfile_set, 'found a LockSet'
|
570
|
-
|
571
|
-
vendor_set = @set.sets.find do |set|
|
572
|
-
Gem::Resolver::VendorSet === set
|
573
|
-
end
|
574
|
-
|
575
|
-
assert vendor_set, 'could not find a VendorSet'
|
576
|
-
|
577
|
-
assert_equal %w[a-1], vendor_set.specs.values.map { |s| s.full_name }
|
578
|
-
|
579
|
-
spec = vendor_set.load_spec 'a', nil, nil, nil
|
580
|
-
|
581
|
-
assert_equal [dep('b', '= 2')], spec.dependencies
|
582
|
-
end
|
583
|
-
|
584
|
-
def test_parse_dependency
|
585
|
-
write_lockfile ' 1)'
|
586
|
-
|
587
|
-
@lockfile.tokenize
|
588
|
-
|
589
|
-
parsed = @lockfile.parse_dependency 'a', '='
|
590
|
-
|
591
|
-
assert_equal dep('a', '= 1'), parsed
|
592
|
-
|
593
|
-
write_lockfile ')'
|
594
|
-
|
595
|
-
@lockfile.tokenize
|
596
|
-
|
597
|
-
parsed = @lockfile.parse_dependency 'a', '2'
|
598
|
-
|
599
|
-
assert_equal dep('a', '= 2'), parsed
|
600
|
-
end
|
601
|
-
|
602
|
-
def test_parse_gem_specs_dependency
|
603
|
-
write_lockfile <<-LOCKFILE
|
604
|
-
GEM
|
605
|
-
remote: #{@gem_repo}
|
606
|
-
specs:
|
607
|
-
a (2)
|
608
|
-
b (= 3)
|
609
|
-
c (~> 4)
|
610
|
-
d
|
611
|
-
e (~> 5.0, >= 5.0.1)
|
612
|
-
b (3-x86_64-linux)
|
613
|
-
|
614
|
-
PLATFORMS
|
615
|
-
#{Gem::Platform::RUBY}
|
616
|
-
|
617
|
-
DEPENDENCIES
|
618
|
-
a
|
619
|
-
LOCKFILE
|
620
|
-
|
621
|
-
@lockfile.parse
|
622
|
-
|
623
|
-
assert_equal [dep('a')], @set.dependencies
|
624
|
-
|
625
|
-
assert_equal [Gem::Platform::RUBY], @lockfile.platforms
|
626
|
-
|
627
|
-
lockfile_set = @set.sets.find do |set|
|
628
|
-
Gem::Resolver::LockSet === set
|
629
|
-
end
|
630
|
-
|
631
|
-
assert lockfile_set, 'could not find a LockSet'
|
632
|
-
|
633
|
-
assert_equal %w[a-2 b-3], lockfile_set.specs.map { |tuple| tuple.full_name }
|
634
|
-
|
635
|
-
expected = [
|
636
|
-
Gem::Platform::RUBY,
|
637
|
-
Gem::Platform.new('x86_64-linux'),
|
638
|
-
]
|
639
|
-
|
640
|
-
assert_equal expected, lockfile_set.specs.map { |tuple| tuple.platform }
|
641
|
-
|
642
|
-
spec = lockfile_set.specs.first
|
643
|
-
|
644
|
-
expected = [
|
645
|
-
dep('b', '= 3'),
|
646
|
-
dep('c', '~> 4'),
|
647
|
-
dep('d'),
|
648
|
-
dep('e', '~> 5.0', '>= 5.0.1'),
|
649
|
-
]
|
650
|
-
|
651
|
-
assert_equal expected, spec.dependencies
|
652
|
-
end
|
653
|
-
|
654
|
-
def test_parse_missing
|
655
|
-
@lockfile.parse
|
656
|
-
|
657
|
-
lockfile_set = @set.sets.find do |set|
|
658
|
-
Gem::Resolver::LockSet === set
|
659
|
-
end
|
660
|
-
|
661
|
-
refute lockfile_set
|
662
|
-
end
|
663
|
-
|
664
|
-
def test_peek
|
665
|
-
@lockfile.instance_variable_set :@tokens, [:token]
|
666
|
-
|
667
|
-
assert_equal :token, @lockfile.peek
|
668
|
-
|
669
|
-
assert_equal :token, @lockfile.get
|
670
|
-
|
671
|
-
assert_equal [:EOF], @lockfile.peek
|
672
|
-
end
|
673
|
-
|
674
149
|
def test_relative_path_from
|
675
|
-
path =
|
150
|
+
path = lockfile.relative_path_from '/foo', '/foo/bar'
|
676
151
|
|
677
152
|
assert_equal File.expand_path('/foo'), path
|
678
153
|
|
679
|
-
path =
|
154
|
+
path = lockfile.relative_path_from '/foo', '/foo'
|
680
155
|
|
681
156
|
assert_equal '.', path
|
682
157
|
end
|
683
158
|
|
684
|
-
def test_skip
|
685
|
-
tokens = [[:token]]
|
686
|
-
|
687
|
-
@lockfile.instance_variable_set :@tokens, tokens
|
688
|
-
|
689
|
-
@lockfile.skip :token
|
690
|
-
|
691
|
-
assert_empty tokens
|
692
|
-
end
|
693
|
-
|
694
|
-
def test_token_pos
|
695
|
-
assert_equal [5, 0], @lockfile.token_pos(5)
|
696
|
-
|
697
|
-
@lockfile.instance_variable_set :@line_pos, 2
|
698
|
-
@lockfile.instance_variable_set :@line, 1
|
699
|
-
|
700
|
-
assert_equal [3, 1], @lockfile.token_pos(5)
|
701
|
-
end
|
702
|
-
|
703
|
-
def test_tokenize
|
704
|
-
write_lockfile <<-LOCKFILE
|
705
|
-
GEM
|
706
|
-
remote: #{@gem_repo}
|
707
|
-
specs:
|
708
|
-
a (2)
|
709
|
-
b (= 2)
|
710
|
-
c (!= 3)
|
711
|
-
d (> 4)
|
712
|
-
e (< 5)
|
713
|
-
f (>= 6)
|
714
|
-
g (<= 7)
|
715
|
-
h (~> 8)
|
716
|
-
|
717
|
-
PLATFORMS
|
718
|
-
#{Gem::Platform::RUBY}
|
719
|
-
|
720
|
-
DEPENDENCIES
|
721
|
-
a
|
722
|
-
LOCKFILE
|
723
|
-
|
724
|
-
expected = [
|
725
|
-
[:section, 'GEM', 0, 0],
|
726
|
-
[:newline, nil, 3, 0],
|
727
|
-
|
728
|
-
[:entry, 'remote', 2, 1],
|
729
|
-
[:text, @gem_repo, 10, 1],
|
730
|
-
[:newline, nil, 34, 1],
|
731
|
-
|
732
|
-
[:entry, 'specs', 2, 2],
|
733
|
-
[:newline, nil, 8, 2],
|
734
|
-
|
735
|
-
[:text, 'a', 4, 3],
|
736
|
-
[:l_paren, nil, 6, 3],
|
737
|
-
[:text, '2', 7, 3],
|
738
|
-
[:r_paren, nil, 8, 3],
|
739
|
-
[:newline, nil, 9, 3],
|
740
|
-
|
741
|
-
[:text, 'b', 6, 4],
|
742
|
-
[:l_paren, nil, 8, 4],
|
743
|
-
[:requirement, '=', 9, 4],
|
744
|
-
[:text, '2', 11, 4],
|
745
|
-
[:r_paren, nil, 12, 4],
|
746
|
-
[:newline, nil, 13, 4],
|
747
|
-
|
748
|
-
[:text, 'c', 6, 5],
|
749
|
-
[:l_paren, nil, 8, 5],
|
750
|
-
[:requirement, '!=', 9, 5],
|
751
|
-
[:text, '3', 12, 5],
|
752
|
-
[:r_paren, nil, 13, 5],
|
753
|
-
[:newline, nil, 14, 5],
|
754
|
-
|
755
|
-
[:text, 'd', 6, 6],
|
756
|
-
[:l_paren, nil, 8, 6],
|
757
|
-
[:requirement, '>', 9, 6],
|
758
|
-
[:text, '4', 11, 6],
|
759
|
-
[:r_paren, nil, 12, 6],
|
760
|
-
[:newline, nil, 13, 6],
|
761
|
-
|
762
|
-
[:text, 'e', 6, 7],
|
763
|
-
[:l_paren, nil, 8, 7],
|
764
|
-
[:requirement, '<', 9, 7],
|
765
|
-
[:text, '5', 11, 7],
|
766
|
-
[:r_paren, nil, 12, 7],
|
767
|
-
[:newline, nil, 13, 7],
|
768
|
-
|
769
|
-
[:text, 'f', 6, 8],
|
770
|
-
[:l_paren, nil, 8, 8],
|
771
|
-
[:requirement, '>=', 9, 8],
|
772
|
-
[:text, '6', 12, 8],
|
773
|
-
[:r_paren, nil, 13, 8],
|
774
|
-
[:newline, nil, 14, 8],
|
775
|
-
|
776
|
-
[:text, 'g', 6, 9],
|
777
|
-
[:l_paren, nil, 8, 9],
|
778
|
-
[:requirement, '<=', 9, 9],
|
779
|
-
[:text, '7', 12, 9],
|
780
|
-
[:r_paren, nil, 13, 9],
|
781
|
-
[:newline, nil, 14, 9],
|
782
|
-
|
783
|
-
[:text, 'h', 6, 10],
|
784
|
-
[:l_paren, nil, 8, 10],
|
785
|
-
[:requirement, '~>', 9, 10],
|
786
|
-
[:text, '8', 12, 10],
|
787
|
-
[:r_paren, nil, 13, 10],
|
788
|
-
[:newline, nil, 14, 10],
|
789
|
-
|
790
|
-
[:newline, nil, 0, 11],
|
791
|
-
|
792
|
-
[:section, 'PLATFORMS', 0, 12],
|
793
|
-
[:newline, nil, 9, 12],
|
794
|
-
|
795
|
-
[:text, Gem::Platform::RUBY, 2, 13],
|
796
|
-
[:newline, nil, 6, 13],
|
797
|
-
|
798
|
-
[:newline, nil, 0, 14],
|
799
|
-
|
800
|
-
[:section, 'DEPENDENCIES', 0, 15],
|
801
|
-
[:newline, nil, 12, 15],
|
802
|
-
|
803
|
-
[:text, 'a', 2, 16],
|
804
|
-
[:newline, nil, 3, 16],
|
805
|
-
]
|
806
|
-
|
807
|
-
assert_equal expected, @lockfile.tokenize
|
808
|
-
end
|
809
|
-
|
810
|
-
def test_tokenize_capitals
|
811
|
-
write_lockfile <<-LOCKFILE
|
812
|
-
GEM
|
813
|
-
remote: #{@gem_repo}
|
814
|
-
specs:
|
815
|
-
Ab (2)
|
816
|
-
|
817
|
-
PLATFORMS
|
818
|
-
#{Gem::Platform::RUBY}
|
819
|
-
|
820
|
-
DEPENDENCIES
|
821
|
-
Ab
|
822
|
-
LOCKFILE
|
823
|
-
|
824
|
-
expected = [
|
825
|
-
[:section, 'GEM', 0, 0],
|
826
|
-
[:newline, nil, 3, 0],
|
827
|
-
[:entry, 'remote', 2, 1],
|
828
|
-
[:text, @gem_repo, 10, 1],
|
829
|
-
[:newline, nil, 34, 1],
|
830
|
-
[:entry, 'specs', 2, 2],
|
831
|
-
[:newline, nil, 8, 2],
|
832
|
-
[:text, 'Ab', 4, 3],
|
833
|
-
[:l_paren, nil, 7, 3],
|
834
|
-
[:text, '2', 8, 3],
|
835
|
-
[:r_paren, nil, 9, 3],
|
836
|
-
[:newline, nil, 10, 3],
|
837
|
-
[:newline, nil, 0, 4],
|
838
|
-
[:section, 'PLATFORMS', 0, 5],
|
839
|
-
[:newline, nil, 9, 5],
|
840
|
-
[:text, Gem::Platform::RUBY, 2, 6],
|
841
|
-
[:newline, nil, 6, 6],
|
842
|
-
[:newline, nil, 0, 7],
|
843
|
-
[:section, 'DEPENDENCIES', 0, 8],
|
844
|
-
[:newline, nil, 12, 8],
|
845
|
-
[:text, 'Ab', 2, 9],
|
846
|
-
[:newline, nil, 4, 9],
|
847
|
-
]
|
848
|
-
|
849
|
-
assert_equal expected, @lockfile.tokenize
|
850
|
-
end
|
851
|
-
|
852
|
-
def test_tokenize_conflict_markers
|
853
|
-
write_lockfile '<<<<<<<'
|
854
|
-
|
855
|
-
e = assert_raises Gem::RequestSet::Lockfile::ParseError do
|
856
|
-
@lockfile.tokenize
|
857
|
-
end
|
858
|
-
|
859
|
-
assert_equal "your #{@lock_file} contains merge conflict markers (at line 0 column 0)",
|
860
|
-
e.message
|
861
|
-
|
862
|
-
write_lockfile '|||||||'
|
863
|
-
|
864
|
-
e = assert_raises Gem::RequestSet::Lockfile::ParseError do
|
865
|
-
@lockfile.tokenize
|
866
|
-
end
|
867
|
-
|
868
|
-
assert_equal "your #{@lock_file} contains merge conflict markers (at line 0 column 0)",
|
869
|
-
e.message
|
870
|
-
|
871
|
-
write_lockfile '======='
|
872
|
-
|
873
|
-
e = assert_raises Gem::RequestSet::Lockfile::ParseError do
|
874
|
-
@lockfile.tokenize
|
875
|
-
end
|
876
|
-
|
877
|
-
assert_equal "your #{@lock_file} contains merge conflict markers (at line 0 column 0)",
|
878
|
-
e.message
|
879
|
-
|
880
|
-
write_lockfile '>>>>>>>'
|
881
|
-
|
882
|
-
e = assert_raises Gem::RequestSet::Lockfile::ParseError do
|
883
|
-
@lockfile.tokenize
|
884
|
-
end
|
885
|
-
|
886
|
-
assert_equal "your #{@lock_file} contains merge conflict markers (at line 0 column 0)",
|
887
|
-
e.message
|
888
|
-
end
|
889
|
-
|
890
|
-
def test_tokenize_git
|
891
|
-
write_lockfile <<-LOCKFILE
|
892
|
-
DEPENDENCIES
|
893
|
-
a!
|
894
|
-
LOCKFILE
|
895
|
-
|
896
|
-
expected = [
|
897
|
-
[:section, 'DEPENDENCIES', 0, 0],
|
898
|
-
[:newline, nil, 12, 0],
|
899
|
-
|
900
|
-
[:text, 'a', 2, 1],
|
901
|
-
[:bang, nil, 3, 1],
|
902
|
-
[:newline, nil, 4, 1],
|
903
|
-
]
|
904
|
-
|
905
|
-
assert_equal expected, @lockfile.tokenize
|
906
|
-
end
|
907
|
-
|
908
|
-
def test_tokenize_missing
|
909
|
-
tokens = @lockfile.tokenize
|
910
|
-
|
911
|
-
assert_empty tokens
|
912
|
-
end
|
913
|
-
|
914
|
-
def test_tokenize_multiple
|
915
|
-
write_lockfile <<-LOCKFILE
|
916
|
-
GEM
|
917
|
-
remote: #{@gem_repo}
|
918
|
-
specs:
|
919
|
-
a (2)
|
920
|
-
b (~> 3.0, >= 3.0.1)
|
921
|
-
LOCKFILE
|
922
|
-
|
923
|
-
expected = [
|
924
|
-
[:section, 'GEM', 0, 0],
|
925
|
-
[:newline, nil, 3, 0],
|
926
|
-
|
927
|
-
[:entry, 'remote', 2, 1],
|
928
|
-
[:text, @gem_repo, 10, 1],
|
929
|
-
[:newline, nil, 34, 1],
|
930
|
-
|
931
|
-
[:entry, 'specs', 2, 2],
|
932
|
-
[:newline, nil, 8, 2],
|
933
|
-
|
934
|
-
[:text, 'a', 4, 3],
|
935
|
-
[:l_paren, nil, 6, 3],
|
936
|
-
[:text, '2', 7, 3],
|
937
|
-
[:r_paren, nil, 8, 3],
|
938
|
-
[:newline, nil, 9, 3],
|
939
|
-
|
940
|
-
[:text, 'b', 6, 4],
|
941
|
-
[:l_paren, nil, 8, 4],
|
942
|
-
[:requirement, '~>', 9, 4],
|
943
|
-
[:text, '3.0', 12, 4],
|
944
|
-
[:comma, nil, 15, 4],
|
945
|
-
[:requirement, '>=', 17, 4],
|
946
|
-
[:text, '3.0.1', 20, 4],
|
947
|
-
[:r_paren, nil, 25, 4],
|
948
|
-
[:newline, nil, 26, 4],
|
949
|
-
]
|
950
|
-
|
951
|
-
assert_equal expected, @lockfile.tokenize
|
952
|
-
end
|
953
|
-
|
954
159
|
def test_to_s_gem
|
955
160
|
spec_fetcher do |fetcher|
|
956
161
|
fetcher.spec 'a', 2
|
@@ -971,7 +176,7 @@ DEPENDENCIES
|
|
971
176
|
a
|
972
177
|
LOCKFILE
|
973
178
|
|
974
|
-
assert_equal expected,
|
179
|
+
assert_equal expected, lockfile.to_s
|
975
180
|
end
|
976
181
|
|
977
182
|
def test_to_s_gem_dependency
|
@@ -1002,7 +207,7 @@ DEPENDENCIES
|
|
1002
207
|
c
|
1003
208
|
LOCKFILE
|
1004
209
|
|
1005
|
-
assert_equal expected,
|
210
|
+
assert_equal expected, lockfile.to_s
|
1006
211
|
end
|
1007
212
|
|
1008
213
|
def test_to_s_gem_dependency_non_default
|
@@ -1030,7 +235,7 @@ DEPENDENCIES
|
|
1030
235
|
b
|
1031
236
|
LOCKFILE
|
1032
237
|
|
1033
|
-
assert_equal expected,
|
238
|
+
assert_equal expected, lockfile.to_s
|
1034
239
|
end
|
1035
240
|
|
1036
241
|
def test_to_s_gem_dependency_requirement
|
@@ -1057,7 +262,7 @@ DEPENDENCIES
|
|
1057
262
|
b
|
1058
263
|
LOCKFILE
|
1059
264
|
|
1060
|
-
assert_equal expected,
|
265
|
+
assert_equal expected, lockfile.to_s
|
1061
266
|
end
|
1062
267
|
|
1063
268
|
def test_to_s_gem_path
|
@@ -1080,7 +285,7 @@ DEPENDENCIES
|
|
1080
285
|
a!
|
1081
286
|
LOCKFILE
|
1082
287
|
|
1083
|
-
assert_equal expected,
|
288
|
+
assert_equal expected, lockfile.to_s
|
1084
289
|
end
|
1085
290
|
|
1086
291
|
def test_to_s_gem_path_absolute
|
@@ -1103,7 +308,7 @@ DEPENDENCIES
|
|
1103
308
|
a!
|
1104
309
|
LOCKFILE
|
1105
310
|
|
1106
|
-
assert_equal expected,
|
311
|
+
assert_equal expected, lockfile.to_s
|
1107
312
|
end
|
1108
313
|
|
1109
314
|
def test_to_s_gem_platform
|
@@ -1128,7 +333,7 @@ DEPENDENCIES
|
|
1128
333
|
a
|
1129
334
|
LOCKFILE
|
1130
335
|
|
1131
|
-
assert_equal expected,
|
336
|
+
assert_equal expected, lockfile.to_s
|
1132
337
|
end
|
1133
338
|
|
1134
339
|
def test_to_s_gem_source
|
@@ -1166,7 +371,7 @@ DEPENDENCIES
|
|
1166
371
|
b
|
1167
372
|
LOCKFILE
|
1168
373
|
|
1169
|
-
assert_equal expected,
|
374
|
+
assert_equal expected, lockfile.to_s
|
1170
375
|
end
|
1171
376
|
|
1172
377
|
def test_to_s_git
|
@@ -1233,19 +438,11 @@ DEPENDENCIES
|
|
1233
438
|
c!
|
1234
439
|
LOCKFILE
|
1235
440
|
|
1236
|
-
assert_equal expected,
|
1237
|
-
end
|
1238
|
-
|
1239
|
-
def test_unget
|
1240
|
-
@lockfile.instance_variable_set :@current_token, :token
|
1241
|
-
|
1242
|
-
@lockfile.unget
|
1243
|
-
|
1244
|
-
assert_equal :token, @lockfile.get
|
441
|
+
assert_equal expected, lockfile.to_s
|
1245
442
|
end
|
1246
443
|
|
1247
444
|
def test_write
|
1248
|
-
|
445
|
+
lockfile.write
|
1249
446
|
|
1250
447
|
gem_deps_lock_file = "#{@gem_deps_file}.lock"
|
1251
448
|
|
@@ -1264,13 +461,11 @@ DEPENDENCIES
|
|
1264
461
|
end
|
1265
462
|
|
1266
463
|
assert_raises Gem::UnsatisfiableDependencyError do
|
1267
|
-
|
464
|
+
lockfile.write
|
1268
465
|
end
|
1269
466
|
|
1270
467
|
assert_path_exists gem_deps_lock_file
|
1271
468
|
|
1272
469
|
assert_equal 'hello', File.read(gem_deps_lock_file)
|
1273
470
|
end
|
1274
|
-
|
1275
471
|
end
|
1276
|
-
|