rubygems-update 3.2.17 → 3.2.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Manifest.txt +2 -0
- data/Rakefile +1 -6
- data/bundler/CHANGELOG.md +16 -0
- data/bundler/bundler.gemspec +2 -3
- data/bundler/lib/bundler.rb +1 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +13 -33
- data/bundler/lib/bundler/cli/outdated.rb +7 -10
- data/bundler/lib/bundler/definition.rb +14 -75
- data/bundler/lib/bundler/feature_flag.rb +0 -1
- data/bundler/lib/bundler/friendly_errors.rb +1 -1
- data/bundler/lib/bundler/index.rb +1 -2
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +1 -7
- data/bundler/lib/bundler/man/bundle-config.1.ronn +0 -8
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/plugin/api/source.rb +14 -0
- data/bundler/lib/bundler/resolver.rb +13 -96
- data/bundler/lib/bundler/resolver/spec_group.rb +0 -24
- data/bundler/lib/bundler/rubygems_ext.rb +2 -2
- data/bundler/lib/bundler/settings.rb +0 -1
- data/bundler/lib/bundler/source.rb +9 -0
- data/bundler/lib/bundler/source/rubygems.rb +15 -4
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +64 -0
- data/bundler/lib/bundler/source_list.rb +29 -10
- data/bundler/lib/bundler/source_map.rb +58 -0
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems.rb +1 -1
- data/lib/rubygems/ext/ext_conf_builder.rb +4 -4
- data/lib/rubygems/specification.rb +0 -2
- data/lib/rubygems/test_case.rb +102 -18
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/test_bundled_ca.rb +2 -2
- data/test/rubygems/test_deprecate.rb +3 -3
- data/test/rubygems/test_gem.rb +33 -31
- data/test/rubygems/test_gem_bundler_version_finder.rb +2 -2
- data/test/rubygems/test_gem_command.rb +1 -1
- data/test/rubygems/test_gem_command_manager.rb +5 -5
- data/test/rubygems/test_gem_commands_build_command.rb +10 -10
- data/test/rubygems/test_gem_commands_cert_command.rb +36 -36
- data/test/rubygems/test_gem_commands_check_command.rb +5 -5
- data/test/rubygems/test_gem_commands_cleanup_command.rb +24 -24
- data/test/rubygems/test_gem_commands_contents_command.rb +3 -3
- data/test/rubygems/test_gem_commands_dependency_command.rb +2 -2
- data/test/rubygems/test_gem_commands_environment_command.rb +1 -1
- data/test/rubygems/test_gem_commands_fetch_command.rb +9 -9
- data/test/rubygems/test_gem_commands_help_command.rb +1 -1
- data/test/rubygems/test_gem_commands_install_command.rb +60 -60
- data/test/rubygems/test_gem_commands_list_command.rb +1 -1
- data/test/rubygems/test_gem_commands_lock_command.rb +1 -1
- data/test/rubygems/test_gem_commands_open_command.rb +8 -9
- data/test/rubygems/test_gem_commands_owner_command.rb +3 -3
- data/test/rubygems/test_gem_commands_pristine_command.rb +14 -14
- data/test/rubygems/test_gem_commands_push_command.rb +6 -6
- data/test/rubygems/test_gem_commands_query_command.rb +7 -7
- data/test/rubygems/test_gem_commands_server_command.rb +2 -2
- data/test/rubygems/test_gem_commands_setup_command.rb +21 -21
- data/test/rubygems/test_gem_commands_signin_command.rb +6 -6
- data/test/rubygems/test_gem_commands_sources_command.rb +5 -5
- data/test/rubygems/test_gem_commands_specification_command.rb +6 -6
- data/test/rubygems/test_gem_commands_uninstall_command.rb +4 -4
- data/test/rubygems/test_gem_commands_unpack_command.rb +2 -2
- data/test/rubygems/test_gem_commands_update_command.rb +10 -10
- data/test/rubygems/test_gem_commands_which_command.rb +3 -3
- data/test/rubygems/test_gem_commands_yank_command.rb +1 -1
- data/test/rubygems/test_gem_config_file.rb +9 -9
- data/test/rubygems/test_gem_dependency.rb +6 -6
- data/test/rubygems/test_gem_dependency_installer.rb +4 -4
- data/test/rubygems/test_gem_doctor.rb +30 -30
- data/test/rubygems/test_gem_ext_builder.rb +20 -20
- data/test/rubygems/test_gem_ext_cmake_builder.rb +4 -4
- data/test/rubygems/test_gem_ext_configure_builder.rb +4 -4
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +14 -13
- data/test/rubygems/test_gem_ext_rake_builder.rb +1 -1
- data/test/rubygems/test_gem_gemcutter_utilities.rb +8 -8
- data/test/rubygems/test_gem_install_update_options.rb +9 -9
- data/test/rubygems/test_gem_installer.rb +142 -140
- data/test/rubygems/test_gem_local_remote_options.rb +1 -1
- data/test/rubygems/test_gem_package.rb +48 -48
- data/test/rubygems/test_gem_package_old.rb +9 -9
- data/test/rubygems/test_gem_package_tar_header.rb +5 -5
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +8 -8
- data/test/rubygems/test_gem_package_tar_writer.rb +18 -20
- data/test/rubygems/test_gem_package_task.rb +2 -2
- data/test/rubygems/test_gem_path_support.rb +1 -1
- data/test/rubygems/test_gem_rdoc.rb +9 -9
- data/test/rubygems/test_gem_remote_fetcher.rb +17 -18
- data/test/rubygems/test_gem_request.rb +2 -2
- data/test/rubygems/test_gem_request_connection_pools.rb +1 -1
- data/test/rubygems/test_gem_request_set.rb +15 -14
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +16 -16
- data/test/rubygems/test_gem_request_set_lockfile.rb +3 -3
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +3 -3
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +4 -4
- data/test/rubygems/test_gem_requirement.rb +13 -13
- data/test/rubygems/test_gem_resolver.rb +11 -11
- data/test/rubygems/test_gem_resolver_best_set.rb +1 -1
- data/test/rubygems/test_gem_resolver_git_set.rb +1 -1
- data/test/rubygems/test_gem_resolver_git_specification.rb +2 -2
- data/test/rubygems/test_gem_resolver_index_specification.rb +1 -1
- data/test/rubygems/test_gem_resolver_installer_set.rb +4 -4
- data/test/rubygems/test_gem_resolver_local_specification.rb +1 -1
- data/test/rubygems/test_gem_resolver_specification.rb +1 -1
- data/test/rubygems/test_gem_resolver_vendor_set.rb +2 -2
- data/test/rubygems/test_gem_security.rb +5 -5
- data/test/rubygems/test_gem_security_policy.rb +27 -27
- data/test/rubygems/test_gem_security_signer.rb +7 -7
- data/test/rubygems/test_gem_security_trust_dir.rb +4 -4
- data/test/rubygems/test_gem_server.rb +2 -2
- data/test/rubygems/test_gem_silent_ui.rb +9 -9
- data/test/rubygems/test_gem_source.rb +2 -2
- data/test/rubygems/test_gem_source_fetch_problem.rb +1 -1
- data/test/rubygems/test_gem_source_git.rb +11 -11
- data/test/rubygems/test_gem_source_specific_file.rb +1 -1
- data/test/rubygems/test_gem_spec_fetcher.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +83 -103
- data/test/rubygems/test_gem_stream_ui.rb +1 -1
- data/test/rubygems/test_gem_stub_specification.rb +4 -4
- data/test/rubygems/test_gem_uninstaller.rb +16 -16
- data/test/rubygems/test_gem_util.rb +8 -6
- data/test/rubygems/test_gem_version.rb +4 -13
- data/test/rubygems/test_kernel.rb +4 -4
- data/test/rubygems/test_project_sanity.rb +1 -1
- data/test/rubygems/test_remote_fetch_error.rb +1 -1
- data/test/rubygems/test_require.rb +13 -13
- data/test/test_changelog_generator.rb +1 -2
- metadata +5 -3
@@ -105,7 +105,7 @@ module Gem
|
|
105
105
|
end
|
106
106
|
|
107
107
|
class Dependency
|
108
|
-
attr_accessor :source, :groups
|
108
|
+
attr_accessor :source, :groups
|
109
109
|
|
110
110
|
alias_method :eql?, :==
|
111
111
|
|
@@ -116,7 +116,7 @@ module Gem
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def to_yaml_properties
|
119
|
-
instance_variables.reject {|p| ["@source", "@groups"
|
119
|
+
instance_variables.reject {|p| ["@source", "@groups"].include?(p.to_s) }
|
120
120
|
end
|
121
121
|
|
122
122
|
def to_lock
|
@@ -7,6 +7,7 @@ module Bundler
|
|
7
7
|
autoload :Metadata, File.expand_path("source/metadata", __dir__)
|
8
8
|
autoload :Path, File.expand_path("source/path", __dir__)
|
9
9
|
autoload :Rubygems, File.expand_path("source/rubygems", __dir__)
|
10
|
+
autoload :RubygemsAggregate, File.expand_path("source/rubygems_aggregate", __dir__)
|
10
11
|
|
11
12
|
attr_accessor :dependency_names
|
12
13
|
|
@@ -39,6 +40,10 @@ module Bundler
|
|
39
40
|
|
40
41
|
def remote!; end
|
41
42
|
|
43
|
+
def add_dependency_names(names)
|
44
|
+
@dependency_names = Array(dependency_names) | Array(names)
|
45
|
+
end
|
46
|
+
|
42
47
|
# it's possible that gems from one source depend on gems from some
|
43
48
|
# other source, so now we download gemspecs and iterate over those
|
44
49
|
# dependencies, looking for gems we don't have info on yet.
|
@@ -48,6 +53,10 @@ module Bundler
|
|
48
53
|
specs.dependency_names
|
49
54
|
end
|
50
55
|
|
56
|
+
def spec_names
|
57
|
+
specs.spec_names
|
58
|
+
end
|
59
|
+
|
51
60
|
def include?(other)
|
52
61
|
other == self
|
53
62
|
end
|
@@ -259,8 +259,16 @@ module Bundler
|
|
259
259
|
!equivalent
|
260
260
|
end
|
261
261
|
|
262
|
+
def spec_names
|
263
|
+
if @allow_remote && dependency_api_available?
|
264
|
+
remote_specs.spec_names
|
265
|
+
else
|
266
|
+
[]
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
262
270
|
def unmet_deps
|
263
|
-
if @allow_remote &&
|
271
|
+
if @allow_remote && dependency_api_available?
|
264
272
|
remote_specs.unmet_dependency_names
|
265
273
|
else
|
266
274
|
[]
|
@@ -276,7 +284,7 @@ module Bundler
|
|
276
284
|
|
277
285
|
def double_check_for(unmet_dependency_names)
|
278
286
|
return unless @allow_remote
|
279
|
-
return unless
|
287
|
+
return unless dependency_api_available?
|
280
288
|
|
281
289
|
unmet_dependency_names = unmet_dependency_names.call
|
282
290
|
unless unmet_dependency_names.nil?
|
@@ -298,17 +306,20 @@ module Bundler
|
|
298
306
|
remote_specs.each do |spec|
|
299
307
|
case spec
|
300
308
|
when EndpointSpecification, Gem::Specification, StubSpecification, LazySpecification
|
301
|
-
names.concat(spec.runtime_dependencies)
|
309
|
+
names.concat(spec.runtime_dependencies.map(&:name))
|
302
310
|
when RemoteSpecification # from the full index
|
303
311
|
return nil
|
304
312
|
else
|
305
313
|
raise "unhandled spec type (#{spec.inspect})"
|
306
314
|
end
|
307
315
|
end
|
308
|
-
names.map!(&:name) if names
|
309
316
|
names
|
310
317
|
end
|
311
318
|
|
319
|
+
def dependency_api_available?
|
320
|
+
api_fetchers.any?
|
321
|
+
end
|
322
|
+
|
312
323
|
protected
|
313
324
|
|
314
325
|
def credless_remotes
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class Source
|
5
|
+
class RubygemsAggregate
|
6
|
+
attr_reader :source_map, :sources
|
7
|
+
|
8
|
+
def initialize(sources, source_map)
|
9
|
+
@sources = sources
|
10
|
+
@source_map = source_map
|
11
|
+
|
12
|
+
@index = build_index
|
13
|
+
end
|
14
|
+
|
15
|
+
def specs
|
16
|
+
@index
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_s
|
20
|
+
"any of the sources"
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def build_index
|
26
|
+
Index.build do |idx|
|
27
|
+
dependency_names = source_map.pinned_spec_names
|
28
|
+
|
29
|
+
sources.all_sources.each do |source|
|
30
|
+
source.dependency_names = dependency_names - source_map.pinned_spec_names(source)
|
31
|
+
idx.add_source source.specs
|
32
|
+
dependency_names.concat(source.unmet_deps).uniq!
|
33
|
+
end
|
34
|
+
|
35
|
+
double_check_for_index(idx, dependency_names)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Suppose the gem Foo depends on the gem Bar. Foo exists in Source A. Bar has some versions that exist in both
|
40
|
+
# sources A and B. At this point, the API request will have found all the versions of Bar in source A,
|
41
|
+
# but will not have found any versions of Bar from source B, which is a problem if the requested version
|
42
|
+
# of Foo specifically depends on a version of Bar that is only found in source B. This ensures that for
|
43
|
+
# each spec we found, we add all possible versions from all sources to the index.
|
44
|
+
def double_check_for_index(idx, dependency_names)
|
45
|
+
pinned_names = source_map.pinned_spec_names
|
46
|
+
|
47
|
+
names = :names # do this so we only have to traverse to get dependency_names from the index once
|
48
|
+
unmet_dependency_names = lambda do
|
49
|
+
return names unless names == :names
|
50
|
+
new_names = sources.all_sources.map(&:dependency_names_to_double_check)
|
51
|
+
return names = nil if new_names.compact!
|
52
|
+
names = new_names.flatten(1).concat(dependency_names)
|
53
|
+
names.uniq!
|
54
|
+
names -= pinned_names
|
55
|
+
names
|
56
|
+
end
|
57
|
+
|
58
|
+
sources.all_sources.each do |source|
|
59
|
+
source.double_check_for(unmet_dependency_names)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -21,15 +21,19 @@ module Bundler
|
|
21
21
|
@rubygems_sources = []
|
22
22
|
@metadata_source = Source::Metadata.new
|
23
23
|
|
24
|
-
@
|
24
|
+
@merged_gem_lockfile_sections = false
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
28
|
-
@
|
27
|
+
def merged_gem_lockfile_sections?
|
28
|
+
@merged_gem_lockfile_sections
|
29
29
|
end
|
30
30
|
|
31
31
|
def merged_gem_lockfile_sections!
|
32
|
-
@
|
32
|
+
@merged_gem_lockfile_sections = true
|
33
|
+
end
|
34
|
+
|
35
|
+
def no_aggregate_global_source?
|
36
|
+
global_rubygems_source.remotes.size <= 1
|
33
37
|
end
|
34
38
|
|
35
39
|
def add_path_source(options = {})
|
@@ -70,7 +74,11 @@ module Bundler
|
|
70
74
|
end
|
71
75
|
|
72
76
|
def rubygems_sources
|
73
|
-
|
77
|
+
non_global_rubygems_sources + [global_rubygems_source]
|
78
|
+
end
|
79
|
+
|
80
|
+
def non_global_rubygems_sources
|
81
|
+
@rubygems_sources
|
74
82
|
end
|
75
83
|
|
76
84
|
def rubygems_remotes
|
@@ -81,16 +89,27 @@ module Bundler
|
|
81
89
|
path_sources + git_sources + plugin_sources + rubygems_sources + [metadata_source]
|
82
90
|
end
|
83
91
|
|
92
|
+
def non_default_explicit_sources
|
93
|
+
all_sources - [default_source, metadata_source]
|
94
|
+
end
|
95
|
+
|
84
96
|
def get(source)
|
85
97
|
source_list_for(source).find {|s| equal_source?(source, s) || equivalent_source?(source, s) }
|
86
98
|
end
|
87
99
|
|
88
100
|
def lock_sources
|
89
|
-
|
90
|
-
|
91
|
-
|
101
|
+
lock_other_sources + lock_rubygems_sources
|
102
|
+
end
|
103
|
+
|
104
|
+
def lock_other_sources
|
105
|
+
(path_sources + git_sources + plugin_sources).sort_by(&:to_s)
|
106
|
+
end
|
107
|
+
|
108
|
+
def lock_rubygems_sources
|
109
|
+
if merged_gem_lockfile_sections?
|
110
|
+
[combine_rubygems_sources]
|
92
111
|
else
|
93
|
-
|
112
|
+
rubygems_sources.sort_by(&:to_s).uniq
|
94
113
|
end
|
95
114
|
end
|
96
115
|
|
@@ -104,7 +123,7 @@ module Bundler
|
|
104
123
|
end
|
105
124
|
end
|
106
125
|
|
107
|
-
replacement_rubygems =
|
126
|
+
replacement_rubygems = merged_gem_lockfile_sections? &&
|
108
127
|
replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
|
109
128
|
@global_rubygems_source = replacement_rubygems if replacement_rubygems
|
110
129
|
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class SourceMap
|
5
|
+
attr_reader :sources, :dependencies
|
6
|
+
|
7
|
+
def initialize(sources, dependencies)
|
8
|
+
@sources = sources
|
9
|
+
@dependencies = dependencies
|
10
|
+
end
|
11
|
+
|
12
|
+
def pinned_spec_names(skip = nil)
|
13
|
+
direct_requirements.reject {|_, source| source == skip }.keys
|
14
|
+
end
|
15
|
+
|
16
|
+
def all_requirements
|
17
|
+
requirements = direct_requirements.dup
|
18
|
+
|
19
|
+
unmet_deps = sources.non_default_explicit_sources.map do |source|
|
20
|
+
(source.spec_names - pinned_spec_names).each do |indirect_dependency_name|
|
21
|
+
previous_source = requirements[indirect_dependency_name]
|
22
|
+
if previous_source.nil?
|
23
|
+
requirements[indirect_dependency_name] = source
|
24
|
+
else
|
25
|
+
no_ambiguous_sources = Bundler.feature_flag.bundler_3_mode?
|
26
|
+
|
27
|
+
msg = ["The gem '#{indirect_dependency_name}' was found in multiple relevant sources."]
|
28
|
+
msg.concat [previous_source, source].map {|s| " * #{s}" }.sort
|
29
|
+
msg << "You #{no_ambiguous_sources ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
|
30
|
+
msg = msg.join("\n")
|
31
|
+
|
32
|
+
raise SecurityError, msg if no_ambiguous_sources
|
33
|
+
Bundler.ui.warn "Warning: #{msg}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
source.unmet_deps
|
38
|
+
end
|
39
|
+
|
40
|
+
sources.default_source.add_dependency_names(unmet_deps.flatten - requirements.keys)
|
41
|
+
|
42
|
+
requirements
|
43
|
+
end
|
44
|
+
|
45
|
+
def direct_requirements
|
46
|
+
@direct_requirements ||= begin
|
47
|
+
requirements = {}
|
48
|
+
default = sources.default_source
|
49
|
+
dependencies.each do |dep|
|
50
|
+
dep_source = dep.source || default
|
51
|
+
dep_source.add_dependency_names(dep.name)
|
52
|
+
requirements[dep.name] = dep_source
|
53
|
+
end
|
54
|
+
requirements
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
<%- if config[:mit] -%>
|
15
15
|
spec.license = "MIT"
|
16
16
|
<%- end -%>
|
17
|
-
spec.required_ruby_version =
|
17
|
+
spec.required_ruby_version = ">= <%= config[:required_ruby_version] %>"
|
18
18
|
|
19
19
|
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
20
|
|
data/lib/rubygems.rb
CHANGED
@@ -23,11 +23,11 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
23
23
|
# spaces do not work.
|
24
24
|
#
|
25
25
|
# Details: https://github.com/rubygems/rubygems/issues/977#issuecomment-171544940
|
26
|
-
|
26
|
+
tmp_dest_relative = get_relative_path(tmp_dest.clone, extension_dir)
|
27
27
|
|
28
28
|
Tempfile.open %w[siteconf .rb], extension_dir do |siteconf|
|
29
29
|
siteconf.puts "require 'rbconfig'"
|
30
|
-
siteconf.puts "dest_path = #{
|
30
|
+
siteconf.puts "dest_path = #{tmp_dest_relative.dump}"
|
31
31
|
%w[sitearchdir sitelibdir].each do |dir|
|
32
32
|
siteconf.puts "RbConfig::MAKEFILE_CONFIG['#{dir}'] = dest_path"
|
33
33
|
siteconf.puts "RbConfig::CONFIG['#{dir}'] = dest_path"
|
@@ -63,8 +63,8 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder
|
|
63
63
|
|
64
64
|
make dest_path, results, extension_dir
|
65
65
|
|
66
|
-
if
|
67
|
-
full_tmp_dest = File.join(extension_dir,
|
66
|
+
if tmp_dest_relative
|
67
|
+
full_tmp_dest = File.join(extension_dir, tmp_dest_relative)
|
68
68
|
|
69
69
|
# TODO remove in RubyGems 3
|
70
70
|
if Gem.install_extension_in_lib and lib_dir
|
@@ -1558,7 +1558,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1558
1558
|
def build_extensions # :nodoc:
|
1559
1559
|
return if default_gem?
|
1560
1560
|
return if extensions.empty?
|
1561
|
-
return if installed_by_version < Gem::Version.new('2.2.0.preview.2')
|
1562
1561
|
return if File.exist? gem_build_complete_path
|
1563
1562
|
return if !File.writable?(base_dir)
|
1564
1563
|
return if !File.exist?(File.join(base_dir, 'extensions'))
|
@@ -2129,7 +2128,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2129
2128
|
def missing_extensions?
|
2130
2129
|
return false if default_gem?
|
2131
2130
|
return false if extensions.empty?
|
2132
|
-
return false if installed_by_version < Gem::Version.new('2.2.0.preview.2')
|
2133
2131
|
return false if File.exist? gem_build_complete_path
|
2134
2132
|
|
2135
2133
|
true
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -12,7 +12,7 @@ if File.exist?(bundler_gemspec)
|
|
12
12
|
end
|
13
13
|
|
14
14
|
begin
|
15
|
-
gem '
|
15
|
+
gem 'test-unit', '~> 3.0'
|
16
16
|
rescue Gem::LoadError
|
17
17
|
end
|
18
18
|
|
@@ -32,16 +32,7 @@ else
|
|
32
32
|
require 'bundler'
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
if ENV["RG_BISECT_SERVER_PLUGIN"]
|
37
|
-
require ENV["RG_BISECT_SERVER_PLUGIN"]
|
38
|
-
|
39
|
-
Minitest.extensions << "server"
|
40
|
-
end
|
41
|
-
|
42
|
-
ENV["MT_NO_PLUGINS"] = "true"
|
43
|
-
|
44
|
-
require 'minitest/autorun'
|
35
|
+
require 'test/unit'
|
45
36
|
|
46
37
|
ENV["JARS_SKIP"] = "true" if Gem.java_platform? # avoid unnecessary and noisy `jar-dependencies` post install hook
|
47
38
|
|
@@ -111,7 +102,7 @@ end
|
|
111
102
|
# and uninstall gems, fetch remote gems through a stub fetcher and be assured
|
112
103
|
# your normal set of gems is not affected.
|
113
104
|
|
114
|
-
class Gem::TestCase <
|
105
|
+
class Gem::TestCase < Test::Unit::TestCase
|
115
106
|
extend Gem::Deprecate
|
116
107
|
|
117
108
|
attr_accessor :fetcher # :nodoc:
|
@@ -140,11 +131,48 @@ class Gem::TestCase < Minitest::Test
|
|
140
131
|
end
|
141
132
|
|
142
133
|
def assert_directory_exists(path, msg = nil)
|
143
|
-
msg =
|
144
|
-
|
134
|
+
msg = build_message(msg, "Expected path '#{path}' to be a directory")
|
135
|
+
assert_path_exist path
|
145
136
|
assert File.directory?(path), msg
|
146
137
|
end
|
147
138
|
|
139
|
+
# https://github.com/seattlerb/minitest/blob/21d9e804b63c619f602f3f4ece6c71b48974707a/lib/minitest/assertions.rb#L188
|
140
|
+
def _synchronize
|
141
|
+
yield
|
142
|
+
end
|
143
|
+
|
144
|
+
# https://github.com/seattlerb/minitest/blob/21d9e804b63c619f602f3f4ece6c71b48974707a/lib/minitest/assertions.rb#L546
|
145
|
+
def capture_subprocess_io
|
146
|
+
_synchronize do
|
147
|
+
begin
|
148
|
+
require "tempfile"
|
149
|
+
|
150
|
+
captured_stdout, captured_stderr = Tempfile.new("out"), Tempfile.new("err")
|
151
|
+
|
152
|
+
orig_stdout, orig_stderr = $stdout.dup, $stderr.dup
|
153
|
+
$stdout.reopen captured_stdout
|
154
|
+
$stderr.reopen captured_stderr
|
155
|
+
|
156
|
+
yield
|
157
|
+
|
158
|
+
$stdout.rewind
|
159
|
+
$stderr.rewind
|
160
|
+
|
161
|
+
return captured_stdout.read, captured_stderr.read
|
162
|
+
ensure
|
163
|
+
captured_stdout.unlink
|
164
|
+
captured_stderr.unlink
|
165
|
+
$stdout.reopen orig_stdout
|
166
|
+
$stderr.reopen orig_stderr
|
167
|
+
|
168
|
+
orig_stdout.close
|
169
|
+
orig_stderr.close
|
170
|
+
captured_stdout.close
|
171
|
+
captured_stderr.close
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
148
176
|
##
|
149
177
|
# Sets the ENABLE_SHARED entry in RbConfig::CONFIG to +value+ and restores
|
150
178
|
# the original value when the block ends
|
@@ -262,19 +290,19 @@ class Gem::TestCase < Minitest::Test
|
|
262
290
|
|
263
291
|
def assert_contains_make_command(target, output, msg = nil)
|
264
292
|
if output.match(/\n/)
|
265
|
-
msg =
|
293
|
+
msg = build_message(msg,
|
266
294
|
"Expected output containing make command \"%s\", but was \n\nBEGIN_OF_OUTPUT\n%sEND_OF_OUTPUT" % [
|
267
295
|
('%s %s' % [make_command, target]).rstrip,
|
268
296
|
output,
|
269
297
|
]
|
270
|
-
|
298
|
+
)
|
271
299
|
else
|
272
|
-
msg =
|
300
|
+
msg = build_message(msg,
|
273
301
|
'Expected make command "%s": %s' % [
|
274
302
|
('%s %s' % [make_command, target]).rstrip,
|
275
303
|
output,
|
276
304
|
]
|
277
|
-
|
305
|
+
)
|
278
306
|
end
|
279
307
|
|
280
308
|
assert scan_make_command_lines(output).any? {|line|
|
@@ -664,6 +692,28 @@ class Gem::TestCase < Minitest::Test
|
|
664
692
|
path
|
665
693
|
end
|
666
694
|
|
695
|
+
##
|
696
|
+
# Load a YAML string, the psych 3 way
|
697
|
+
|
698
|
+
def load_yaml(yaml)
|
699
|
+
if YAML.respond_to?(:unsafe_load)
|
700
|
+
YAML.unsafe_load(yaml)
|
701
|
+
else
|
702
|
+
YAML.load(yaml)
|
703
|
+
end
|
704
|
+
end
|
705
|
+
|
706
|
+
##
|
707
|
+
# Load a YAML file, the psych 3 way
|
708
|
+
|
709
|
+
def load_yaml_file(file)
|
710
|
+
if YAML.respond_to?(:unsafe_load_file)
|
711
|
+
YAML.unsafe_load_file(file)
|
712
|
+
else
|
713
|
+
YAML.load_file(file)
|
714
|
+
end
|
715
|
+
end
|
716
|
+
|
667
717
|
def all_spec_names
|
668
718
|
Gem::Specification.map(&:full_name)
|
669
719
|
end
|
@@ -1519,4 +1569,38 @@ Also, a list:
|
|
1519
1569
|
end if Gem::HAVE_OPENSSL
|
1520
1570
|
end
|
1521
1571
|
|
1572
|
+
# https://github.com/seattlerb/minitest/blob/13c48a03d84a2a87855a4de0c959f96800100357/lib/minitest/mock.rb#L192
|
1573
|
+
class Object
|
1574
|
+
def stub(name, val_or_callable, *block_args)
|
1575
|
+
new_name = "__minitest_stub__#{name}"
|
1576
|
+
|
1577
|
+
metaclass = class << self; self; end
|
1578
|
+
|
1579
|
+
if respond_to? name and not methods.map(&:to_s).include? name.to_s
|
1580
|
+
metaclass.send :define_method, name do |*args|
|
1581
|
+
super(*args)
|
1582
|
+
end
|
1583
|
+
end
|
1584
|
+
|
1585
|
+
metaclass.send :alias_method, new_name, name
|
1586
|
+
|
1587
|
+
metaclass.send :define_method, name do |*args, &blk|
|
1588
|
+
if val_or_callable.respond_to? :call
|
1589
|
+
val_or_callable.call(*args, &blk)
|
1590
|
+
else
|
1591
|
+
blk.call(*block_args) if blk
|
1592
|
+
val_or_callable
|
1593
|
+
end
|
1594
|
+
end
|
1595
|
+
|
1596
|
+
metaclass.send(:ruby2_keywords, name) if metaclass.respond_to?(:ruby2_keywords, true)
|
1597
|
+
|
1598
|
+
yield self
|
1599
|
+
ensure
|
1600
|
+
metaclass.send :undef_method, name
|
1601
|
+
metaclass.send :alias_method, name, new_name
|
1602
|
+
metaclass.send :undef_method, new_name
|
1603
|
+
end
|
1604
|
+
end
|
1605
|
+
|
1522
1606
|
require 'rubygems/test_utilities'
|