bundler 2.0.2 → 2.1.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +687 -574
- data/LICENSE.md +18 -19
- data/README.md +8 -7
- data/bundler.gemspec +5 -23
- data/exe/bundle +19 -3
- data/lib/bundler.rb +121 -68
- data/lib/bundler/build_metadata.rb +3 -3
- data/lib/bundler/capistrano.rb +5 -5
- data/lib/bundler/cli.rb +130 -124
- data/lib/bundler/cli/add.rb +27 -16
- data/lib/bundler/cli/common.rb +10 -11
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +2 -2
- data/lib/bundler/cli/doctor.rb +4 -4
- data/lib/bundler/cli/exec.rb +4 -9
- data/lib/bundler/cli/gem.rb +5 -5
- data/lib/bundler/cli/info.rb +17 -5
- data/lib/bundler/cli/init.rb +1 -1
- data/lib/bundler/cli/install.rb +3 -3
- data/lib/bundler/cli/issue.rb +1 -1
- data/lib/bundler/cli/open.rb +10 -6
- data/lib/bundler/cli/outdated.rb +85 -81
- data/lib/bundler/cli/package.rb +8 -9
- data/lib/bundler/cli/plugin.rb +9 -2
- data/lib/bundler/cli/pristine.rb +1 -1
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/cli/update.rb +32 -12
- data/lib/bundler/compact_index_client.rb +25 -9
- data/lib/bundler/compact_index_client/updater.rb +2 -6
- data/lib/bundler/current_ruby.rb +8 -7
- data/lib/bundler/definition.rb +33 -26
- data/lib/bundler/dependency.rb +16 -4
- data/lib/bundler/deployment.rb +2 -2
- data/lib/bundler/dsl.rb +18 -42
- data/lib/bundler/env.rb +6 -5
- data/lib/bundler/environment_preserver.rb +0 -1
- data/lib/bundler/feature_flag.rb +0 -12
- data/lib/bundler/fetcher.rb +14 -11
- data/lib/bundler/fetcher/compact_index.rb +26 -12
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +3 -0
- data/lib/bundler/fetcher/index.rb +4 -2
- data/lib/bundler/friendly_errors.rb +4 -5
- data/lib/bundler/gem_helper.rb +8 -8
- data/lib/bundler/gem_helpers.rb +2 -4
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +3 -3
- data/lib/bundler/graph.rb +2 -2
- data/lib/bundler/injector.rb +3 -1
- data/lib/bundler/inline.rb +19 -18
- data/lib/bundler/installer.rb +7 -14
- data/lib/bundler/installer/gem_installer.rb +5 -1
- data/lib/bundler/installer/parallel_installer.rb +4 -4
- data/lib/bundler/installer/standalone.rb +1 -2
- data/lib/bundler/lazy_specification.rb +2 -2
- data/lib/bundler/lockfile_parser.rb +13 -21
- data/lib/bundler/match_platform.rb +1 -1
- data/lib/bundler/plugin.rb +29 -18
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/api/source.rb +2 -2
- data/lib/bundler/plugin/index.rb +10 -2
- data/lib/bundler/plugin/installer.rb +28 -15
- data/lib/bundler/psyched_yaml.rb +1 -1
- data/lib/bundler/resolver.rb +72 -24
- data/lib/bundler/resolver/spec_group.rb +2 -2
- data/lib/bundler/retry.rb +2 -2
- data/lib/bundler/ruby_version.rb +4 -19
- data/lib/bundler/rubygems_ext.rb +10 -65
- data/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +135 -403
- data/lib/bundler/runtime.rb +2 -9
- data/lib/bundler/settings.rb +15 -48
- data/lib/bundler/setup.rb +6 -5
- data/lib/bundler/shared_helpers.rb +53 -68
- data/lib/bundler/similarity_detector.rb +2 -2
- data/lib/bundler/source.rb +5 -5
- data/lib/bundler/source/git.rb +19 -12
- data/lib/bundler/source/git/git_proxy.rb +35 -39
- data/lib/bundler/source/metadata.rb +7 -2
- data/lib/bundler/source/path.rb +13 -8
- data/lib/bundler/source/rubygems.rb +11 -5
- data/lib/bundler/source/rubygems/remote.rb +1 -2
- data/lib/bundler/source_list.rb +9 -12
- data/lib/bundler/spec_set.rb +1 -6
- data/lib/bundler/stub_specification.rb +18 -30
- data/lib/bundler/templates/Executable.bundler +22 -13
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +3 -3
- data/lib/bundler/templates/newgem/Gemfile.tt +8 -0
- data/lib/bundler/templates/newgem/README.md.tt +4 -3
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -18
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +4 -8
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +30 -8
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +4 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +248 -279
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +7 -7
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/base.rb +13 -13
- data/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/lib/bundler/vendored_fileutils.rb +1 -6
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +7 -5
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/version.rb +1 -20
- data/lib/bundler/version_ranges.rb +51 -5
- data/lib/bundler/vlad.rb +3 -3
- data/lib/bundler/worker.rb +1 -3
- data/lib/bundler/yaml_serializer.rb +2 -3
- data/man/bundle-add.1 +10 -2
- data/man/bundle-add.1.txt +11 -5
- data/man/bundle-add.ronn +7 -1
- data/man/bundle-binstubs.1 +2 -2
- data/man/bundle-binstubs.1.txt +2 -2
- data/man/bundle-binstubs.ronn +1 -1
- data/man/bundle-check.1 +1 -1
- data/man/bundle-check.1.txt +6 -6
- data/man/bundle-clean.1 +1 -1
- data/man/bundle-clean.1.txt +1 -1
- data/man/bundle-config.1 +35 -35
- data/man/bundle-config.1.txt +65 -66
- data/man/bundle-config.ronn +41 -39
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-doctor.1.txt +1 -1
- data/man/bundle-exec.1 +1 -1
- data/man/bundle-exec.1.txt +1 -1
- data/man/bundle-gem.1 +1 -1
- data/man/bundle-gem.1.txt +3 -3
- data/man/bundle-info.1 +1 -1
- data/man/bundle-info.1.txt +1 -1
- data/man/bundle-init.1 +1 -1
- data/man/bundle-init.1.txt +1 -1
- data/man/bundle-inject.1 +1 -1
- data/man/bundle-inject.1.txt +1 -1
- data/man/bundle-install.1 +8 -5
- data/man/bundle-install.1.txt +56 -51
- data/man/bundle-install.ronn +9 -4
- data/man/bundle-list.1 +1 -1
- data/man/bundle-list.1.txt +1 -1
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +16 -16
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +1 -1
- data/man/bundle-outdated.1 +1 -1
- data/man/bundle-outdated.1.txt +1 -1
- data/man/bundle-package.1 +1 -1
- data/man/bundle-package.1.txt +1 -1
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +1 -1
- data/man/bundle-pristine.1 +1 -1
- data/man/bundle-pristine.1.txt +1 -1
- data/man/bundle-remove.1 +1 -1
- data/man/bundle-remove.1.txt +1 -1
- data/man/bundle-show.1 +1 -1
- data/man/bundle-show.1.txt +1 -1
- data/man/bundle-update.1 +4 -4
- data/man/bundle-update.1.txt +64 -65
- data/man/bundle-update.ronn +3 -3
- data/man/bundle-viz.1 +1 -1
- data/man/bundle-viz.1.txt +1 -1
- data/man/bundle.1 +2 -2
- data/man/bundle.1.txt +7 -7
- data/man/bundle.ronn +1 -1
- data/man/gemfile.5 +12 -15
- data/man/gemfile.5.ronn +9 -13
- data/man/gemfile.5.txt +103 -107
- metadata +11 -112
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/cache.rb +0 -36
- data/lib/bundler/compatibility_guard.rb +0 -13
- data/lib/bundler/ssl_certs/.document +0 -1
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
data/lib/bundler/plugin/api.rb
CHANGED
@@ -37,7 +37,7 @@ module Bundler
|
|
37
37
|
#
|
38
38
|
# @!attribute [rw] dependency_names
|
39
39
|
# @return [Array<String>] Names of dependencies that the source should
|
40
|
-
# try to resolve. It is not necessary to use this list
|
40
|
+
# try to resolve. It is not necessary to use this list internally. This
|
41
41
|
# is present to be compatible with `Definition` and is used by
|
42
42
|
# rubygems source.
|
43
43
|
module Source
|
@@ -196,7 +196,7 @@ module Bundler
|
|
196
196
|
# This shall check if two source object represent the same source.
|
197
197
|
#
|
198
198
|
# The comparison shall take place only on the attribute that can be
|
199
|
-
# inferred from the options passed from Gemfile and not on
|
199
|
+
# inferred from the options passed from Gemfile and not on attributes
|
200
200
|
# that are used to pin down the gem to specific version (e.g. Git
|
201
201
|
# sources should compare on branch and tag but not on commit hash)
|
202
202
|
#
|
data/lib/bundler/plugin/index.rb
CHANGED
@@ -103,6 +103,14 @@ module Bundler
|
|
103
103
|
@plugin_paths[name]
|
104
104
|
end
|
105
105
|
|
106
|
+
def installed_plugins
|
107
|
+
@plugin_paths.keys
|
108
|
+
end
|
109
|
+
|
110
|
+
def plugin_commands(plugin)
|
111
|
+
@commands.find_all {|_, n| n == plugin }.map(&:first)
|
112
|
+
end
|
113
|
+
|
106
114
|
def source?(source)
|
107
115
|
@sources.key? source
|
108
116
|
end
|
@@ -131,7 +139,7 @@ module Bundler
|
|
131
139
|
|
132
140
|
data = index_f.read
|
133
141
|
|
134
|
-
|
142
|
+
require_relative "../yaml_serializer"
|
135
143
|
index = YAMLSerializer.load(data)
|
136
144
|
|
137
145
|
@commands.merge!(index["commands"])
|
@@ -154,7 +162,7 @@ module Bundler
|
|
154
162
|
"sources" => @sources,
|
155
163
|
}
|
156
164
|
|
157
|
-
|
165
|
+
require_relative "../yaml_serializer"
|
158
166
|
SharedHelpers.filesystem_access(index_file) do |index_f|
|
159
167
|
FileUtils.mkdir_p(index_f.dirname)
|
160
168
|
File.open(index_f, "w") {|f| f.puts YAMLSerializer.dump(index) }
|
@@ -8,14 +8,19 @@ module Bundler
|
|
8
8
|
# are heavily dependent on the Gemfile.
|
9
9
|
module Plugin
|
10
10
|
class Installer
|
11
|
-
autoload :Rubygems, "
|
12
|
-
autoload :Git, "
|
11
|
+
autoload :Rubygems, File.expand_path("installer/rubygems", __dir__)
|
12
|
+
autoload :Git, File.expand_path("installer/git", __dir__)
|
13
13
|
|
14
14
|
def install(names, options)
|
15
|
+
check_sources_consistency!(options)
|
16
|
+
|
15
17
|
version = options[:version] || [">= 0"]
|
16
|
-
|
18
|
+
|
19
|
+
Bundler.settings.temporary(:disable_multisource => false) do
|
17
20
|
if options[:git]
|
18
21
|
install_git(names, version, options)
|
22
|
+
elsif options[:local_git]
|
23
|
+
install_local_git(names, version, options)
|
19
24
|
else
|
20
25
|
sources = options[:source] || Bundler.rubygems.sources
|
21
26
|
install_rubygems(names, version, sources)
|
@@ -38,22 +43,24 @@ module Bundler
|
|
38
43
|
|
39
44
|
private
|
40
45
|
|
46
|
+
def check_sources_consistency!(options)
|
47
|
+
if options.key?(:git) && options.key?(:local_git)
|
48
|
+
raise InvalidOption, "Remote and local plugin git sources can't be both specified"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
41
52
|
def install_git(names, version, options)
|
42
53
|
uri = options.delete(:git)
|
43
54
|
options["uri"] = uri
|
44
55
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
# To support both sources
|
49
|
-
if options[:source]
|
50
|
-
source_list.add_rubygems_source("remotes" => options[:source])
|
51
|
-
end
|
56
|
+
install_all_sources(names, version, options, options[:source])
|
57
|
+
end
|
52
58
|
|
53
|
-
|
59
|
+
def install_local_git(names, version, options)
|
60
|
+
uri = options.delete(:local_git)
|
61
|
+
options["uri"] = uri
|
54
62
|
|
55
|
-
|
56
|
-
install_definition(definition)
|
63
|
+
install_all_sources(names, version, options, options[:source])
|
57
64
|
end
|
58
65
|
|
59
66
|
# Installs the plugin from rubygems source and returns the path where the
|
@@ -65,10 +72,16 @@ module Bundler
|
|
65
72
|
#
|
66
73
|
# @return [Hash] map of names to the specs of plugins installed
|
67
74
|
def install_rubygems(names, version, sources)
|
68
|
-
|
75
|
+
install_all_sources(names, version, nil, sources)
|
76
|
+
end
|
69
77
|
|
78
|
+
def install_all_sources(names, version, git_source_options, rubygems_source)
|
70
79
|
source_list = SourceList.new
|
71
|
-
|
80
|
+
|
81
|
+
source_list.add_git_source(git_source_options) if git_source_options
|
82
|
+
source_list.add_rubygems_source("remotes" => rubygems_source) if rubygems_source
|
83
|
+
|
84
|
+
deps = names.map {|name| Dependency.new name, version }
|
72
85
|
|
73
86
|
definition = Definition.new(nil, deps, source_list, true)
|
74
87
|
install_definition(definition)
|
data/lib/bundler/psyched_yaml.rb
CHANGED
data/lib/bundler/resolver.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Bundler
|
4
4
|
class Resolver
|
5
|
-
|
6
|
-
|
5
|
+
require_relative "vendored_molinillo"
|
6
|
+
require_relative "resolver/spec_group"
|
7
7
|
|
8
8
|
# Figures out the best possible configuration of gems that satisfies
|
9
9
|
# the list of passed dependencies and any child dependencies without
|
@@ -38,8 +38,8 @@ module Bundler
|
|
38
38
|
@platforms = platforms
|
39
39
|
@gem_version_promoter = gem_version_promoter
|
40
40
|
@allow_bundler_dependency_conflicts = Bundler.feature_flag.allow_bundler_dependency_conflicts?
|
41
|
-
@lockfile_uses_separate_rubygems_sources = Bundler.feature_flag.lockfile_uses_separate_rubygems_sources?
|
42
41
|
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
|
42
|
+
@lockfile_uses_separate_rubygems_sources = Bundler.feature_flag.disable_multisource?
|
43
43
|
end
|
44
44
|
|
45
45
|
def start(requirements)
|
@@ -48,9 +48,12 @@ module Bundler
|
|
48
48
|
|
49
49
|
verify_gemfile_dependencies_are_found!(requirements)
|
50
50
|
dg = @resolver.resolve(requirements, @base_dg)
|
51
|
-
dg.
|
51
|
+
dg.
|
52
|
+
tap {|resolved| validate_resolved_specs!(resolved) }.
|
53
|
+
map(&:payload).
|
52
54
|
reject {|sg| sg.name.end_with?("\0") }.
|
53
|
-
map(&:to_specs).
|
55
|
+
map(&:to_specs).
|
56
|
+
flatten
|
54
57
|
rescue Molinillo::VersionConflict => e
|
55
58
|
message = version_conflict_message(e)
|
56
59
|
raise VersionConflict.new(e.conflicts.keys.uniq, message)
|
@@ -72,7 +75,7 @@ module Bundler
|
|
72
75
|
return unless debug?
|
73
76
|
debug_info = yield
|
74
77
|
debug_info = debug_info.inspect unless debug_info.is_a?(String)
|
75
|
-
|
78
|
+
warn debug_info.split("\n").map {|s| " " * depth + s }
|
76
79
|
end
|
77
80
|
|
78
81
|
def debug?
|
@@ -169,13 +172,13 @@ module Bundler
|
|
169
172
|
|
170
173
|
def name_for_explicit_dependency_source
|
171
174
|
Bundler.default_gemfile.basename.to_s
|
172
|
-
rescue
|
175
|
+
rescue StandardError
|
173
176
|
"Gemfile"
|
174
177
|
end
|
175
178
|
|
176
179
|
def name_for_locking_dependency_source
|
177
180
|
Bundler.default_lockfile.basename.to_s
|
178
|
-
rescue
|
181
|
+
rescue StandardError
|
179
182
|
"Gemfile.lock"
|
180
183
|
end
|
181
184
|
|
@@ -276,10 +279,10 @@ module Bundler
|
|
276
279
|
versions_with_platforms = specs.map {|s| [s.version, s.platform] }
|
277
280
|
message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
|
278
281
|
message << if versions_with_platforms.any?
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
282
|
+
"The source contains '#{name}' at: #{formatted_versions_with_platforms(versions_with_platforms)}"
|
283
|
+
else
|
284
|
+
"The source does not contain any versions of '#{name}'"
|
285
|
+
end
|
283
286
|
else
|
284
287
|
message = "Could not find gem '#{requirement}' in any of the gem sources " \
|
285
288
|
"listed in your Gemfile#{cache_message}."
|
@@ -300,9 +303,19 @@ module Bundler
|
|
300
303
|
end
|
301
304
|
|
302
305
|
def version_conflict_message(e)
|
306
|
+
# only show essential conflicts, if possible
|
307
|
+
conflicts = e.conflicts.dup
|
308
|
+
conflicts.delete_if do |_name, conflict|
|
309
|
+
deps = conflict.requirement_trees.map(&:last).flatten(1)
|
310
|
+
!Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
|
311
|
+
end
|
312
|
+
e = Molinillo::VersionConflict.new(conflicts, e.specification_provider) unless conflicts.empty?
|
313
|
+
|
314
|
+
solver_name = "Bundler"
|
315
|
+
possibility_type = "gem"
|
303
316
|
e.message_with_trees(
|
304
|
-
:solver_name =>
|
305
|
-
:possibility_type =>
|
317
|
+
:solver_name => solver_name,
|
318
|
+
:possibility_type => possibility_type,
|
306
319
|
:reduce_trees => lambda do |trees|
|
307
320
|
# called first, because we want to reduce the amount of work required to find maximal empty sets
|
308
321
|
trees = trees.uniq {|t| t.flatten.map {|dep| [dep.name, dep.requirement] } }
|
@@ -314,10 +327,8 @@ module Bundler
|
|
314
327
|
end.flatten(1).select do |deps|
|
315
328
|
Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
|
316
329
|
end.min_by(&:size)
|
317
|
-
trees.reject! {|t| !maximal.include?(t.last) } if maximal
|
318
330
|
|
319
|
-
trees
|
320
|
-
trees.uniq! {|t| t.flatten.map {|dep| [dep.name, dep.requirement] } }
|
331
|
+
trees.reject! {|t| !maximal.include?(t.last) } if maximal
|
321
332
|
|
322
333
|
trees.sort_by {|t| t.reverse.map(&:name) }
|
323
334
|
end,
|
@@ -325,7 +336,7 @@ module Bundler
|
|
325
336
|
:additional_message_for_conflict => lambda do |o, name, conflict|
|
326
337
|
if name == "bundler"
|
327
338
|
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
|
328
|
-
other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new
|
339
|
+
other_bundler_required = !conflict.requirement.requirement.satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
329
340
|
end
|
330
341
|
|
331
342
|
if name == "bundler" && other_bundler_required
|
@@ -352,7 +363,11 @@ module Bundler
|
|
352
363
|
[]
|
353
364
|
end.compact.map(&:to_s).uniq.sort
|
354
365
|
|
355
|
-
|
366
|
+
metadata_requirement = name.end_with?("\0")
|
367
|
+
|
368
|
+
o << "Could not find gem '" unless metadata_requirement
|
369
|
+
o << SharedHelpers.pretty_dependency(conflict.requirement)
|
370
|
+
o << "'" unless metadata_requirement
|
356
371
|
if conflict.requirement_trees.first.size > 1
|
357
372
|
o << ", which is required by "
|
358
373
|
o << "gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}',"
|
@@ -360,14 +375,47 @@ module Bundler
|
|
360
375
|
o << " "
|
361
376
|
|
362
377
|
o << if relevant_sources.empty?
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
378
|
+
"in any of the sources.\n"
|
379
|
+
elsif metadata_requirement
|
380
|
+
"is not available in #{relevant_sources.join(" or ")}"
|
381
|
+
else
|
382
|
+
"in any of the relevant sources:\n #{relevant_sources * "\n "}\n"
|
383
|
+
end
|
367
384
|
end
|
368
385
|
end,
|
369
|
-
:version_for_spec => lambda {|spec| spec.version }
|
386
|
+
:version_for_spec => lambda {|spec| spec.version },
|
387
|
+
:incompatible_version_message_for_conflict => lambda do |name, _conflict|
|
388
|
+
if name.end_with?("\0")
|
389
|
+
%(#{solver_name} found conflicting requirements for the #{name} version:)
|
390
|
+
else
|
391
|
+
%(#{solver_name} could not find compatible versions for #{possibility_type} "#{name}":)
|
392
|
+
end
|
393
|
+
end
|
370
394
|
)
|
371
395
|
end
|
396
|
+
|
397
|
+
def validate_resolved_specs!(resolved_specs)
|
398
|
+
resolved_specs.each do |v|
|
399
|
+
name = v.name
|
400
|
+
next unless sources = relevant_sources_for_vertex(v)
|
401
|
+
sources.compact!
|
402
|
+
if default_index = sources.index(@source_requirements[:default])
|
403
|
+
sources.delete_at(default_index)
|
404
|
+
end
|
405
|
+
sources.reject! {|s| s.specs[name].empty? }
|
406
|
+
sources.uniq!
|
407
|
+
next if sources.size <= 1
|
408
|
+
|
409
|
+
multisource_disabled = Bundler.feature_flag.disable_multisource?
|
410
|
+
|
411
|
+
msg = ["The gem '#{name}' was found in multiple relevant sources."]
|
412
|
+
msg.concat sources.map {|s| " * #{s}" }.sort
|
413
|
+
msg << "You #{multisource_disabled ? :must : :should} add this gem to the source block for the source you wish it to be installed from."
|
414
|
+
msg = msg.join("\n")
|
415
|
+
|
416
|
+
raise SecurityError, msg if multisource_disabled
|
417
|
+
Bundler.ui.warn "Warning: #{msg}"
|
418
|
+
end
|
419
|
+
end
|
372
420
|
end
|
373
421
|
end
|
@@ -94,10 +94,10 @@ module Bundler
|
|
94
94
|
return [] if !spec.is_a?(EndpointSpecification) && !spec.is_a?(Gem::Specification)
|
95
95
|
dependencies = []
|
96
96
|
if !spec.required_ruby_version.nil? && !spec.required_ruby_version.none?
|
97
|
-
dependencies << DepProxy.new(Gem::Dependency.new("
|
97
|
+
dependencies << DepProxy.new(Gem::Dependency.new("Ruby\0", spec.required_ruby_version), platform)
|
98
98
|
end
|
99
99
|
if !spec.required_rubygems_version.nil? && !spec.required_rubygems_version.none?
|
100
|
-
dependencies << DepProxy.new(Gem::Dependency.new("
|
100
|
+
dependencies << DepProxy.new(Gem::Dependency.new("RubyGems\0", spec.required_rubygems_version), platform)
|
101
101
|
end
|
102
102
|
dependencies
|
103
103
|
end
|
data/lib/bundler/retry.rb
CHANGED
data/lib/bundler/ruby_version.rb
CHANGED
@@ -49,7 +49,7 @@ module Bundler
|
|
49
49
|
([\d.]+) # ruby version
|
50
50
|
(?:p(-?\d+))? # optional patchlevel
|
51
51
|
(?:\s\((\S+)\s(.+)\))? # optional engine info
|
52
|
-
/xo
|
52
|
+
/xo.freeze
|
53
53
|
|
54
54
|
# Returns a RubyVersion from the given string.
|
55
55
|
# @param [String] the version string to match.
|
@@ -74,7 +74,7 @@ module Bundler
|
|
74
74
|
@host ||= [
|
75
75
|
RbConfig::CONFIG["host_cpu"],
|
76
76
|
RbConfig::CONFIG["host_vendor"],
|
77
|
-
RbConfig::CONFIG["host_os"]
|
77
|
+
RbConfig::CONFIG["host_os"],
|
78
78
|
].join("-")
|
79
79
|
end
|
80
80
|
|
@@ -102,24 +102,9 @@ module Bundler
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def self.system
|
105
|
-
ruby_engine =
|
106
|
-
RUBY_ENGINE.dup
|
107
|
-
else
|
108
|
-
# not defined in ruby 1.8.7
|
109
|
-
"ruby"
|
110
|
-
end
|
111
|
-
# :sob: mocking RUBY_VERSION breaks stuff on 1.8.7
|
105
|
+
ruby_engine = RUBY_ENGINE.dup
|
112
106
|
ruby_version = ENV.fetch("BUNDLER_SPEC_RUBY_VERSION") { RUBY_VERSION }.dup
|
113
|
-
ruby_engine_version =
|
114
|
-
when "ruby"
|
115
|
-
ruby_version
|
116
|
-
when "rbx"
|
117
|
-
Rubinius::VERSION.dup
|
118
|
-
when "jruby"
|
119
|
-
JRUBY_VERSION.dup
|
120
|
-
else
|
121
|
-
RUBY_ENGINE_VERSION.dup
|
122
|
-
end
|
107
|
+
ruby_engine_version = RUBY_ENGINE_VERSION.dup
|
123
108
|
patchlevel = RUBY_PATCHLEVEL.to_s
|
124
109
|
|
125
110
|
@ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
|
data/lib/bundler/rubygems_ext.rb
CHANGED
@@ -2,45 +2,27 @@
|
|
2
2
|
|
3
3
|
require "pathname"
|
4
4
|
|
5
|
-
if defined?(Gem::QuickLoader)
|
6
|
-
# Gem Prelude makes me a sad panda :'(
|
7
|
-
Gem::QuickLoader.load_full_rubygems_library
|
8
|
-
end
|
9
|
-
|
10
5
|
require "rubygems/specification"
|
11
6
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
require "rubygems/source"
|
16
|
-
rescue LoadError
|
17
|
-
# Not available before RubyGems 2.0.0, ignore
|
18
|
-
nil
|
19
|
-
end
|
7
|
+
# Possible use in Gem::Specification#source below and require
|
8
|
+
# shouldn't be deferred.
|
9
|
+
require "rubygems/source"
|
20
10
|
|
21
|
-
|
11
|
+
require_relative "match_platform"
|
22
12
|
|
23
13
|
module Gem
|
24
|
-
@loaded_stacks = Hash.new {|h, k| h[k] = [] }
|
25
|
-
|
26
14
|
class Specification
|
27
15
|
attr_accessor :remote, :location, :relative_loaded_from
|
28
16
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
(defined?(@source) && @source) || Gem::Source::Installed.new
|
34
|
-
end
|
35
|
-
else
|
36
|
-
attr_accessor :source
|
17
|
+
remove_method :source
|
18
|
+
attr_writer :source
|
19
|
+
def source
|
20
|
+
(defined?(@source) && @source) || Gem::Source::Installed.new
|
37
21
|
end
|
38
22
|
|
39
23
|
alias_method :rg_full_gem_path, :full_gem_path
|
40
24
|
alias_method :rg_loaded_from, :loaded_from
|
41
25
|
|
42
|
-
attr_writer :full_gem_path unless instance_methods.include?(:full_gem_path=)
|
43
|
-
|
44
26
|
def full_gem_path
|
45
27
|
# this cannot check source.is_a?(Bundler::Plugin::API::Source)
|
46
28
|
# because that _could_ trip the autoload, and if there are unresolved
|
@@ -62,15 +44,7 @@ module Gem
|
|
62
44
|
end
|
63
45
|
|
64
46
|
def load_paths
|
65
|
-
|
66
|
-
|
67
|
-
require_paths.map do |require_path|
|
68
|
-
if require_path.include?(full_gem_path)
|
69
|
-
require_path
|
70
|
-
else
|
71
|
-
File.join(full_gem_path, require_path)
|
72
|
-
end
|
73
|
-
end
|
47
|
+
full_require_paths
|
74
48
|
end
|
75
49
|
|
76
50
|
if method_defined?(:extension_dir)
|
@@ -84,10 +58,7 @@ module Gem
|
|
84
58
|
end
|
85
59
|
end
|
86
60
|
|
87
|
-
|
88
|
-
methods = instance_methods(false)
|
89
|
-
gem_dir = methods.first.is_a?(String) ? "gem_dir" : :gem_dir
|
90
|
-
remove_method :gem_dir if methods.include?(gem_dir)
|
61
|
+
remove_method :gem_dir if instance_methods(false).include?(:gem_dir)
|
91
62
|
def gem_dir
|
92
63
|
full_gem_path
|
93
64
|
end
|
@@ -157,32 +128,6 @@ module Gem
|
|
157
128
|
end
|
158
129
|
out
|
159
130
|
end
|
160
|
-
|
161
|
-
# Backport of performance enhancement added to RubyGems 1.4
|
162
|
-
def matches_spec?(spec)
|
163
|
-
# name can be a Regexp, so use ===
|
164
|
-
return false unless name === spec.name
|
165
|
-
return true if requirement.none?
|
166
|
-
|
167
|
-
requirement.satisfied_by?(spec.version)
|
168
|
-
end unless allocate.respond_to?(:matches_spec?)
|
169
|
-
end
|
170
|
-
|
171
|
-
class Requirement
|
172
|
-
# Backport of performance enhancement added to RubyGems 1.4
|
173
|
-
def none?
|
174
|
-
# note that it might be tempting to replace with with RubyGems 2.0's
|
175
|
-
# improved implementation. Don't. It requires `DefaultRequirement` to be
|
176
|
-
# defined, and more importantantly, these overrides are not used when the
|
177
|
-
# running RubyGems defines these methods
|
178
|
-
to_s == ">= 0"
|
179
|
-
end unless allocate.respond_to?(:none?)
|
180
|
-
|
181
|
-
# Backport of performance enhancement added to RubyGems 2.2
|
182
|
-
def exact?
|
183
|
-
return false unless @requirements.size == 1
|
184
|
-
@requirements[0][0] == "="
|
185
|
-
end unless allocate.respond_to?(:exact?)
|
186
131
|
end
|
187
132
|
|
188
133
|
class Platform
|