bundler 1.17.2 → 2.1.0
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 +799 -571
- data/LICENSE.md +18 -19
- data/README.md +9 -8
- data/bundler.gemspec +8 -25
- data/exe/bundle +19 -3
- data/lib/bundler.rb +202 -87
- data/lib/bundler/build_metadata.rb +3 -3
- data/lib/bundler/capistrano.rb +4 -4
- data/lib/bundler/cli.rb +178 -140
- data/lib/bundler/cli/add.rb +28 -16
- data/lib/bundler/cli/cache.rb +25 -13
- data/lib/bundler/cli/common.rb +11 -12
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +1 -1
- data/lib/bundler/cli/doctor.rb +4 -4
- data/lib/bundler/cli/exec.rb +15 -18
- 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 +11 -10
- data/lib/bundler/cli/issue.rb +3 -3
- data/lib/bundler/cli/open.rb +10 -6
- data/lib/bundler/cli/outdated.rb +85 -81
- 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 +9 -7
- data/lib/bundler/definition.rb +35 -26
- data/lib/bundler/dependency.rb +16 -4
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/dsl.rb +16 -40
- data/lib/bundler/env.rb +8 -13
- data/lib/bundler/environment_preserver.rb +0 -1
- data/lib/bundler/feature_flag.rb +23 -34
- data/lib/bundler/fetcher.rb +16 -13
- data/lib/bundler/fetcher/compact_index.rb +26 -12
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +5 -2
- data/lib/bundler/fetcher/index.rb +5 -3
- data/lib/bundler/friendly_errors.rb +6 -7
- data/lib/bundler/gem_helper.rb +40 -25
- 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 +10 -8
- data/lib/bundler/inline.rb +40 -30
- data/lib/bundler/installer.rb +7 -14
- data/lib/bundler/installer/gem_installer.rb +5 -1
- data/lib/bundler/installer/parallel_installer.rb +4 -8
- data/lib/bundler/installer/standalone.rb +1 -2
- data/lib/bundler/lazy_specification.rb +2 -3
- data/lib/bundler/lockfile_parser.rb +14 -21
- data/lib/bundler/match_platform.rb +1 -1
- data/lib/bundler/mirror.rb +3 -3
- data/lib/bundler/plugin.rb +42 -29
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/api/source.rb +4 -6
- data/lib/bundler/plugin/index.rb +14 -3
- data/lib/bundler/plugin/installer.rb +28 -15
- data/lib/bundler/psyched_yaml.rb +1 -1
- data/lib/bundler/remote_specification.rb +0 -2
- data/lib/bundler/resolver.rb +72 -24
- data/lib/bundler/resolver/spec_group.rb +3 -2
- data/lib/bundler/retry.rb +2 -2
- data/lib/bundler/ruby_version.rb +4 -19
- data/lib/bundler/rubygems_ext.rb +11 -67
- data/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +142 -402
- data/lib/bundler/runtime.rb +2 -9
- data/lib/bundler/settings.rb +22 -51
- data/lib/bundler/setup.rb +7 -13
- data/lib/bundler/shared_helpers.rb +51 -77
- data/lib/bundler/similarity_detector.rb +2 -2
- data/lib/bundler/source.rb +5 -5
- data/lib/bundler/source/git.rb +24 -17
- data/lib/bundler/source/git/git_proxy.rb +38 -41
- data/lib/bundler/source/metadata.rb +9 -5
- data/lib/bundler/source/path.rb +13 -8
- data/lib/bundler/source/rubygems.rb +14 -8
- data/lib/bundler/source/rubygems/remote.rb +2 -3
- data/lib/bundler/source_list.rb +9 -12
- data/lib/bundler/spec_set.rb +23 -12
- data/lib/bundler/stub_specification.rb +18 -30
- data/lib/bundler/templates/Executable.bundler +23 -14
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +3 -3
- data/lib/bundler/templates/newgem/Gemfile.tt +8 -2
- data/lib/bundler/templates/newgem/README.md.tt +4 -3
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +6 -27
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +1 -1
- 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/uri_credentials_filter.rb +7 -3
- 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 +273 -147
- 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 +273 -304
- 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 +19 -4
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +27 -12
- 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 +7 -17
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +16 -7
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/lib/bundler/vendor/thor/lib/thor/base.rb +54 -43
- data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +20 -5
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +62 -8
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +6 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
- data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- 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/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +1 -20
- data/lib/bundler/version_ranges.rb +51 -5
- data/lib/bundler/vlad.rb +2 -2
- 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-cache.1 +55 -0
- data/man/bundle-cache.1.txt +78 -0
- data/man/{bundle-package.ronn → bundle-cache.ronn} +15 -15
- 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 +36 -36
- data/man/bundle-config.1.txt +66 -67
- data/man/bundle-config.ronn +42 -40
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-doctor.1.txt +1 -1
- data/man/bundle-exec.1 +2 -2
- data/man/bundle-exec.1.txt +2 -2
- data/man/bundle-exec.ronn +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 +2 -2
- data/man/bundle-init.1.txt +2 -2
- data/man/bundle-init.ronn +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-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 +7 -3
- data/man/bundle.1.txt +11 -8
- data/man/bundle.ronn +5 -2
- data/man/gemfile.5 +17 -20
- data/man/gemfile.5.ronn +14 -18
- data/man/gemfile.5.txt +108 -112
- data/man/index.txt +1 -1
- metadata +34 -110
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -49
- data/lib/bundler/compatibility_guard.rb +0 -14
- data/lib/bundler/gem_remote_fetcher.rb +0 -43
- 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/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/man/bundle-package.1 +0 -55
- data/man/bundle-package.1.txt +0 -79
data/lib/bundler/runtime.rb
CHANGED
@@ -34,14 +34,7 @@ module Bundler
|
|
34
34
|
spec.load_paths.reject {|path| $LOAD_PATH.include?(path) }
|
35
35
|
end.reverse.flatten
|
36
36
|
|
37
|
-
|
38
|
-
if insert_index = Bundler.rubygems.load_path_insert_index
|
39
|
-
# Gem directories must come after -I and ENV['RUBYLIB']
|
40
|
-
$LOAD_PATH.insert(insert_index, *load_paths)
|
41
|
-
else
|
42
|
-
# We are probably testing in core, -I and RUBYLIB don't apply
|
43
|
-
$LOAD_PATH.unshift(*load_paths)
|
44
|
-
end
|
37
|
+
Bundler.rubygems.add_to_load_path(load_paths)
|
45
38
|
|
46
39
|
setup_manpath
|
47
40
|
|
@@ -163,7 +156,7 @@ module Bundler
|
|
163
156
|
gem_dirs = Dir["#{Gem.dir}/gems/*"]
|
164
157
|
gem_files = Dir["#{Gem.dir}/cache/*.gem"]
|
165
158
|
gemspec_files = Dir["#{Gem.dir}/specifications/*.gemspec"]
|
166
|
-
extension_dirs = Dir["#{Gem.dir}/extensions/*/*/*"]
|
159
|
+
extension_dirs = Dir["#{Gem.dir}/extensions/*/*/*"] + Dir["#{Gem.dir}/bundler/gems/extensions/*/*/*"]
|
167
160
|
spec_gem_paths = []
|
168
161
|
# need to keep git sources around
|
169
162
|
spec_git_paths = @definition.spec_git_paths
|
data/lib/bundler/settings.rb
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "uri"
|
4
|
-
|
5
3
|
module Bundler
|
6
4
|
class Settings
|
7
|
-
autoload :Mirror, "
|
8
|
-
autoload :Mirrors, "
|
9
|
-
autoload :Validator, "
|
5
|
+
autoload :Mirror, File.expand_path("mirror", __dir__)
|
6
|
+
autoload :Mirrors, File.expand_path("mirror", __dir__)
|
7
|
+
autoload :Validator, File.expand_path("settings/validator", __dir__)
|
10
8
|
|
11
9
|
BOOL_KEYS = %w[
|
12
10
|
allow_bundler_dependency_conflicts
|
@@ -17,8 +15,6 @@ module Bundler
|
|
17
15
|
auto_config_jobs
|
18
16
|
cache_all
|
19
17
|
cache_all_platforms
|
20
|
-
cache_command_is_package
|
21
|
-
console_command
|
22
18
|
default_install_uses_path
|
23
19
|
deployment
|
24
20
|
deployment_means_frozen
|
@@ -29,28 +25,24 @@ module Bundler
|
|
29
25
|
disable_platform_warnings
|
30
26
|
disable_shared_gems
|
31
27
|
disable_version_check
|
32
|
-
error_on_stderr
|
33
28
|
force_ruby_platform
|
34
29
|
forget_cli_options
|
35
30
|
frozen
|
36
31
|
gem.coc
|
37
32
|
gem.mit
|
38
|
-
global_path_appends_ruby_scope
|
39
33
|
global_gem_cache
|
40
34
|
ignore_messages
|
41
35
|
init_gems_rb
|
42
|
-
list_command
|
43
|
-
lockfile_uses_separate_rubygems_sources
|
44
|
-
major_deprecations
|
45
36
|
no_install
|
46
37
|
no_prune
|
47
38
|
only_update_to_newer_versions
|
48
39
|
path_relative_to_cwd
|
49
40
|
path.system
|
50
41
|
plugins
|
51
|
-
|
42
|
+
prefer_patch
|
52
43
|
print_only_version_number
|
53
44
|
setup_makes_kernel_gem_public
|
45
|
+
silence_deprecations
|
54
46
|
silence_root_warning
|
55
47
|
skip_default_git_sources
|
56
48
|
specific_platform
|
@@ -58,7 +50,6 @@ module Bundler
|
|
58
50
|
unlock_source_unlocks_spec
|
59
51
|
update_requires_all_flag
|
60
52
|
use_gem_version_promoter_for_major_updates
|
61
|
-
viz_command
|
62
53
|
].freeze
|
63
54
|
|
64
55
|
NUMBER_KEYS = %w[
|
@@ -75,7 +66,9 @@ module Bundler
|
|
75
66
|
].freeze
|
76
67
|
|
77
68
|
DEFAULT_CONFIG = {
|
69
|
+
:silence_deprecations => false,
|
78
70
|
:disable_version_check => true,
|
71
|
+
:prefer_patch => false,
|
79
72
|
:redirect => 5,
|
80
73
|
:retry => 3,
|
81
74
|
:timeout => 10,
|
@@ -106,18 +99,6 @@ module Bundler
|
|
106
99
|
temporary(key => value)
|
107
100
|
value
|
108
101
|
else
|
109
|
-
command = if value.nil?
|
110
|
-
"bundle config --delete #{key}"
|
111
|
-
else
|
112
|
-
"bundle config #{key} #{Array(value).join(":")}"
|
113
|
-
end
|
114
|
-
|
115
|
-
Bundler::SharedHelpers.major_deprecation 2,\
|
116
|
-
"flags passed to commands " \
|
117
|
-
"will no longer be automatically remembered. Instead please set flags " \
|
118
|
-
"you want remembered between commands using `bundle config " \
|
119
|
-
"<setting name> <setting value>`, i.e. `#{command}`"
|
120
|
-
|
121
102
|
set_local(key, value)
|
122
103
|
end
|
123
104
|
end
|
@@ -169,7 +150,11 @@ module Bundler
|
|
169
150
|
end
|
170
151
|
|
171
152
|
def mirror_for(uri)
|
172
|
-
|
153
|
+
if uri.is_a?(String)
|
154
|
+
require_relative "vendored_uri"
|
155
|
+
uri = Bundler::URI(uri)
|
156
|
+
end
|
157
|
+
|
173
158
|
gem_mirrors.for(uri.to_s).uri
|
174
159
|
end
|
175
160
|
|
@@ -220,23 +205,22 @@ module Bundler
|
|
220
205
|
locations
|
221
206
|
end
|
222
207
|
|
223
|
-
# for legacy reasons, in Bundler
|
224
|
-
# nor do we respect :disable_shared_gems
|
208
|
+
# for legacy reasons, in Bundler 2, we do not respect :disable_shared_gems
|
225
209
|
def path
|
226
210
|
key = key_for(:path)
|
227
211
|
path = ENV[key] || @global_config[key]
|
228
212
|
if path && !@temporary.key?(key) && !@local_config.key?(key)
|
229
|
-
return Path.new(path,
|
213
|
+
return Path.new(path, false, false)
|
230
214
|
end
|
231
215
|
|
232
216
|
system_path = self["path.system"] || (self[:disable_shared_gems] == false)
|
233
|
-
Path.new(self[:path],
|
217
|
+
Path.new(self[:path], system_path, Bundler.feature_flag.default_install_uses_path?)
|
234
218
|
end
|
235
219
|
|
236
|
-
Path = Struct.new(:explicit_path, :
|
220
|
+
Path = Struct.new(:explicit_path, :system_path, :default_install_uses_path) do
|
237
221
|
def path
|
238
222
|
path = base_path
|
239
|
-
path = File.join(path, Bundler.ruby_scope)
|
223
|
+
path = File.join(path, Bundler.ruby_scope) unless use_system_gems?
|
240
224
|
path
|
241
225
|
end
|
242
226
|
|
@@ -371,7 +355,7 @@ module Bundler
|
|
371
355
|
return unless file
|
372
356
|
SharedHelpers.filesystem_access(file) do |p|
|
373
357
|
FileUtils.mkdir_p(p.dirname)
|
374
|
-
|
358
|
+
require_relative "yaml_serializer"
|
375
359
|
p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
|
376
360
|
end
|
377
361
|
end
|
@@ -406,26 +390,12 @@ module Bundler
|
|
406
390
|
Pathname.new(@root).join("config") if @root
|
407
391
|
end
|
408
392
|
|
409
|
-
CONFIG_REGEX = %r{ # rubocop:disable Style/RegexpLiteral
|
410
|
-
^
|
411
|
-
(BUNDLE_.+):\s # the key
|
412
|
-
(?: !\s)? # optional exclamation mark found with ruby 1.9.3
|
413
|
-
(['"]?) # optional opening quote
|
414
|
-
(.* # contents of the value
|
415
|
-
(?: # optionally, up until the next key
|
416
|
-
(\n(?!BUNDLE).+)*
|
417
|
-
)
|
418
|
-
)
|
419
|
-
\2 # matching closing quote
|
420
|
-
$
|
421
|
-
}xo
|
422
|
-
|
423
393
|
def load_config(config_file)
|
424
394
|
return {} if !config_file || ignore_config?
|
425
395
|
SharedHelpers.filesystem_access(config_file, :read) do |file|
|
426
396
|
valid_file = file.exist? && !file.size.zero?
|
427
397
|
return {} unless valid_file
|
428
|
-
|
398
|
+
require_relative "yaml_serializer"
|
429
399
|
YAMLSerializer.load file.read
|
430
400
|
end
|
431
401
|
end
|
@@ -441,7 +411,7 @@ module Bundler
|
|
441
411
|
(https?.*?) # URI
|
442
412
|
(\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key
|
443
413
|
\z
|
444
|
-
/ix
|
414
|
+
/ix.freeze
|
445
415
|
|
446
416
|
# TODO: duplicates Rubygems#normalize_uri
|
447
417
|
# TODO: is this the correct place to validate mirror URIs?
|
@@ -453,7 +423,8 @@ module Bundler
|
|
453
423
|
suffix = $3
|
454
424
|
end
|
455
425
|
uri = "#{uri}/" unless uri.end_with?("/")
|
456
|
-
|
426
|
+
require_relative "vendored_uri"
|
427
|
+
uri = Bundler::URI(uri)
|
457
428
|
unless uri.absolute?
|
458
429
|
raise ArgumentError, format("Gem sources must be absolute. You provided '%s'.", uri)
|
459
430
|
end
|
data/lib/bundler/setup.rb
CHANGED
@@ -1,28 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "shared_helpers"
|
4
4
|
|
5
5
|
if Bundler::SharedHelpers.in_bundle?
|
6
|
-
|
6
|
+
require_relative "../bundler"
|
7
7
|
|
8
8
|
if STDOUT.tty? || ENV["BUNDLER_FORCE_TTY"]
|
9
9
|
begin
|
10
|
-
Bundler.setup
|
10
|
+
Bundler.ui.silence { Bundler.setup }
|
11
11
|
rescue Bundler::BundlerError => e
|
12
|
-
|
13
|
-
|
12
|
+
Bundler.ui.warn "\e[31m#{e.message}\e[0m"
|
13
|
+
Bundler.ui.warn e.backtrace.join("\n") if ENV["DEBUG"]
|
14
14
|
if e.is_a?(Bundler::GemNotFound)
|
15
|
-
|
15
|
+
Bundler.ui.warn "\e[33mRun `bundle install` to install missing gems.\e[0m"
|
16
16
|
end
|
17
17
|
exit e.status_code
|
18
18
|
end
|
19
19
|
else
|
20
|
-
Bundler.setup
|
20
|
+
Bundler.ui.silence { Bundler.setup }
|
21
21
|
end
|
22
|
-
|
23
|
-
# Add bundler to the load path after disabling system gems
|
24
|
-
bundler_lib = File.expand_path("../..", __FILE__)
|
25
|
-
$LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
|
26
|
-
|
27
|
-
Bundler.ui = nil
|
28
22
|
end
|
@@ -1,38 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "bundler/compatibility_guard"
|
4
|
-
|
5
3
|
require "pathname"
|
6
|
-
require "
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
module Gem
|
14
|
-
class Dependency
|
15
|
-
# This is only needed for RubyGems < 1.4
|
16
|
-
unless method_defined? :requirement
|
17
|
-
def requirement
|
18
|
-
version_requirements
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
4
|
+
require "rbconfig"
|
5
|
+
|
6
|
+
require_relative "version"
|
7
|
+
require_relative "constants"
|
8
|
+
require_relative "rubygems_integration"
|
9
|
+
require_relative "current_ruby"
|
23
10
|
|
24
11
|
module Bundler
|
25
12
|
module SharedHelpers
|
26
13
|
def root
|
27
14
|
gemfile = find_gemfile
|
28
15
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
29
|
-
Pathname.new(gemfile).untaint.expand_path.parent
|
16
|
+
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
|
30
17
|
end
|
31
18
|
|
32
19
|
def default_gemfile
|
33
|
-
gemfile = find_gemfile
|
20
|
+
gemfile = find_gemfile
|
34
21
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
35
|
-
Pathname.new(gemfile).untaint.expand_path
|
22
|
+
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
|
36
23
|
end
|
37
24
|
|
38
25
|
def default_lockfile
|
@@ -41,7 +28,7 @@ module Bundler
|
|
41
28
|
case gemfile.basename.to_s
|
42
29
|
when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
|
43
30
|
else Pathname.new("#{gemfile}.lock")
|
44
|
-
end.untaint
|
31
|
+
end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
45
32
|
end
|
46
33
|
|
47
34
|
def default_bundle_dir
|
@@ -113,9 +100,7 @@ module Bundler
|
|
113
100
|
#
|
114
101
|
# @see {Bundler::PermissionError}
|
115
102
|
def filesystem_access(path, action = :write, &block)
|
116
|
-
|
117
|
-
# See https://github.com/bundler/bundler/issues/5341 for details
|
118
|
-
block.call(path.dup.untaint)
|
103
|
+
yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
|
119
104
|
rescue Errno::EACCES
|
120
105
|
raise PermissionError.new(path, action)
|
121
106
|
rescue Errno::EAGAIN
|
@@ -139,34 +124,32 @@ module Bundler
|
|
139
124
|
namespace.const_get(constant_name)
|
140
125
|
end
|
141
126
|
|
142
|
-
def major_deprecation(major_version, message)
|
143
|
-
if
|
144
|
-
|
145
|
-
|
127
|
+
def major_deprecation(major_version, message, print_caller_location: false)
|
128
|
+
if print_caller_location
|
129
|
+
caller_location = caller_locations(2, 2).first
|
130
|
+
message = "#{message} (called at #{caller_location.path}:#{caller_location.lineno})"
|
131
|
+
end
|
132
|
+
|
133
|
+
bundler_major_version = Bundler.bundler_major_version
|
134
|
+
if bundler_major_version > major_version
|
135
|
+
require_relative "errors"
|
136
|
+
raise DeprecatedError, "[REMOVED] #{message}"
|
146
137
|
end
|
147
138
|
|
148
|
-
return unless prints_major_deprecations?
|
149
|
-
|
150
|
-
ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui
|
151
|
-
ui.warn("[DEPRECATED FOR #{major_version}.0] #{message}")
|
139
|
+
return unless bundler_major_version >= major_version && prints_major_deprecations?
|
140
|
+
Bundler.ui.warn("[DEPRECATED] #{message}")
|
152
141
|
end
|
153
142
|
|
154
143
|
def print_major_deprecations!
|
155
144
|
multiple_gemfiles = search_up(".") do |dir|
|
156
145
|
gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
|
157
146
|
next if gemfiles.empty?
|
158
|
-
break
|
147
|
+
break gemfiles.size != 1
|
159
148
|
end
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
if RUBY_VERSION < "2"
|
166
|
-
major_deprecation(2, "Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
|
167
|
-
end
|
168
|
-
return if Bundler.rubygems.provides?(">= 2")
|
169
|
-
major_deprecation(2, "Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
|
149
|
+
return unless multiple_gemfiles
|
150
|
+
message = "Multiple gemfiles (gems.rb and Gemfile) detected. " \
|
151
|
+
"Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked."
|
152
|
+
Bundler.ui.warn message
|
170
153
|
end
|
171
154
|
|
172
155
|
def trap(signal, override = false, &block)
|
@@ -243,16 +226,14 @@ module Bundler
|
|
243
226
|
raise Bundler::PathError, message
|
244
227
|
end
|
245
228
|
|
246
|
-
def find_gemfile
|
229
|
+
def find_gemfile
|
247
230
|
given = ENV["BUNDLE_GEMFILE"]
|
248
231
|
return given if given && !given.empty?
|
249
|
-
|
250
|
-
names.reverse! if order_matters && Bundler.feature_flag.prefer_gems_rb?
|
251
|
-
find_file(*names)
|
232
|
+
find_file(*gemfile_names)
|
252
233
|
end
|
253
234
|
|
254
235
|
def gemfile_names
|
255
|
-
["
|
236
|
+
["gems.rb", "Gemfile"]
|
256
237
|
end
|
257
238
|
|
258
239
|
def find_file(*names)
|
@@ -269,14 +250,14 @@ module Bundler
|
|
269
250
|
|
270
251
|
def search_up(*names)
|
271
252
|
previous = nil
|
272
|
-
current = File.expand_path(SharedHelpers.pwd).untaint
|
253
|
+
current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
273
254
|
|
274
255
|
until !File.directory?(current) || current == previous
|
275
256
|
if ENV["BUNDLE_SPEC_RUN"]
|
276
257
|
# avoid stepping above the tmp directory when testing
|
277
|
-
gemspec = if ENV["
|
258
|
+
gemspec = if ENV["GEM_COMMAND"]
|
278
259
|
# for Ruby Core
|
279
|
-
"lib/bundler.gemspec"
|
260
|
+
"lib/bundler/bundler.gemspec"
|
280
261
|
else
|
281
262
|
"bundler.gemspec"
|
282
263
|
end
|
@@ -306,21 +287,17 @@ module Bundler
|
|
306
287
|
public :set_env
|
307
288
|
|
308
289
|
def set_bundle_variables
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
315
|
-
rescue Gem::GemNotFoundException
|
316
|
-
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
|
317
|
-
# for Ruby core repository
|
318
|
-
exe_file = File.expand_path("../../../../bin/bundle", __FILE__) unless File.exist?(exe_file)
|
319
|
-
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
320
|
-
end
|
290
|
+
# bundler exe & lib folders have same root folder, typical gem installation
|
291
|
+
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
|
292
|
+
|
293
|
+
# for Ruby core repository testing
|
294
|
+
exe_file = File.expand_path("../../../libexec/bundle", __FILE__) unless File.exist?(exe_file)
|
321
295
|
|
322
|
-
#
|
323
|
-
Bundler
|
296
|
+
# bundler is a default gem, exe path is separate
|
297
|
+
exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
|
298
|
+
|
299
|
+
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
300
|
+
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
|
324
301
|
Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
|
325
302
|
end
|
326
303
|
|
@@ -333,14 +310,15 @@ module Bundler
|
|
333
310
|
|
334
311
|
def set_rubyopt
|
335
312
|
rubyopt = [ENV["RUBYOPT"]].compact
|
336
|
-
|
337
|
-
rubyopt.
|
313
|
+
setup_require = "-r#{File.expand_path("setup", __dir__)}"
|
314
|
+
return if !rubyopt.empty? && rubyopt.first =~ /#{setup_require}/
|
315
|
+
rubyopt.unshift setup_require
|
338
316
|
Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
|
339
317
|
end
|
340
318
|
|
341
319
|
def set_rubylib
|
342
320
|
rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
|
343
|
-
rubylib.unshift bundler_ruby_lib
|
321
|
+
rubylib.unshift bundler_ruby_lib unless RbConfig::CONFIG["rubylibdir"] == bundler_ruby_lib
|
344
322
|
Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR)
|
345
323
|
end
|
346
324
|
|
@@ -349,9 +327,6 @@ module Bundler
|
|
349
327
|
end
|
350
328
|
|
351
329
|
def clean_load_path
|
352
|
-
# handle 1.9 where system gems are always on the load path
|
353
|
-
return unless defined?(::Gem)
|
354
|
-
|
355
330
|
bundler_lib = bundler_ruby_lib
|
356
331
|
|
357
332
|
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
|
@@ -371,10 +346,9 @@ module Bundler
|
|
371
346
|
end
|
372
347
|
|
373
348
|
def prints_major_deprecations?
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
require "bundler/deprecate"
|
349
|
+
require_relative "../bundler"
|
350
|
+
return false if Bundler.settings[:silence_deprecations]
|
351
|
+
require_relative "deprecate"
|
378
352
|
return false if Bundler::Deprecate.skip
|
379
353
|
true
|
380
354
|
end
|