bundler 1.17.0.pre.2 → 2.1.0.pre.2
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 +769 -570
- data/LICENSE.md +18 -19
- data/README.md +9 -8
- data/bundler.gemspec +12 -23
- data/exe/bundle +19 -3
- data/lib/bundler.rb +121 -68
- data/lib/bundler/build_metadata.rb +14 -7
- data/lib/bundler/capistrano.rb +4 -4
- data/lib/bundler/cli.rb +129 -121
- data/lib/bundler/cli/add.rb +27 -16
- 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 +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 +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/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 +31 -11
- 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 +15 -39
- data/lib/bundler/env.rb +8 -13
- data/lib/bundler/environment_preserver.rb +0 -1
- data/lib/bundler/feature_flag.rb +23 -32
- 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 +4 -1
- data/lib/bundler/fetcher/index.rb +4 -2
- data/lib/bundler/friendly_errors.rb +4 -5
- data/lib/bundler/gem_helper.rb +39 -24
- 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 +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 -8
- 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 +42 -29
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/api/source.rb +2 -2
- 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/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 +10 -66
- data/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +144 -395
- data/lib/bundler/runtime.rb +2 -9
- data/lib/bundler/settings.rb +15 -47
- data/lib/bundler/setup.rb +6 -5
- data/lib/bundler/shared_helpers.rb +64 -67
- 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 +9 -5
- 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 +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/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 +151 -48
- data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +5 -0
- 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 +7 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +21 -11
- 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/file_manipulation.rb +11 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/base.rb +16 -17
- data/lib/bundler/vendor/thor/lib/thor/error.rb +82 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- 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/parser/options.rb +7 -2
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +52 -7
- 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/vendor/thor/lib/thor/version.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 +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-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 +52 -36
- data/man/bundle-config.1.txt +82 -67
- data/man/bundle-config.ronn +56 -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-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 +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
- metadata +17 -104
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/cache.rb +0 -36
- data/lib/bundler/compatibility_guard.rb +0 -14
- 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/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
@@ -4,9 +4,9 @@ require "uri"
|
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
class Settings
|
7
|
-
autoload :Mirror, "
|
8
|
-
autoload :Mirrors, "
|
9
|
-
autoload :Validator, "
|
7
|
+
autoload :Mirror, File.expand_path("mirror", __dir__)
|
8
|
+
autoload :Mirrors, File.expand_path("mirror", __dir__)
|
9
|
+
autoload :Validator, File.expand_path("settings/validator", __dir__)
|
10
10
|
|
11
11
|
BOOL_KEYS = %w[
|
12
12
|
allow_bundler_dependency_conflicts
|
@@ -17,8 +17,6 @@ module Bundler
|
|
17
17
|
auto_config_jobs
|
18
18
|
cache_all
|
19
19
|
cache_all_platforms
|
20
|
-
cache_command_is_package
|
21
|
-
console_command
|
22
20
|
default_install_uses_path
|
23
21
|
deployment
|
24
22
|
deployment_means_frozen
|
@@ -29,28 +27,24 @@ module Bundler
|
|
29
27
|
disable_platform_warnings
|
30
28
|
disable_shared_gems
|
31
29
|
disable_version_check
|
32
|
-
error_on_stderr
|
33
30
|
force_ruby_platform
|
34
31
|
forget_cli_options
|
35
32
|
frozen
|
36
33
|
gem.coc
|
37
34
|
gem.mit
|
38
|
-
global_path_appends_ruby_scope
|
39
35
|
global_gem_cache
|
40
36
|
ignore_messages
|
41
37
|
init_gems_rb
|
42
|
-
list_command
|
43
|
-
lockfile_uses_separate_rubygems_sources
|
44
|
-
major_deprecations
|
45
38
|
no_install
|
46
39
|
no_prune
|
47
40
|
only_update_to_newer_versions
|
48
41
|
path_relative_to_cwd
|
49
42
|
path.system
|
50
43
|
plugins
|
51
|
-
|
44
|
+
prefer_patch
|
52
45
|
print_only_version_number
|
53
46
|
setup_makes_kernel_gem_public
|
47
|
+
silence_deprecations
|
54
48
|
silence_root_warning
|
55
49
|
skip_default_git_sources
|
56
50
|
specific_platform
|
@@ -58,7 +52,6 @@ module Bundler
|
|
58
52
|
unlock_source_unlocks_spec
|
59
53
|
update_requires_all_flag
|
60
54
|
use_gem_version_promoter_for_major_updates
|
61
|
-
viz_command
|
62
55
|
].freeze
|
63
56
|
|
64
57
|
NUMBER_KEYS = %w[
|
@@ -75,7 +68,9 @@ module Bundler
|
|
75
68
|
].freeze
|
76
69
|
|
77
70
|
DEFAULT_CONFIG = {
|
71
|
+
:silence_deprecations => false,
|
78
72
|
:disable_version_check => true,
|
73
|
+
:prefer_patch => false,
|
79
74
|
:redirect => 5,
|
80
75
|
:retry => 3,
|
81
76
|
:timeout => 10,
|
@@ -106,18 +101,6 @@ module Bundler
|
|
106
101
|
temporary(key => value)
|
107
102
|
value
|
108
103
|
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
104
|
set_local(key, value)
|
122
105
|
end
|
123
106
|
end
|
@@ -220,23 +203,22 @@ module Bundler
|
|
220
203
|
locations
|
221
204
|
end
|
222
205
|
|
223
|
-
# for legacy reasons, in Bundler
|
224
|
-
# nor do we respect :disable_shared_gems
|
206
|
+
# for legacy reasons, in Bundler 2, we do not respect :disable_shared_gems
|
225
207
|
def path
|
226
208
|
key = key_for(:path)
|
227
209
|
path = ENV[key] || @global_config[key]
|
228
210
|
if path && !@temporary.key?(key) && !@local_config.key?(key)
|
229
|
-
return Path.new(path,
|
211
|
+
return Path.new(path, false, false)
|
230
212
|
end
|
231
213
|
|
232
214
|
system_path = self["path.system"] || (self[:disable_shared_gems] == false)
|
233
|
-
Path.new(self[:path],
|
215
|
+
Path.new(self[:path], system_path, Bundler.feature_flag.default_install_uses_path?)
|
234
216
|
end
|
235
217
|
|
236
|
-
Path = Struct.new(:explicit_path, :
|
218
|
+
Path = Struct.new(:explicit_path, :system_path, :default_install_uses_path) do
|
237
219
|
def path
|
238
220
|
path = base_path
|
239
|
-
path = File.join(path, Bundler.ruby_scope)
|
221
|
+
path = File.join(path, Bundler.ruby_scope) unless use_system_gems?
|
240
222
|
path
|
241
223
|
end
|
242
224
|
|
@@ -371,7 +353,7 @@ module Bundler
|
|
371
353
|
return unless file
|
372
354
|
SharedHelpers.filesystem_access(file) do |p|
|
373
355
|
FileUtils.mkdir_p(p.dirname)
|
374
|
-
|
356
|
+
require_relative "yaml_serializer"
|
375
357
|
p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
|
376
358
|
end
|
377
359
|
end
|
@@ -406,26 +388,12 @@ module Bundler
|
|
406
388
|
Pathname.new(@root).join("config") if @root
|
407
389
|
end
|
408
390
|
|
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
391
|
def load_config(config_file)
|
424
392
|
return {} if !config_file || ignore_config?
|
425
393
|
SharedHelpers.filesystem_access(config_file, :read) do |file|
|
426
394
|
valid_file = file.exist? && !file.size.zero?
|
427
395
|
return {} unless valid_file
|
428
|
-
|
396
|
+
require_relative "yaml_serializer"
|
429
397
|
YAMLSerializer.load file.read
|
430
398
|
end
|
431
399
|
end
|
@@ -441,7 +409,7 @@ module Bundler
|
|
441
409
|
(https?.*?) # URI
|
442
410
|
(\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key
|
443
411
|
\z
|
444
|
-
/ix
|
412
|
+
/ix.freeze
|
445
413
|
|
446
414
|
# TODO: duplicates Rubygems#normalize_uri
|
447
415
|
# TODO: is this the correct place to validate mirror URIs?
|
data/lib/bundler/setup.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
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
|
+
Bundler.ui = Bundler::UI::Shell.new
|
9
10
|
begin
|
10
11
|
Bundler.setup
|
11
12
|
rescue Bundler::BundlerError => e
|
12
|
-
|
13
|
-
|
13
|
+
Bundler.ui.warn "\e[31m#{e.message}\e[0m"
|
14
|
+
Bundler.ui.warn e.backtrace.join("\n") if ENV["DEBUG"]
|
14
15
|
if e.is_a?(Bundler::GemNotFound)
|
15
|
-
|
16
|
+
Bundler.ui.warn "\e[33mRun `bundle install` to install missing gems.\e[0m"
|
16
17
|
end
|
17
18
|
exit e.status_code
|
18
19
|
end
|
@@ -1,25 +1,12 @@
|
|
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
|
@@ -30,7 +17,7 @@ module Bundler
|
|
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
22
|
Pathname.new(gemfile).untaint.expand_path
|
36
23
|
end
|
@@ -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.untaint)
|
119
104
|
rescue Errno::EACCES
|
120
105
|
raise PermissionError.new(path, action)
|
121
106
|
rescue Errno::EAGAIN
|
@@ -140,33 +125,29 @@ module Bundler
|
|
140
125
|
end
|
141
126
|
|
142
127
|
def major_deprecation(major_version, message)
|
143
|
-
|
144
|
-
|
145
|
-
|
128
|
+
bundler_major_version = Bundler.bundler_major_version
|
129
|
+
if bundler_major_version > major_version
|
130
|
+
require_relative "errors"
|
131
|
+
raise DeprecatedError, "[REMOVED] #{message}"
|
146
132
|
end
|
147
133
|
|
148
|
-
return unless prints_major_deprecations?
|
134
|
+
return unless bundler_major_version >= major_version && prints_major_deprecations?
|
149
135
|
@major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
|
150
|
-
|
151
|
-
|
136
|
+
with_major_deprecation_ui do |ui|
|
137
|
+
ui.warn("[DEPRECATED] #{message}")
|
138
|
+
end
|
152
139
|
end
|
153
140
|
|
154
141
|
def print_major_deprecations!
|
155
142
|
multiple_gemfiles = search_up(".") do |dir|
|
156
143
|
gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
|
157
144
|
next if gemfiles.empty?
|
158
|
-
break
|
159
|
-
end
|
160
|
-
if multiple_gemfiles && Bundler.bundler_major_version == 1
|
161
|
-
Bundler::SharedHelpers.major_deprecation 2, \
|
162
|
-
"gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
|
163
|
-
end
|
164
|
-
|
165
|
-
if RUBY_VERSION < "2"
|
166
|
-
major_deprecation(2, "Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
|
145
|
+
break gemfiles.size != 1
|
167
146
|
end
|
168
|
-
return
|
169
|
-
|
147
|
+
return unless multiple_gemfiles
|
148
|
+
message = "Multiple gemfiles (gems.rb and Gemfile) detected. " \
|
149
|
+
"Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.rb.locked."
|
150
|
+
Bundler.ui.warn message
|
170
151
|
end
|
171
152
|
|
172
153
|
def trap(signal, override = false, &block)
|
@@ -231,6 +212,21 @@ module Bundler
|
|
231
212
|
|
232
213
|
private
|
233
214
|
|
215
|
+
def with_major_deprecation_ui(&block)
|
216
|
+
ui = Bundler.ui
|
217
|
+
|
218
|
+
if ui.is_a?(@major_deprecation_ui.class)
|
219
|
+
yield ui
|
220
|
+
else
|
221
|
+
begin
|
222
|
+
Bundler.ui = @major_deprecation_ui
|
223
|
+
yield Bundler.ui
|
224
|
+
ensure
|
225
|
+
Bundler.ui = ui
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
234
230
|
def validate_bundle_path
|
235
231
|
path_separator = Bundler.rubygems.path_separator
|
236
232
|
return unless Bundler.bundle_path.to_s.split(path_separator).size > 1
|
@@ -243,16 +239,14 @@ module Bundler
|
|
243
239
|
raise Bundler::PathError, message
|
244
240
|
end
|
245
241
|
|
246
|
-
def find_gemfile
|
242
|
+
def find_gemfile
|
247
243
|
given = ENV["BUNDLE_GEMFILE"]
|
248
244
|
return given if given && !given.empty?
|
249
|
-
|
250
|
-
names.reverse! if order_matters && Bundler.feature_flag.prefer_gems_rb?
|
251
|
-
find_file(*names)
|
245
|
+
find_file(*gemfile_names)
|
252
246
|
end
|
253
247
|
|
254
248
|
def gemfile_names
|
255
|
-
["
|
249
|
+
["gems.rb", "Gemfile"]
|
256
250
|
end
|
257
251
|
|
258
252
|
def find_file(*names)
|
@@ -274,7 +268,15 @@ module Bundler
|
|
274
268
|
until !File.directory?(current) || current == previous
|
275
269
|
if ENV["BUNDLE_SPEC_RUN"]
|
276
270
|
# avoid stepping above the tmp directory when testing
|
277
|
-
|
271
|
+
gemspec = if ENV["GEM_COMMAND"]
|
272
|
+
# for Ruby Core
|
273
|
+
"lib/bundler/bundler.gemspec"
|
274
|
+
else
|
275
|
+
"bundler.gemspec"
|
276
|
+
end
|
277
|
+
|
278
|
+
# avoid stepping above the tmp directory when testing
|
279
|
+
return nil if File.file?(File.join(current, gemspec))
|
278
280
|
end
|
279
281
|
|
280
282
|
names.each do |name|
|
@@ -298,19 +300,17 @@ module Bundler
|
|
298
300
|
public :set_env
|
299
301
|
|
300
302
|
def set_bundle_variables
|
301
|
-
|
302
|
-
|
303
|
-
unless File.exist?(exe_file)
|
304
|
-
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
|
305
|
-
end
|
303
|
+
# bundler exe & lib folders have same root folder, typical gem installation
|
304
|
+
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
|
306
305
|
|
307
|
-
|
308
|
-
|
309
|
-
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", File.expand_path("../../../exe/bundle", __FILE__)
|
310
|
-
end
|
306
|
+
# for Ruby core repository testing
|
307
|
+
exe_file = File.expand_path("../../../libexec/bundle", __FILE__) unless File.exist?(exe_file)
|
311
308
|
|
312
|
-
#
|
313
|
-
Bundler
|
309
|
+
# bundler is a default gem, exe path is separate
|
310
|
+
exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)
|
311
|
+
|
312
|
+
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
313
|
+
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
|
314
314
|
Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
|
315
315
|
end
|
316
316
|
|
@@ -323,14 +323,15 @@ module Bundler
|
|
323
323
|
|
324
324
|
def set_rubyopt
|
325
325
|
rubyopt = [ENV["RUBYOPT"]].compact
|
326
|
-
|
327
|
-
rubyopt.
|
326
|
+
setup_require = "-r#{File.expand_path("setup", __dir__)}"
|
327
|
+
return if !rubyopt.empty? && rubyopt.first =~ /#{setup_require}/
|
328
|
+
rubyopt.unshift setup_require
|
328
329
|
Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
|
329
330
|
end
|
330
331
|
|
331
332
|
def set_rubylib
|
332
333
|
rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
|
333
|
-
rubylib.unshift bundler_ruby_lib
|
334
|
+
rubylib.unshift bundler_ruby_lib unless RbConfig::CONFIG["rubylibdir"] == bundler_ruby_lib
|
334
335
|
Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR)
|
335
336
|
end
|
336
337
|
|
@@ -339,9 +340,6 @@ module Bundler
|
|
339
340
|
end
|
340
341
|
|
341
342
|
def clean_load_path
|
342
|
-
# handle 1.9 where system gems are always on the load path
|
343
|
-
return unless defined?(::Gem)
|
344
|
-
|
345
343
|
bundler_lib = bundler_ruby_lib
|
346
344
|
|
347
345
|
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
|
@@ -361,10 +359,9 @@ module Bundler
|
|
361
359
|
end
|
362
360
|
|
363
361
|
def prints_major_deprecations?
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
require "bundler/deprecate"
|
362
|
+
require_relative "../bundler"
|
363
|
+
return false if Bundler.settings[:silence_deprecations]
|
364
|
+
require_relative "deprecate"
|
368
365
|
return false if Bundler::Deprecate.skip
|
369
366
|
true
|
370
367
|
end
|
@@ -28,7 +28,7 @@ module Bundler
|
|
28
28
|
|
29
29
|
protected
|
30
30
|
|
31
|
-
#
|
31
|
+
# https://www.informit.com/articles/article.aspx?p=683059&seqNum=36
|
32
32
|
def levenshtein_distance(this, that, ins = 2, del = 2, sub = 1)
|
33
33
|
# ins, del, sub are weighted costs
|
34
34
|
return nil if this.nil?
|
@@ -51,7 +51,7 @@ module Bundler
|
|
51
51
|
dm[i][j] = [
|
52
52
|
dm[i - 1][j - 1] + (this[j - 1] == that[i - 1] ? 0 : sub),
|
53
53
|
dm[i][j - 1] + ins,
|
54
|
-
dm[i - 1][j] + del
|
54
|
+
dm[i - 1][j] + del,
|
55
55
|
].min
|
56
56
|
end
|
57
57
|
end
|