rubygems-update 2.7.3 → 2.7.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -30
- data/History.txt +146 -0
- data/Manifest.txt +5 -4
- data/Rakefile +19 -2
- data/bundler/CHANGELOG.md +143 -0
- data/bundler/README.md +5 -1
- data/bundler/bundler.gemspec +4 -1
- data/bundler/lib/bundler.rb +12 -8
- data/bundler/lib/bundler/build_metadata.rb +19 -2
- data/bundler/lib/bundler/cli.rb +3 -1
- data/bundler/lib/bundler/cli/check.rb +1 -1
- data/bundler/lib/bundler/cli/exec.rb +4 -4
- data/bundler/lib/bundler/cli/gem.rb +6 -3
- data/bundler/lib/bundler/cli/init.rb +6 -5
- data/bundler/lib/bundler/cli/install.rb +2 -2
- data/bundler/lib/bundler/cli/outdated.rb +1 -1
- data/bundler/lib/bundler/cli/update.rb +6 -4
- data/bundler/lib/bundler/compact_index_client/updater.rb +10 -1
- data/bundler/lib/bundler/current_ruby.rb +8 -1
- data/bundler/lib/bundler/definition.rb +34 -24
- data/bundler/lib/bundler/dep_proxy.rb +2 -2
- data/bundler/lib/bundler/dependency.rb +1 -0
- data/bundler/lib/bundler/deprecate.rb +2 -1
- data/bundler/lib/bundler/endpoint_specification.rb +1 -1
- data/bundler/lib/bundler/env.rb +10 -8
- data/bundler/lib/bundler/fetcher.rb +3 -3
- data/bundler/lib/bundler/fetcher/downloader.rb +10 -5
- data/bundler/lib/bundler/fetcher/index.rb +2 -2
- data/bundler/lib/bundler/friendly_errors.rb +2 -0
- data/bundler/lib/bundler/gem_helper.rb +1 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +12 -0
- data/bundler/lib/bundler/injector.rb +5 -5
- data/bundler/lib/bundler/installer.rb +12 -4
- data/bundler/lib/bundler/installer/gem_installer.rb +9 -2
- data/bundler/lib/bundler/installer/parallel_installer.rb +1 -1
- data/bundler/lib/bundler/lazy_specification.rb +1 -1
- data/bundler/lib/bundler/mirror.rb +2 -2
- data/bundler/lib/bundler/plugin.rb +2 -2
- data/bundler/lib/bundler/plugin/index.rb +7 -2
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/resolver.rb +14 -10
- data/bundler/lib/bundler/resolver/spec_group.rb +0 -5
- data/bundler/lib/bundler/ruby_version.rb +1 -1
- data/bundler/lib/bundler/rubygems_integration.rb +9 -3
- data/bundler/lib/bundler/runtime.rb +2 -2
- data/bundler/lib/bundler/shared_helpers.rb +15 -3
- data/bundler/lib/bundler/source/git.rb +2 -1
- data/bundler/lib/bundler/source/git/git_proxy.rb +6 -1
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +13 -6
- data/bundler/lib/bundler/source/rubygems/remote.rb +4 -1
- data/bundler/lib/bundler/spec_set.rb +4 -1
- data/bundler/lib/bundler/templates/.document +1 -0
- data/bundler/lib/bundler/templates/Executable +11 -3
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +8 -2
- data/bundler/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
- data/bundler/lib/bundler/ui/shell.rb +3 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +7 -2
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/man/bundle-binstubs.ronn +3 -3
- data/bundler/man/bundle-check.ronn +3 -3
- data/bundler/man/bundle-config.ronn +13 -9
- data/bundler/man/bundle-doctor.ronn +33 -0
- data/bundler/man/bundle-exec.ronn +3 -3
- data/bundler/man/bundle-gem.ronn +1 -1
- data/bundler/man/bundle-init.ronn +15 -4
- data/bundler/man/bundle-inject.ronn +3 -3
- data/bundler/man/bundle-install.ronn +12 -3
- data/bundler/man/bundle-lock.ronn +1 -1
- data/bundler/man/bundle-outdated.ronn +1 -1
- data/bundler/man/bundle-package.ronn +3 -3
- data/bundler/man/bundle-show.ronn +3 -2
- data/bundler/man/bundle-update.ronn +18 -14
- data/bundler/man/bundle-viz.ronn +1 -1
- data/bundler/man/bundle.ronn +27 -27
- data/bundler/man/gemfile.5.ronn +24 -9
- data/lib/rubygems.rb +30 -17
- data/lib/rubygems/bundler_version_finder.rb +9 -22
- data/lib/rubygems/command.rb +9 -1
- data/lib/rubygems/command_manager.rb +6 -4
- data/lib/rubygems/commands/generate_index_command.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +7 -0
- data/lib/rubygems/commands/owner_command.rb +4 -1
- data/lib/rubygems/commands/push_command.rb +37 -4
- data/lib/rubygems/commands/setup_command.rb +22 -7
- data/lib/rubygems/commands/uninstall_command.rb +1 -1
- data/lib/rubygems/commands/unpack_command.rb +3 -3
- data/lib/rubygems/config_file.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +2 -7
- data/lib/rubygems/dependency.rb +1 -0
- data/lib/rubygems/dependency_installer.rb +4 -2
- data/lib/rubygems/exceptions.rb +5 -1
- data/lib/rubygems/ext/builder.rb +1 -1
- data/lib/rubygems/gemcutter_utilities.rb +5 -2
- data/lib/rubygems/indexer.rb +6 -5
- data/lib/rubygems/install_update_options.rb +1 -1
- data/lib/rubygems/installer.rb +38 -10
- data/lib/rubygems/package.rb +54 -7
- data/lib/rubygems/package/file_source.rb +2 -2
- data/lib/rubygems/package/old.rb +1 -1
- data/lib/rubygems/package/tar_header.rb +17 -10
- data/lib/rubygems/package/tar_writer.rb +4 -3
- data/lib/rubygems/remote_fetcher.rb +1 -1
- data/lib/rubygems/request_set.rb +28 -17
- data/lib/rubygems/request_set/lockfile.rb +1 -1
- data/lib/rubygems/requirement.rb +14 -3
- data/lib/rubygems/resolver/api_specification.rb +5 -0
- data/lib/rubygems/security.rb +7 -2
- data/lib/rubygems/security/trust_dir.rb +1 -1
- data/lib/rubygems/server.rb +16 -4
- data/lib/rubygems/source.rb +2 -2
- data/lib/rubygems/specification.rb +22 -14
- data/lib/rubygems/ssl_certs/{index.rubygems.org → rubygems.org}/GlobalSignRootCA.pem +0 -0
- data/lib/rubygems/ssl_certs/rubygems.org/GlobalSignRootCA_R3.pem +21 -0
- data/lib/rubygems/stub_specification.rb +2 -0
- data/lib/rubygems/test_case.rb +36 -12
- data/lib/rubygems/test_utilities.rb +2 -2
- data/lib/rubygems/user_interaction.rb +9 -2
- data/lib/rubygems/util.rb +2 -1
- data/lib/rubygems/util/licenses.rb +35 -4
- data/lib/rubygems/validator.rb +3 -3
- data/lib/rubygems/version.rb +7 -1
- data/lib/ubygems.rb +3 -0
- data/test/rubygems/test_bundled_ca.rb +7 -4
- data/test/rubygems/test_gem.rb +62 -24
- data/test/rubygems/test_gem_bundler_version_finder.rb +8 -7
- data/test/rubygems/test_gem_command_manager.rb +2 -2
- data/test/rubygems/test_gem_commands_build_command.rb +2 -0
- data/test/rubygems/test_gem_commands_cleanup_command.rb +1 -1
- data/test/rubygems/test_gem_commands_install_command.rb +38 -0
- data/test/rubygems/test_gem_commands_owner_command.rb +25 -0
- data/test/rubygems/test_gem_commands_push_command.rb +25 -5
- data/test/rubygems/test_gem_commands_setup_command.rb +46 -21
- data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
- data/test/rubygems/test_gem_commands_uninstall_command.rb +3 -3
- data/test/rubygems/test_gem_dependency.rb +1 -1
- data/test/rubygems/test_gem_dependency_installer.rb +1 -1
- data/test/rubygems/test_gem_doctor.rb +2 -2
- data/test/rubygems/test_gem_ext_builder.rb +6 -6
- data/test/rubygems/test_gem_ext_rake_builder.rb +0 -4
- data/test/rubygems/test_gem_gemcutter_utilities.rb +4 -4
- data/test/rubygems/test_gem_indexer.rb +1 -2
- data/test/rubygems/test_gem_install_update_options.rb +4 -0
- data/test/rubygems/test_gem_installer.rb +114 -4
- data/test/rubygems/test_gem_package.rb +178 -21
- data/test/rubygems/test_gem_package_old.rb +1 -1
- data/test/rubygems/test_gem_package_tar_header.rb +21 -0
- data/test/rubygems/test_gem_rdoc.rb +2 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +7 -3
- data/test/rubygems/test_gem_request.rb +5 -2
- data/test/rubygems/test_gem_request_connection_pools.rb +6 -7
- data/test/rubygems/test_gem_request_set.rb +7 -7
- data/test/rubygems/test_gem_request_set_lockfile.rb +4 -4
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +1 -1
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +1 -1
- data/test/rubygems/test_gem_requirement.rb +6 -0
- data/test/rubygems/test_gem_resolver_api_specification.rb +24 -0
- data/test/rubygems/test_gem_resolver_git_specification.rb +1 -1
- data/test/rubygems/test_gem_resolver_installer_set.rb +1 -1
- data/test/rubygems/test_gem_security_policy.rb +3 -3
- data/test/rubygems/test_gem_server.rb +177 -12
- data/test/rubygems/test_gem_source.rb +3 -3
- data/test/rubygems/test_gem_source_git.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +64 -31
- data/test/rubygems/test_gem_stream_ui.rb +2 -2
- data/test/rubygems/test_gem_stub_specification.rb +7 -7
- data/test/rubygems/test_gem_text.rb +5 -0
- data/test/rubygems/test_gem_util.rb +25 -0
- data/test/rubygems/test_gem_version.rb +40 -2
- data/test/rubygems/test_require.rb +15 -21
- data/util/ci +1 -0
- data/util/generate_spdx_license_list.rb +15 -6
- data/util/update_bundled_ca_certificates.rb +1 -3
- metadata +14 -13
- data/lib/rubygems/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/rubygems/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
@@ -88,20 +88,21 @@ class TestGemBundlerVersionFinder < Gem::TestCase
|
|
88
88
|
bvf.stub(:bundler_version, v("2.1.1.1")) do
|
89
89
|
assert bvf.compatible?(util_spec("foo"))
|
90
90
|
assert bvf.compatible?(util_spec("bundler", "2.1.1.1"))
|
91
|
-
|
91
|
+
assert bvf.compatible?(util_spec("bundler", "2.1.1.a"))
|
92
|
+
assert bvf.compatible?(util_spec("bundler", "2.999"))
|
92
93
|
refute bvf.compatible?(util_spec("bundler", "1.999"))
|
93
|
-
refute bvf.compatible?(util_spec("bundler", "
|
94
|
+
refute bvf.compatible?(util_spec("bundler", "3.0.0"))
|
94
95
|
end
|
95
96
|
end
|
96
97
|
|
97
98
|
def test_filter
|
98
|
-
versions = %w[1 1.0 1.0.1.1 2.a 3 3.0]
|
99
|
+
versions = %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1]
|
99
100
|
specs = versions.map { |v| util_spec("bundler", v) }
|
100
101
|
|
101
|
-
assert_equal %w[1 1.0 1.0.1.1 2.a 3 3.0], util_filter_specs(specs).map(&:version).map(&:to_s)
|
102
|
+
assert_equal %w[1 1.0 1.0.1.1 2 2.a 2.0 2.1.1 3 3.a 3.0 3.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
|
102
103
|
|
103
104
|
bvf.stub(:bundler_version, v("2.1.1.1")) do
|
104
|
-
|
105
|
+
assert_equal %w[2 2.a 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
|
105
106
|
end
|
106
107
|
bvf.stub(:bundler_version, v("1.1.1.1")) do
|
107
108
|
assert_equal %w[1 1.0 1.0.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
|
@@ -110,10 +111,10 @@ class TestGemBundlerVersionFinder < Gem::TestCase
|
|
110
111
|
assert_equal %w[1 1.0 1.0.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
|
111
112
|
end
|
112
113
|
bvf.stub(:bundler_version, v("2.a")) do
|
113
|
-
assert_equal %w[2.a], util_filter_specs(specs).map(&:version).map(&:to_s)
|
114
|
+
assert_equal %w[2 2.a 2.0 2.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
|
114
115
|
end
|
115
116
|
bvf.stub(:bundler_version, v("3")) do
|
116
|
-
assert_equal %w[3 3.0], util_filter_specs(specs).map(&:version).map(&:to_s)
|
117
|
+
assert_equal %w[3 3.a 3.0 3.1.1], util_filter_specs(specs).map(&:version).map(&:to_s)
|
117
118
|
end
|
118
119
|
end
|
119
120
|
|
@@ -114,8 +114,8 @@ class TestGemCommandManager < Gem::TestCase
|
|
114
114
|
assert_equal :both, check_options[:domain]
|
115
115
|
assert_equal true, check_options[:wrappers]
|
116
116
|
assert_equal Gem::Requirement.default, check_options[:version]
|
117
|
-
|
118
|
-
|
117
|
+
assert_nil check_options[:install_dir]
|
118
|
+
assert_nil check_options[:bin_dir]
|
119
119
|
|
120
120
|
#check settings
|
121
121
|
check_options = nil
|
@@ -122,6 +122,8 @@ class TestGemCommandsBuildCommand < Gem::TestCase
|
|
122
122
|
SIGNING_KEY = key_path 'private3072'
|
123
123
|
|
124
124
|
def test_build_signed_gem
|
125
|
+
skip 'openssl is missing' unless defined?(OpenSSL::SSL)
|
126
|
+
|
125
127
|
trust_dir = Gem::Security.trust_dir
|
126
128
|
|
127
129
|
spec = util_spec 'some_gem' do |s|
|
@@ -158,7 +158,7 @@ class TestGemCommandsCleanupCommand < Gem::TestCase
|
|
158
158
|
assert_path_exists @a_1_1.gem_dir
|
159
159
|
ensure
|
160
160
|
FileUtils.chmod 0755, @gemhome
|
161
|
-
end unless win_platform?
|
161
|
+
end unless win_platform? || Process.uid.zero?
|
162
162
|
|
163
163
|
def test_execute_dry_run
|
164
164
|
@cmd.options[:args] = %w[a]
|
@@ -131,6 +131,7 @@ class TestGemCommandsInstallCommand < Gem::TestCase
|
|
131
131
|
|
132
132
|
def test_execute_no_user_install
|
133
133
|
skip 'skipped on MS Windows (chmod has no effect)' if win_platform?
|
134
|
+
skip 'skipped in root privilege' if Process.uid.zero?
|
134
135
|
|
135
136
|
specs = spec_fetcher do |fetcher|
|
136
137
|
fetcher.gem 'a', 2
|
@@ -415,6 +416,43 @@ ERROR: Possible alternatives: non_existent_with_hint
|
|
415
416
|
assert_path_exists File.join(a2.doc_dir, 'rdoc')
|
416
417
|
end
|
417
418
|
|
419
|
+
def test_execute_rdoc_with_path
|
420
|
+
skip if RUBY_VERSION <= "1.8.7"
|
421
|
+
specs = spec_fetcher do |fetcher|
|
422
|
+
fetcher.gem 'a', 2
|
423
|
+
end
|
424
|
+
|
425
|
+
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
|
426
|
+
|
427
|
+
@cmd.options[:document] = %w[rdoc ri]
|
428
|
+
@cmd.options[:domain] = :local
|
429
|
+
@cmd.options[:install_dir] = 'whatever'
|
430
|
+
|
431
|
+
a2 = specs['a-2']
|
432
|
+
FileUtils.mv a2.cache_file, @tempdir
|
433
|
+
|
434
|
+
@cmd.options[:args] = %w[a]
|
435
|
+
|
436
|
+
use_ui @ui do
|
437
|
+
# Don't use Dir.chdir with a block, it warnings a lot because
|
438
|
+
# of a downstream Dir.chdir with a block
|
439
|
+
old = Dir.getwd
|
440
|
+
|
441
|
+
begin
|
442
|
+
Dir.chdir @tempdir
|
443
|
+
assert_raises Gem::MockGemUi::SystemExitException, @ui.error do
|
444
|
+
@cmd.execute
|
445
|
+
end
|
446
|
+
ensure
|
447
|
+
Dir.chdir old
|
448
|
+
end
|
449
|
+
end
|
450
|
+
|
451
|
+
wait_for_child_process_to_exit
|
452
|
+
|
453
|
+
assert_path_exists 'whatever/doc/a-2', 'documentation not installed'
|
454
|
+
end
|
455
|
+
|
418
456
|
def test_execute_saves_build_args
|
419
457
|
specs = spec_fetcher do |fetcher|
|
420
458
|
fetcher.gem 'a', 2
|
@@ -43,6 +43,31 @@ EOF
|
|
43
43
|
assert_match %r{- 4}, @ui.output
|
44
44
|
end
|
45
45
|
|
46
|
+
def test_show_owners_dont_load_objects
|
47
|
+
skip "testing a psych-only API" unless defined?(::Psych::DisallowedClass)
|
48
|
+
|
49
|
+
response = <<EOF
|
50
|
+
---
|
51
|
+
- email: !ruby/object:Object {}
|
52
|
+
id: 1
|
53
|
+
handle: user1
|
54
|
+
- email: user2@example.com
|
55
|
+
- id: 3
|
56
|
+
handle: user3
|
57
|
+
- id: 4
|
58
|
+
EOF
|
59
|
+
|
60
|
+
@fetcher.data["#{Gem.host}/api/v1/gems/freewill/owners.yaml"] = [response, 200, 'OK']
|
61
|
+
|
62
|
+
assert_raises Psych::DisallowedClass do
|
63
|
+
use_ui @ui do
|
64
|
+
@cmd.show_owners("freewill")
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
|
46
71
|
def test_show_owners_setting_up_host_through_env_var
|
47
72
|
response = "- email: user1@example.com\n"
|
48
73
|
host = "http://rubygems.example"
|
@@ -95,6 +95,26 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
95
95
|
@fetcher.last_request["Content-Type"]
|
96
96
|
end
|
97
97
|
|
98
|
+
def test_execute_allowed_push_host
|
99
|
+
@spec, @path = util_gem "freebird", "1.0.1" do |spec|
|
100
|
+
spec.metadata['allowed_push_host'] = "https://privategemserver.example"
|
101
|
+
end
|
102
|
+
|
103
|
+
@response = "Successfully registered gem: freewill (1.0.0)"
|
104
|
+
@fetcher.data["#{@spec.metadata['allowed_push_host']}/api/v1/gems"] = [@response, 200, 'OK']
|
105
|
+
@fetcher.data["#{Gem.host}/api/v1/gems"] =
|
106
|
+
['fail', 500, 'Internal Server Error']
|
107
|
+
|
108
|
+
@cmd.options[:args] = [@path]
|
109
|
+
|
110
|
+
@cmd.execute
|
111
|
+
|
112
|
+
assert_equal Net::HTTP::Post, @fetcher.last_request.class
|
113
|
+
assert_equal Gem.read_binary(@path), @fetcher.last_request.body
|
114
|
+
assert_equal "application/octet-stream",
|
115
|
+
@fetcher.last_request["Content-Type"]
|
116
|
+
end
|
117
|
+
|
98
118
|
def test_sending_when_default_host_disabled
|
99
119
|
Gem.configuration.disable_default_gem_server = true
|
100
120
|
response = "You must specify a gem server"
|
@@ -132,7 +152,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
132
152
|
}
|
133
153
|
|
134
154
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
135
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
155
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
136
156
|
f.write keys.to_yaml
|
137
157
|
end
|
138
158
|
Gem.configuration.load_api_keys
|
@@ -166,7 +186,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
166
186
|
}
|
167
187
|
|
168
188
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
169
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
189
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
170
190
|
f.write keys.to_yaml
|
171
191
|
end
|
172
192
|
Gem.configuration.load_api_keys
|
@@ -193,7 +213,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
193
213
|
}
|
194
214
|
|
195
215
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
196
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
216
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
197
217
|
f.write keys.to_yaml
|
198
218
|
end
|
199
219
|
Gem.configuration.load_api_keys
|
@@ -235,7 +255,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
235
255
|
}
|
236
256
|
|
237
257
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
238
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
258
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
239
259
|
f.write keys.to_yaml
|
240
260
|
end
|
241
261
|
Gem.configuration.load_api_keys
|
@@ -266,7 +286,7 @@ class TestGemCommandsPushCommand < Gem::TestCase
|
|
266
286
|
}
|
267
287
|
|
268
288
|
FileUtils.mkdir_p File.dirname Gem.configuration.credentials_path
|
269
|
-
open Gem.configuration.credentials_path, 'w' do |f|
|
289
|
+
File.open Gem.configuration.credentials_path, 'w' do |f|
|
270
290
|
f.write keys.to_yaml
|
271
291
|
end
|
272
292
|
Gem.configuration.load_api_keys
|
@@ -6,6 +6,13 @@ require 'rubygems/commands/setup_command'
|
|
6
6
|
|
7
7
|
class TestGemCommandsSetupCommand < Gem::TestCase
|
8
8
|
|
9
|
+
bundler_gemspec = File.expand_path("../../../bundler/lib/bundler/version.rb", __FILE__)
|
10
|
+
if File.exist?(bundler_gemspec)
|
11
|
+
BUNDLER_VERS = File.read(bundler_gemspec).match(/VERSION = "(#{Gem::Version::VERSION_PATTERN})"/)[1]
|
12
|
+
else
|
13
|
+
BUNDLER_VERS = "1.16.2"
|
14
|
+
end
|
15
|
+
|
9
16
|
def setup
|
10
17
|
super
|
11
18
|
|
@@ -16,35 +23,41 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
16
23
|
FileUtils.mkdir_p 'bin'
|
17
24
|
FileUtils.mkdir_p 'lib/rubygems/ssl_certs/rubygems.org'
|
18
25
|
|
19
|
-
open 'bin/gem', 'w' do |io| io.puts '# gem' end
|
20
|
-
open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
|
21
|
-
open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
|
22
|
-
open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io| io.puts 'PEM' end
|
26
|
+
File.open 'bin/gem', 'w' do |io| io.puts '# gem' end
|
27
|
+
File.open 'lib/rubygems.rb', 'w' do |io| io.puts '# rubygems.rb' end
|
28
|
+
File.open 'lib/rubygems/test_case.rb', 'w' do |io| io.puts '# test_case.rb' end
|
29
|
+
File.open 'lib/rubygems/ssl_certs/rubygems.org/foo.pem', 'w' do |io| io.puts 'PEM' end
|
23
30
|
|
24
31
|
FileUtils.mkdir_p 'bundler/exe'
|
25
32
|
FileUtils.mkdir_p 'bundler/lib/bundler'
|
26
33
|
|
27
|
-
open 'bundler/exe/bundle', 'w' do |io| io.puts '# bundle' end
|
28
|
-
open 'bundler/lib/bundler.rb', 'w' do |io| io.puts '# bundler.rb' end
|
29
|
-
open 'bundler/lib/bundler/b.rb', 'w' do |io| io.puts '# b.rb' end
|
34
|
+
File.open 'bundler/exe/bundle', 'w' do |io| io.puts '# bundle' end
|
35
|
+
File.open 'bundler/lib/bundler.rb', 'w' do |io| io.puts '# bundler.rb' end
|
36
|
+
File.open 'bundler/lib/bundler/b.rb', 'w' do |io| io.puts '# b.rb' end
|
30
37
|
|
31
38
|
FileUtils.mkdir_p 'default/gems'
|
32
39
|
|
33
40
|
gemspec = Gem::Specification.new
|
34
41
|
gemspec.name = "bundler"
|
35
|
-
gemspec.version =
|
42
|
+
gemspec.version = BUNDLER_VERS
|
36
43
|
gemspec.bindir = "exe"
|
37
44
|
gemspec.executables = ["bundle"]
|
38
45
|
|
39
|
-
open 'bundler/bundler.gemspec', 'w' do |io|
|
46
|
+
File.open 'bundler/bundler.gemspec', 'w' do |io|
|
40
47
|
io.puts gemspec.to_ruby
|
41
48
|
end
|
42
49
|
|
43
50
|
open(File.join(Gem::Specification.default_specifications_dir, "bundler-1.15.4.gemspec"), 'w') do |io|
|
44
|
-
|
51
|
+
gemspec.version = "1.15.4"
|
52
|
+
io.puts gemspec.to_ruby
|
45
53
|
end
|
46
54
|
|
47
55
|
FileUtils.mkdir_p File.join(Gem.default_dir, "specifications")
|
56
|
+
|
57
|
+
open(File.join(Gem.default_dir, "specifications", "bundler-#{BUNDLER_VERS}.gemspec"), 'w') do |io|
|
58
|
+
io.puts "# bundler-#{BUNDLER_VERS}"
|
59
|
+
end
|
60
|
+
|
48
61
|
open(File.join(Gem.default_dir, "specifications", "bundler-audit-1.0.0.gemspec"), 'w') do |io|
|
49
62
|
io.puts '# bundler-audit'
|
50
63
|
end
|
@@ -133,13 +146,25 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
133
146
|
|
134
147
|
default_dir = Gem::Specification.default_specifications_dir
|
135
148
|
|
149
|
+
# expect to remove other versions of bundler gemspecs on default specification directory.
|
136
150
|
refute_path_exists File.join(default_dir, "bundler-1.15.4.gemspec")
|
137
|
-
|
138
|
-
|
139
|
-
assert_path_exists File.join(default_dir, "bundler-1.16.0.gemspec")
|
140
|
-
assert_path_exists 'default/gems/bundler-1.16.0'
|
151
|
+
assert_path_exists File.join(default_dir, "bundler-#{BUNDLER_VERS}.gemspec")
|
141
152
|
|
153
|
+
# expect to not remove bundler-* gemspecs.
|
142
154
|
assert_path_exists File.join(Gem.default_dir, "specifications", "bundler-audit-1.0.0.gemspec")
|
155
|
+
|
156
|
+
# expect to remove normal gem that was same version. because it's promoted default gems.
|
157
|
+
refute_path_exists File.join(Gem.default_dir, "specifications", "bundler-#{BUNDLER_VERS}.gemspec")
|
158
|
+
|
159
|
+
# expect to install default gems. It location was `site_ruby` directory on real world.
|
160
|
+
assert_path_exists "default/gems/bundler-#{BUNDLER_VERS}"
|
161
|
+
|
162
|
+
# expect to not remove other versions of bundler on `site_ruby`
|
163
|
+
assert_path_exists 'default/gems/bundler-1.15.4'
|
164
|
+
|
165
|
+
# TODO: We need to assert to remove same version of bundler on gem_dir directory(It's not site_ruby dir)
|
166
|
+
|
167
|
+
# expect to not remove bundler-* direcotyr.
|
143
168
|
assert_path_exists 'default/gems/bundler-audit-1.0.0'
|
144
169
|
end if Gem::USE_BUNDLER_FOR_GEMDEPS
|
145
170
|
|
@@ -161,14 +186,14 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
161
186
|
FileUtils.mkdir_p lib_rubygems_defaults
|
162
187
|
FileUtils.mkdir_p lib_bundler
|
163
188
|
|
164
|
-
open securerandom_rb, 'w' do |io| io.puts '# securerandom.rb' end
|
189
|
+
File.open securerandom_rb, 'w' do |io| io.puts '# securerandom.rb' end
|
165
190
|
|
166
|
-
open old_builder_rb, 'w' do |io| io.puts '# builder.rb' end
|
167
|
-
open old_format_rb, 'w' do |io| io.puts '# format.rb' end
|
168
|
-
open old_bundler_c_rb, 'w' do |io| io.puts '# c.rb' end
|
191
|
+
File.open old_builder_rb, 'w' do |io| io.puts '# builder.rb' end
|
192
|
+
File.open old_format_rb, 'w' do |io| io.puts '# format.rb' end
|
193
|
+
File.open old_bundler_c_rb, 'w' do |io| io.puts '# c.rb' end
|
169
194
|
|
170
|
-
open engine_defaults_rb, 'w' do |io| io.puts '# jruby.rb' end
|
171
|
-
open os_defaults_rb, 'w' do |io| io.puts '# operating_system.rb' end
|
195
|
+
File.open engine_defaults_rb, 'w' do |io| io.puts '# jruby.rb' end
|
196
|
+
File.open os_defaults_rb, 'w' do |io| io.puts '# operating_system.rb' end
|
172
197
|
|
173
198
|
@cmd.remove_old_lib_files lib
|
174
199
|
|
@@ -190,7 +215,7 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|
190
215
|
|
191
216
|
@cmd.options[:previous_version] = Gem::Version.new '2.0.2'
|
192
217
|
|
193
|
-
open 'History.txt', 'w' do |io|
|
218
|
+
File.open 'History.txt', 'w' do |io|
|
194
219
|
io.puts <<-History_txt
|
195
220
|
# coding: UTF-8
|
196
221
|
|
@@ -92,7 +92,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
92
92
|
# Evil hack to prevent false removal success
|
93
93
|
FileUtils.rm_f @executable
|
94
94
|
|
95
|
-
open @executable, "wb+" do |f| f.puts "binary" end
|
95
|
+
File.open @executable, "wb+" do |f| f.puts "binary" end
|
96
96
|
|
97
97
|
@cmd.options[:executables] = true
|
98
98
|
@cmd.options[:args] = [@spec.name]
|
@@ -204,7 +204,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
204
204
|
end
|
205
205
|
|
206
206
|
assert Gem::Specification.find_all_by_name('dep_x').length > 0
|
207
|
-
assert Gem::Specification.find_all_by_name('x').length
|
207
|
+
assert Gem::Specification.find_all_by_name('x').length.zero?
|
208
208
|
end
|
209
209
|
|
210
210
|
def test_execute_all
|
@@ -238,7 +238,7 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
|
238
238
|
@cmd.handle_options %w[]
|
239
239
|
|
240
240
|
assert_equal false, @cmd.options[:check_dev]
|
241
|
-
|
241
|
+
assert_nil @cmd.options[:install_dir]
|
242
242
|
assert_equal true, @cmd.options[:user_install]
|
243
243
|
assert_equal Gem::Requirement.default, @cmd.options[:version]
|
244
244
|
assert_equal false, @cmd.options[:vendor]
|
@@ -358,7 +358,7 @@ class TestGemDependency < Gem::TestCase
|
|
358
358
|
dep.to_specs
|
359
359
|
end
|
360
360
|
|
361
|
-
assert_match "Could not find 'bundler' (3.5) required by reason.\nTo update to the
|
361
|
+
assert_match "Could not find 'bundler' (3.5) required by reason.\nTo update to the latest version installed on your system, run `bundle update --bundler`.\nTo install the missing version, run `gem install bundler:3.5`\n", e.message
|
362
362
|
end
|
363
363
|
|
364
364
|
Gem::BundlerVersionFinder.stub(:bundler_version_with_reason, ["2.0.0.pre.1", "reason"]) do
|
@@ -424,7 +424,7 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
424
424
|
extconf_rb = File.join @gemhome, 'gems', 'e-1', 'extconf.rb'
|
425
425
|
FileUtils.mkdir_p File.dirname extconf_rb
|
426
426
|
|
427
|
-
open extconf_rb, 'w' do |io|
|
427
|
+
File.open extconf_rb, 'w' do |io|
|
428
428
|
io.write <<-EXTCONF_RB
|
429
429
|
require 'mkmf'
|
430
430
|
create_makefile 'e'
|
@@ -24,7 +24,7 @@ class TestGemDoctor < Gem::TestCase
|
|
24
24
|
|
25
25
|
FileUtils.rm b.spec_file
|
26
26
|
|
27
|
-
open c.spec_file, 'w' do |io|
|
27
|
+
File.open c.spec_file, 'w' do |io|
|
28
28
|
io.write 'this will raise an exception when evaluated.'
|
29
29
|
end
|
30
30
|
|
@@ -77,7 +77,7 @@ Removed directory gems/c-2
|
|
77
77
|
|
78
78
|
FileUtils.rm b.spec_file
|
79
79
|
|
80
|
-
open c.spec_file, 'w' do |io|
|
80
|
+
File.open c.spec_file, 'w' do |io|
|
81
81
|
io.write 'this will raise an exception when evaluated.'
|
82
82
|
end
|
83
83
|
|
@@ -32,7 +32,7 @@ class TestGemExtBuilder < Gem::TestCase
|
|
32
32
|
results = []
|
33
33
|
|
34
34
|
Dir.chdir @ext do
|
35
|
-
open 'Makefile', 'w' do |io|
|
35
|
+
File.open 'Makefile', 'w' do |io|
|
36
36
|
io.puts <<-MAKEFILE
|
37
37
|
all:
|
38
38
|
\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}"
|
@@ -72,7 +72,7 @@ install:
|
|
72
72
|
results = []
|
73
73
|
|
74
74
|
Dir.chdir @ext do
|
75
|
-
open 'Makefile', 'w' do |io|
|
75
|
+
File.open 'Makefile', 'w' do |io|
|
76
76
|
io.puts <<-MAKEFILE
|
77
77
|
all:
|
78
78
|
\t@#{Gem.ruby} -e "puts %Q{all: \#{ENV['DESTDIR']}}"
|
@@ -107,7 +107,7 @@ install:
|
|
107
107
|
|
108
108
|
extconf_rb = File.join ext_dir, 'extconf.rb'
|
109
109
|
|
110
|
-
open extconf_rb, 'w' do |f|
|
110
|
+
File.open extconf_rb, 'w' do |f|
|
111
111
|
f.write <<-'RUBY'
|
112
112
|
require 'mkmf'
|
113
113
|
|
@@ -168,7 +168,7 @@ install:
|
|
168
168
|
|
169
169
|
extconf_rb = File.join ext_dir, 'extconf.rb'
|
170
170
|
|
171
|
-
open extconf_rb, 'w' do |f|
|
171
|
+
File.open extconf_rb, 'w' do |f|
|
172
172
|
f.write <<-'RUBY'
|
173
173
|
require 'mkmf'
|
174
174
|
|
@@ -290,7 +290,7 @@ install:
|
|
290
290
|
|
291
291
|
FileUtils.mkdir_p @spec.gem_dir
|
292
292
|
|
293
|
-
open File.join(@spec.gem_dir, "extconf.rb"), "w" do |f|
|
293
|
+
File.open File.join(@spec.gem_dir, "extconf.rb"), "w" do |f|
|
294
294
|
f.write <<-'RUBY'
|
295
295
|
puts "IN EXTCONF"
|
296
296
|
extconf_args = File.join File.dirname(__FILE__), 'extconf_args'
|
@@ -323,7 +323,7 @@ install:
|
|
323
323
|
|
324
324
|
build_info_file = File.join build_info_dir, "#{@spec.full_name}.info"
|
325
325
|
|
326
|
-
open build_info_file, 'w' do |io|
|
326
|
+
File.open build_info_file, 'w' do |io|
|
327
327
|
io.puts '--with-foo-dir=/nonexistent'
|
328
328
|
end
|
329
329
|
|