rubygems-update 3.2.5 → 3.2.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +50 -0
- data/Manifest.txt +2 -0
- data/Rakefile +15 -14
- data/bundler/CHANGELOG.md +73 -0
- data/bundler/lib/bundler.rb +1 -1
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli.rb +1 -0
- data/bundler/lib/bundler/cli/cache.rb +1 -0
- data/bundler/lib/bundler/cli/gem.rb +12 -0
- data/bundler/lib/bundler/definition.rb +66 -56
- data/bundler/lib/bundler/dep_proxy.rb +15 -8
- data/bundler/lib/bundler/dsl.rb +38 -25
- data/bundler/lib/bundler/feature_flag.rb +0 -2
- data/bundler/lib/bundler/fetcher.rb +0 -1
- data/bundler/lib/bundler/gem_helper.rb +8 -6
- data/bundler/lib/bundler/gem_version_promoter.rb +2 -2
- data/bundler/lib/bundler/index.rb +6 -5
- data/bundler/lib/bundler/inline.rb +1 -0
- data/bundler/lib/bundler/installer.rb +0 -17
- data/bundler/lib/bundler/installer/standalone.rb +15 -0
- data/bundler/lib/bundler/lazy_specification.rb +9 -18
- data/bundler/lib/bundler/lockfile_parser.rb +12 -8
- 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 +6 -12
- data/bundler/lib/bundler/man/bundle-config.1.ronn +11 -18
- 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.rb +1 -0
- data/bundler/lib/bundler/plugin/installer.rb +8 -9
- data/bundler/lib/bundler/resolver.rb +110 -80
- data/bundler/lib/bundler/resolver/spec_group.rb +56 -44
- data/bundler/lib/bundler/rubygems_ext.rb +16 -0
- data/bundler/lib/bundler/settings.rb +1 -2
- data/bundler/lib/bundler/shared_helpers.rb +2 -2
- data/bundler/lib/bundler/source/git.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +10 -2
- data/bundler/lib/bundler/source_list.rb +34 -25
- data/bundler/lib/bundler/spec_set.rb +5 -4
- data/bundler/lib/bundler/templates/newgem/CHANGELOG.md.tt +5 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -1
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +2 -2
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +11 -7
- data/bundler/lib/bundler/vendor/thor/lib/thor.rb +5 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +4 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +5 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +9 -8
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +5 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems.rb +3 -3
- data/lib/rubygems/command.rb +1 -0
- data/lib/rubygems/dependency.rb +5 -1
- data/lib/rubygems/ext/builder.rb +2 -1
- data/lib/rubygems/installer_uninstaller_utils.rb +6 -1
- data/lib/rubygems/platform.rb +0 -4
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver/index_specification.rb +4 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb +7 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +0 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/vertex.rb +11 -5
- data/lib/rubygems/resolver/molinillo/lib/molinillo/errors.rb +2 -2
- data/lib/rubygems/resolver/molinillo/lib/molinillo/modules/specification_provider.rb +11 -0
- data/lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb +11 -7
- data/lib/rubygems/specification.rb +13 -11
- data/lib/rubygems/test_case.rb +5 -6
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/data/null-required-ruby-version.gemspec.rz +0 -0
- data/test/rubygems/test_gem.rb +85 -8
- data/test/rubygems/test_gem_commands_outdated_command.rb +18 -0
- data/test/rubygems/test_gem_dependency_installer.rb +27 -18
- data/test/rubygems/test_gem_ext_builder.rb +24 -0
- data/test/rubygems/test_gem_installer.rb +2 -0
- data/test/rubygems/test_gem_platform.rb +8 -0
- data/test/rubygems/test_gem_requirement.rb +35 -1
- data/test/rubygems/test_gem_specification.rb +10 -15
- data/test/rubygems/test_gem_stream_ui.rb +1 -1
- data/test/rubygems/test_gem_util.rb +4 -4
- metadata +5 -3
@@ -59,7 +59,7 @@ module Gem::Resolver::Molinillo
|
|
59
59
|
# @param [Set<Vertex>] vertices the set to add the predecessors to
|
60
60
|
# @return [Set<Vertex>] the vertices of {#graph} where `self` is a
|
61
61
|
# {#descendent?}
|
62
|
-
def _recursive_predecessors(vertices =
|
62
|
+
def _recursive_predecessors(vertices = new_vertex_set)
|
63
63
|
incoming_edges.each do |edge|
|
64
64
|
vertex = edge.origin
|
65
65
|
next unless vertices.add?(vertex)
|
@@ -85,7 +85,7 @@ module Gem::Resolver::Molinillo
|
|
85
85
|
# @param [Set<Vertex>] vertices the set to add the successors to
|
86
86
|
# @return [Set<Vertex>] the vertices of {#graph} where `self` is an
|
87
87
|
# {#ancestor?}
|
88
|
-
def _recursive_successors(vertices =
|
88
|
+
def _recursive_successors(vertices = new_vertex_set)
|
89
89
|
outgoing_edges.each do |edge|
|
90
90
|
vertex = edge.destination
|
91
91
|
next unless vertices.add?(vertex)
|
@@ -128,7 +128,7 @@ module Gem::Resolver::Molinillo
|
|
128
128
|
|
129
129
|
# Is there a path from `self` to `other` following edges in the
|
130
130
|
# dependency graph?
|
131
|
-
# @return
|
131
|
+
# @return whether there is a path following edges within this {#graph}
|
132
132
|
def path_to?(other)
|
133
133
|
_path_to?(other)
|
134
134
|
end
|
@@ -138,7 +138,7 @@ module Gem::Resolver::Molinillo
|
|
138
138
|
# @param [Vertex] other the vertex to check if there's a path to
|
139
139
|
# @param [Set<Vertex>] visited the vertices of {#graph} that have been visited
|
140
140
|
# @return [Boolean] whether there is a path to `other` from `self`
|
141
|
-
def _path_to?(other, visited =
|
141
|
+
def _path_to?(other, visited = new_vertex_set)
|
142
142
|
return false unless visited.add?(self)
|
143
143
|
return true if equal?(other)
|
144
144
|
successors.any? { |v| v._path_to?(other, visited) }
|
@@ -147,12 +147,18 @@ module Gem::Resolver::Molinillo
|
|
147
147
|
|
148
148
|
# Is there a path from `other` to `self` following edges in the
|
149
149
|
# dependency graph?
|
150
|
-
# @return
|
150
|
+
# @return whether there is a path following edges within this {#graph}
|
151
151
|
def ancestor?(other)
|
152
152
|
other.path_to?(self)
|
153
153
|
end
|
154
154
|
|
155
155
|
alias is_reachable_from? ancestor?
|
156
|
+
|
157
|
+
def new_vertex_set
|
158
|
+
require 'set'
|
159
|
+
Set.new
|
160
|
+
end
|
161
|
+
private :new_vertex_set
|
156
162
|
end
|
157
163
|
end
|
158
164
|
end
|
@@ -34,7 +34,7 @@ module Gem::Resolver::Molinillo
|
|
34
34
|
|
35
35
|
# An error caused by attempting to fulfil a dependency that was circular
|
36
36
|
#
|
37
|
-
# @note This exception will be thrown
|
37
|
+
# @note This exception will be thrown if and only if a {Vertex} is added to a
|
38
38
|
# {DependencyGraph} that has a {DependencyGraph::Vertex#path_to?} an
|
39
39
|
# existing {DependencyGraph::Vertex}
|
40
40
|
class CircularDependencyError < ResolverError
|
@@ -121,7 +121,7 @@ module Gem::Resolver::Molinillo
|
|
121
121
|
t = ''.dup
|
122
122
|
depth = 2
|
123
123
|
tree.each do |req|
|
124
|
-
t << ' ' * depth << req
|
124
|
+
t << ' ' * depth << printable_requirement.call(req)
|
125
125
|
unless tree.last == req
|
126
126
|
if spec = conflict.activated_by_name[name_for(req)]
|
127
127
|
t << %( was resolved to #{version_for_spec.call(spec)}, which)
|
@@ -45,6 +45,17 @@ module Gem::Resolver::Molinillo
|
|
45
45
|
true
|
46
46
|
end
|
47
47
|
|
48
|
+
# Determines whether two arrays of dependencies are equal, and thus can be
|
49
|
+
# grouped.
|
50
|
+
#
|
51
|
+
# @param [Array<Object>] dependencies
|
52
|
+
# @param [Array<Object>] other_dependencies
|
53
|
+
# @return [Boolean] whether `dependencies` and `other_dependencies` should
|
54
|
+
# be considered equal.
|
55
|
+
def dependencies_equal?(dependencies, other_dependencies)
|
56
|
+
dependencies == other_dependencies
|
57
|
+
end
|
58
|
+
|
48
59
|
# Returns the name for the given `dependency`.
|
49
60
|
# @note This method should be 'pure', i.e. the return value should depend
|
50
61
|
# only on the `dependency` parameter.
|
@@ -329,11 +329,11 @@ module Gem::Resolver::Molinillo
|
|
329
329
|
|
330
330
|
# Look for past conflicts that could be unwound to affect the
|
331
331
|
# requirement tree for the current conflict
|
332
|
+
all_reqs = last_detail_for_current_unwind.all_requirements
|
333
|
+
all_reqs_size = all_reqs.size
|
332
334
|
relevant_unused_unwinds = unused_unwind_options.select do |alternative|
|
333
|
-
|
334
|
-
|
335
|
-
alternative.requirements_unwound_to_instead
|
336
|
-
next if intersecting_requirements.empty?
|
335
|
+
diff_reqs = all_reqs - alternative.requirements_unwound_to_instead
|
336
|
+
next if diff_reqs.size == all_reqs_size
|
337
337
|
# Find the highest index unwind whilst looping through
|
338
338
|
current_detail = alternative if alternative > current_detail
|
339
339
|
alternative
|
@@ -344,8 +344,12 @@ module Gem::Resolver::Molinillo
|
|
344
344
|
state.unused_unwind_options += unwind_details.reject { |detail| detail.state_index == -1 }
|
345
345
|
|
346
346
|
# Update the requirements_unwound_to_instead on any relevant unused unwinds
|
347
|
-
relevant_unused_unwinds.each
|
348
|
-
|
347
|
+
relevant_unused_unwinds.each do |d|
|
348
|
+
(d.requirements_unwound_to_instead << current_detail.state_requirement).uniq!
|
349
|
+
end
|
350
|
+
unwind_details.each do |d|
|
351
|
+
(d.requirements_unwound_to_instead << current_detail.state_requirement).uniq!
|
352
|
+
end
|
349
353
|
|
350
354
|
current_detail
|
351
355
|
end
|
@@ -803,7 +807,7 @@ module Gem::Resolver::Molinillo
|
|
803
807
|
|
804
808
|
possibilities.reverse_each do |possibility|
|
805
809
|
dependencies = dependencies_for(possibility)
|
806
|
-
if current_possibility_set && current_possibility_set.dependencies
|
810
|
+
if current_possibility_set && dependencies_equal?(current_possibility_set.dependencies, dependencies)
|
807
811
|
current_possibility_set.possibilities.unshift(possibility)
|
808
812
|
else
|
809
813
|
possibility_sets.unshift(PossibilitySet.new(dependencies, [possibility]))
|
@@ -666,6 +666,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
666
666
|
#
|
667
667
|
# # Only prereleases or final releases after 2.6.0.preview2
|
668
668
|
# spec.required_ruby_version = '> 2.6.0.preview2'
|
669
|
+
#
|
670
|
+
# # This gem will work with 2.3.0 or greater, including major version 3, but lesser than 4.0.0
|
671
|
+
# spec.required_ruby_version = '>= 2.3', '< 4'
|
669
672
|
|
670
673
|
def required_ruby_version=(req)
|
671
674
|
@required_ruby_version = Gem::Requirement.create req
|
@@ -827,7 +830,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
827
830
|
if @@stubs
|
828
831
|
@@stubs_by_name[name] || []
|
829
832
|
else
|
830
|
-
@@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec")
|
833
|
+
@@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec").select do |s|
|
834
|
+
s.name == name
|
835
|
+
end
|
831
836
|
end
|
832
837
|
end
|
833
838
|
|
@@ -848,7 +853,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
848
853
|
specs.sort! do |a, b|
|
849
854
|
names = a.name <=> b.name
|
850
855
|
next names if names.nonzero?
|
851
|
-
b.version <=> a.version
|
856
|
+
versions = b.version <=> a.version
|
857
|
+
next versions if versions.nonzero?
|
858
|
+
b.platform == Gem::Platform::RUBY ? -1 : 1
|
852
859
|
end
|
853
860
|
end
|
854
861
|
|
@@ -1084,20 +1091,15 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1084
1091
|
end
|
1085
1092
|
|
1086
1093
|
def self._latest_specs(specs, prerelease = false) # :nodoc:
|
1087
|
-
result =
|
1088
|
-
native = {}
|
1094
|
+
result = {}
|
1089
1095
|
|
1090
1096
|
specs.reverse_each do |spec|
|
1091
1097
|
next if spec.version.prerelease? unless prerelease
|
1092
1098
|
|
1093
|
-
|
1094
|
-
result[spec.name][spec.platform] = spec
|
1099
|
+
result[spec.name] = spec
|
1095
1100
|
end
|
1096
1101
|
|
1097
|
-
result.map(&:last).
|
1098
|
-
minimum = native[spec.name]
|
1099
|
-
minimum && spec.version < minimum
|
1100
|
-
end.sort_by{|tup| tup.name }
|
1102
|
+
result.map(&:last).flatten.sort_by{|tup| tup.name }
|
1101
1103
|
end
|
1102
1104
|
|
1103
1105
|
##
|
@@ -2552,7 +2554,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2552
2554
|
begin
|
2553
2555
|
dependencies.each do |dep|
|
2554
2556
|
next unless dep.runtime?
|
2555
|
-
dep.
|
2557
|
+
dep.matching_specs(true).each do |dep_spec|
|
2556
2558
|
next if visited.has_key?(dep_spec)
|
2557
2559
|
visited[dep_spec] = true
|
2558
2560
|
trail.push(dep_spec)
|
data/lib/rubygems/test_case.rb
CHANGED
@@ -311,7 +311,7 @@ class Gem::TestCase < Minitest::Test
|
|
311
311
|
ENV['XDG_CONFIG_HOME'] = nil
|
312
312
|
ENV['XDG_DATA_HOME'] = nil
|
313
313
|
ENV['SOURCE_DATE_EPOCH'] = nil
|
314
|
-
ENV[
|
314
|
+
ENV['BUNDLER_VERSION'] = nil
|
315
315
|
|
316
316
|
@current_dir = Dir.pwd
|
317
317
|
@fetcher = nil
|
@@ -322,13 +322,10 @@ class Gem::TestCase < Minitest::Test
|
|
322
322
|
# capture output
|
323
323
|
Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new
|
324
324
|
|
325
|
-
|
326
|
-
tmpdir.tap(&Gem::UNTAINT)
|
327
|
-
|
328
|
-
@tempdir = File.join(tmpdir, "test_rubygems_#{$$}")
|
325
|
+
@tempdir = Dir.mktmpdir("test_rubygems_", @tmp)
|
329
326
|
@tempdir.tap(&Gem::UNTAINT)
|
330
327
|
|
331
|
-
|
328
|
+
ENV["TMPDIR"] = @tempdir
|
332
329
|
|
333
330
|
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
|
334
331
|
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
|
@@ -367,7 +364,9 @@ class Gem::TestCase < Minitest::Test
|
|
367
364
|
Dir.chdir @tempdir
|
368
365
|
|
369
366
|
ENV['HOME'] = @userhome
|
367
|
+
Gem.instance_variable_set :@config_file, nil
|
370
368
|
Gem.instance_variable_set :@user_home, nil
|
369
|
+
Gem.instance_variable_set :@config_home, nil
|
371
370
|
Gem.instance_variable_set :@data_home, nil
|
372
371
|
Gem.instance_variable_set :@gemdeps, nil
|
373
372
|
Gem.instance_variable_set :@env_requirements_by_name, nil
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.2.
|
5
|
+
s.version = "3.2.10"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|
Binary file
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -297,6 +297,58 @@ class TestGem < Gem::TestCase
|
|
297
297
|
assert_equal %w[a-1 b-2 c-1], loaded_spec_names
|
298
298
|
end
|
299
299
|
|
300
|
+
def test_activate_bin_path_does_not_error_if_a_gem_thats_not_finally_activated_has_orphaned_dependencies
|
301
|
+
a1 = util_spec 'a', '1' do |s|
|
302
|
+
s.executables = ['exec']
|
303
|
+
s.add_dependency 'b'
|
304
|
+
end
|
305
|
+
|
306
|
+
b1 = util_spec 'b', '1' do |s|
|
307
|
+
s.add_dependency 'c', '1'
|
308
|
+
end
|
309
|
+
|
310
|
+
b2 = util_spec 'b', '2' do |s|
|
311
|
+
s.add_dependency 'c', '2'
|
312
|
+
end
|
313
|
+
|
314
|
+
c2 = util_spec 'c', '2'
|
315
|
+
|
316
|
+
install_specs c2, b1, b2, a1
|
317
|
+
|
318
|
+
# c1 is missing, but not needed for activation, so we should not get any errors here
|
319
|
+
|
320
|
+
Gem.activate_bin_path("a", "exec", ">= 0")
|
321
|
+
|
322
|
+
assert_equal %w[a-1 b-2 c-2], loaded_spec_names
|
323
|
+
end
|
324
|
+
|
325
|
+
def test_activate_bin_path_raises_a_meaningful_error_if_a_gem_thats_finally_activated_has_orphaned_dependencies
|
326
|
+
a1 = util_spec 'a', '1' do |s|
|
327
|
+
s.executables = ['exec']
|
328
|
+
s.add_dependency 'b'
|
329
|
+
end
|
330
|
+
|
331
|
+
b1 = util_spec 'b', '1' do |s|
|
332
|
+
s.add_dependency 'c', '1'
|
333
|
+
end
|
334
|
+
|
335
|
+
b2 = util_spec 'b', '2' do |s|
|
336
|
+
s.add_dependency 'c', '2'
|
337
|
+
end
|
338
|
+
|
339
|
+
c1 = util_spec 'c', '1'
|
340
|
+
|
341
|
+
install_specs c1, b1, b2, a1
|
342
|
+
|
343
|
+
# c2 is missing, and b2 which has it as a dependency will be activated, so we should get an error about the orphaned dependency
|
344
|
+
|
345
|
+
e = assert_raises Gem::UnsatisfiableDependencyError do
|
346
|
+
load Gem.activate_bin_path("a", "exec", ">= 0")
|
347
|
+
end
|
348
|
+
|
349
|
+
assert_equal "Unable to resolve dependency: 'b (>= 0)' requires 'c (= 2)'", e.message
|
350
|
+
end
|
351
|
+
|
300
352
|
def test_activate_bin_path_in_debug_mode
|
301
353
|
a1 = util_spec 'a', '1' do |s|
|
302
354
|
s.executables = ['exec']
|
@@ -416,6 +468,32 @@ class TestGem < Gem::TestCase
|
|
416
468
|
assert_equal %w[bundler-1.17.3], loaded_spec_names
|
417
469
|
end
|
418
470
|
|
471
|
+
def test_activate_bin_path_gives_proper_error_for_bundler_when_underscore_selection_given
|
472
|
+
File.open("Gemfile.lock", "w") do |f|
|
473
|
+
f.write <<-L.gsub(/ {8}/, "")
|
474
|
+
GEM
|
475
|
+
remote: https://rubygems.org/
|
476
|
+
specs:
|
477
|
+
|
478
|
+
PLATFORMS
|
479
|
+
ruby
|
480
|
+
|
481
|
+
DEPENDENCIES
|
482
|
+
|
483
|
+
BUNDLED WITH
|
484
|
+
2.1.4
|
485
|
+
L
|
486
|
+
end
|
487
|
+
|
488
|
+
File.open("Gemfile", "w") {|f| f.puts('source "https://rubygems.org"') }
|
489
|
+
|
490
|
+
e = assert_raises Gem::GemNotFoundException do
|
491
|
+
load Gem.activate_bin_path("bundler", "bundle", "= 2.2.8")
|
492
|
+
end
|
493
|
+
|
494
|
+
assert_equal "can't find gem bundler (= 2.2.8) with executable bundle", e.message
|
495
|
+
end
|
496
|
+
|
419
497
|
def test_self_bin_path_no_exec_name
|
420
498
|
e = assert_raises ArgumentError do
|
421
499
|
Gem.bin_path 'a'
|
@@ -692,6 +770,11 @@ class TestGem < Gem::TestCase
|
|
692
770
|
ensure
|
693
771
|
FileUtils.chmod 0600, parent
|
694
772
|
end
|
773
|
+
|
774
|
+
def test_self_ensure_gem_directories_non_existent_paths
|
775
|
+
Gem.ensure_gem_subdirectories '/proc/0123456789/bogus' # should not raise
|
776
|
+
Gem.ensure_gem_subdirectories 'classpath:/bogus/x' # JRuby embed scenario
|
777
|
+
end
|
695
778
|
end
|
696
779
|
|
697
780
|
def test_self_extension_dir_shared
|
@@ -1875,15 +1958,9 @@ class TestGem < Gem::TestCase
|
|
1875
1958
|
io.write 'gem "a"'
|
1876
1959
|
end
|
1877
1960
|
|
1878
|
-
platform = Bundler::GemHelpers.generic_local_platform
|
1879
|
-
if platform == Gem::Platform::RUBY
|
1880
|
-
platform = ''
|
1881
|
-
else
|
1882
|
-
platform = " #{platform}"
|
1883
|
-
end
|
1884
|
-
|
1885
1961
|
expected = <<-EXPECTED
|
1886
|
-
Could not find gem 'a
|
1962
|
+
Could not find gem 'a' in locally installed gems.
|
1963
|
+
The source does not contain any versions of 'a'
|
1887
1964
|
You may need to `gem install -g` to install missing gems
|
1888
1965
|
|
1889
1966
|
EXPECTED
|
@@ -28,4 +28,22 @@ class TestGemCommandsOutdatedCommand < Gem::TestCase
|
|
28
28
|
assert_equal "foo (0.2 < 2.0)\n", @ui.output
|
29
29
|
assert_equal "", @ui.error
|
30
30
|
end
|
31
|
+
|
32
|
+
def test_execute_with_up_to_date_platform_specific_gem
|
33
|
+
spec_fetcher do |fetcher|
|
34
|
+
fetcher.download 'foo', '2.0'
|
35
|
+
|
36
|
+
fetcher.gem 'foo', '1.0'
|
37
|
+
fetcher.gem 'foo', '2.0' do |s|
|
38
|
+
s.platform = Gem::Platform.local
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
use_ui @ui do
|
43
|
+
@cmd.execute
|
44
|
+
end
|
45
|
+
|
46
|
+
assert_equal "", @ui.output
|
47
|
+
assert_equal "", @ui.error
|
48
|
+
end
|
31
49
|
end
|
@@ -44,7 +44,7 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
44
44
|
s.add_development_dependency 'c'
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
util_setup_spec_fetcher(@a1, @a1_pre, @b1, @d1)
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_install
|
@@ -287,8 +287,6 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
287
287
|
|
288
288
|
@aa1, @aa1_gem = util_gem 'aa', '1'
|
289
289
|
|
290
|
-
util_reset_gems
|
291
|
-
|
292
290
|
FileUtils.mv @a1_gem, @tempdir
|
293
291
|
FileUtils.mv @aa1_gem, @tempdir
|
294
292
|
FileUtils.mv @b1_gem, @tempdir
|
@@ -307,8 +305,6 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
307
305
|
|
308
306
|
@aa1, @aa1_gem = util_gem 'aa', '1'
|
309
307
|
|
310
|
-
util_reset_gems
|
311
|
-
|
312
308
|
FileUtils.mv @a1_gem, @tempdir
|
313
309
|
FileUtils.mv @aa1_gem, @tempdir
|
314
310
|
FileUtils.mv @b1_gem, @tempdir
|
@@ -329,8 +325,6 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
329
325
|
|
330
326
|
@aa1, @aa1_gem = util_gem 'aa', '1'
|
331
327
|
|
332
|
-
util_reset_gems
|
333
|
-
|
334
328
|
FileUtils.mv @a1_gem, @tempdir
|
335
329
|
FileUtils.mv @aa1_gem, @tempdir
|
336
330
|
FileUtils.mv @b1_gem, @tempdir
|
@@ -946,6 +940,31 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
946
940
|
assert_equal %w[d-2], inst.installed_gems.map {|s| s.full_name }
|
947
941
|
end
|
948
942
|
|
943
|
+
def test_install_legacy_spec_with_nil_required_ruby_version
|
944
|
+
path = File.expand_path "../data/null-required-ruby-version.gemspec.rz", __FILE__
|
945
|
+
spec = Marshal.load Gem.read_binary(path)
|
946
|
+
def spec.validate(*args); end
|
947
|
+
|
948
|
+
util_build_gem spec
|
949
|
+
|
950
|
+
cache_file = File.join @tempdir, 'gems', "#{spec.original_name}.gem"
|
951
|
+
FileUtils.mkdir_p File.dirname cache_file
|
952
|
+
FileUtils.mv spec.cache_file, cache_file
|
953
|
+
|
954
|
+
util_setup_spec_fetcher spec
|
955
|
+
|
956
|
+
data = Gem.read_binary(cache_file)
|
957
|
+
|
958
|
+
@fetcher.data['http://gems.example.com/gems/activesupport-1.0.0.gem'] = data
|
959
|
+
|
960
|
+
dep = Gem::Dependency.new 'activesupport'
|
961
|
+
|
962
|
+
inst = Gem::DependencyInstaller.new
|
963
|
+
inst.install dep
|
964
|
+
|
965
|
+
assert_equal %w[activesupport-1.0.0], Gem::Specification.map(&:full_name)
|
966
|
+
end
|
967
|
+
|
949
968
|
def test_install_legacy_spec_with_nil_required_rubygems_version
|
950
969
|
path = File.expand_path "../data/null-required-rubygems-version.gemspec.rz", __FILE__
|
951
970
|
spec = Marshal.load Gem.read_binary(path)
|
@@ -1131,16 +1150,6 @@ class TestGemDependencyInstaller < Gem::TestCase
|
|
1131
1150
|
@d1, @d1_gem = util_gem 'd', '1'
|
1132
1151
|
@d2, @d2_gem = util_gem 'd', '2'
|
1133
1152
|
|
1134
|
-
|
1135
|
-
end
|
1136
|
-
|
1137
|
-
def util_reset_gems
|
1138
|
-
@a1 ||= nil
|
1139
|
-
@b1 ||= nil
|
1140
|
-
@a1_pre ||= nil
|
1141
|
-
@d1 ||= nil
|
1142
|
-
@d2 ||= nil
|
1143
|
-
|
1144
|
-
util_setup_spec_fetcher(*[@a1, @a1_pre, @b1, @d1, @d2].compact)
|
1153
|
+
util_setup_spec_fetcher(@d1, @d2)
|
1145
1154
|
end
|
1146
1155
|
end
|