bundler 1.15.1 → 1.17.3
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 +5 -5
- data/CHANGELOG.md +320 -0
- data/README.md +17 -8
- data/bundler.gemspec +25 -9
- data/exe/bundle +1 -6
- data/exe/bundle_ruby +4 -3
- data/lib/bundler/build_metadata.rb +53 -0
- data/lib/bundler/capistrano.rb +5 -0
- data/lib/bundler/cli/add.rb +15 -6
- data/lib/bundler/cli/binstubs.rb +17 -9
- data/lib/bundler/cli/cache.rb +5 -4
- data/lib/bundler/cli/check.rb +3 -5
- data/lib/bundler/cli/clean.rb +5 -6
- data/lib/bundler/cli/common.rb +11 -2
- data/lib/bundler/cli/config.rb +2 -1
- data/lib/bundler/cli/console.rb +2 -1
- data/lib/bundler/cli/doctor.rb +48 -1
- data/lib/bundler/cli/exec.rb +6 -5
- data/lib/bundler/cli/gem.rb +13 -8
- data/lib/bundler/cli/info.rb +0 -1
- data/lib/bundler/cli/init.rb +18 -6
- data/lib/bundler/cli/inject.rb +1 -0
- data/lib/bundler/cli/install.rb +64 -77
- data/lib/bundler/cli/issue.rb +1 -1
- data/lib/bundler/cli/list.rb +58 -0
- data/lib/bundler/cli/lock.rb +0 -1
- data/lib/bundler/cli/open.rb +2 -2
- data/lib/bundler/cli/outdated.rb +20 -9
- data/lib/bundler/cli/package.rb +9 -6
- data/lib/bundler/cli/platform.rb +1 -0
- data/lib/bundler/cli/plugin.rb +1 -0
- data/lib/bundler/cli/pristine.rb +20 -6
- data/lib/bundler/cli/remove.rb +18 -0
- data/lib/bundler/cli/show.rb +0 -1
- data/lib/bundler/cli/update.rb +35 -7
- data/lib/bundler/cli/viz.rb +4 -0
- data/lib/bundler/cli.rb +234 -90
- data/lib/bundler/compact_index_client/cache.rb +1 -2
- data/lib/bundler/compact_index_client/updater.rb +35 -7
- data/lib/bundler/compact_index_client.rb +1 -0
- data/lib/bundler/compatibility_guard.rb +14 -0
- data/lib/bundler/constants.rb +1 -0
- data/lib/bundler/current_ruby.rb +13 -5
- data/lib/bundler/definition.rb +192 -139
- data/lib/bundler/dep_proxy.rb +3 -1
- data/lib/bundler/dependency.rb +9 -9
- data/lib/bundler/deployment.rb +1 -1
- data/lib/bundler/deprecate.rb +15 -3
- data/lib/bundler/dsl.rb +115 -64
- data/lib/bundler/endpoint_specification.rb +10 -1
- data/lib/bundler/env.rb +90 -29
- data/lib/bundler/environment_preserver.rb +27 -6
- data/lib/bundler/errors.rb +1 -0
- data/lib/bundler/feature_flag.rb +46 -4
- data/lib/bundler/fetcher/base.rb +1 -0
- data/lib/bundler/fetcher/compact_index.rb +2 -11
- data/lib/bundler/fetcher/dependency.rb +2 -1
- data/lib/bundler/fetcher/downloader.rb +11 -5
- data/lib/bundler/fetcher/index.rb +3 -2
- data/lib/bundler/fetcher.rb +18 -11
- data/lib/bundler/friendly_errors.rb +6 -1
- data/lib/bundler/gem_helper.rb +19 -10
- data/lib/bundler/gem_helpers.rb +1 -0
- data/lib/bundler/gem_remote_fetcher.rb +1 -0
- data/lib/bundler/gem_tasks.rb +1 -0
- data/lib/bundler/gem_version_promoter.rb +17 -2
- data/lib/bundler/gemdeps.rb +1 -0
- data/lib/bundler/graph.rb +1 -0
- data/lib/bundler/index.rb +8 -8
- data/lib/bundler/injector.rb +192 -30
- data/lib/bundler/inline.rb +10 -10
- data/lib/bundler/installer/gem_installer.rb +12 -2
- data/lib/bundler/installer/parallel_installer.rb +78 -42
- data/lib/bundler/installer/standalone.rb +1 -0
- data/lib/bundler/installer.rb +138 -53
- data/lib/bundler/lazy_specification.rb +3 -2
- data/lib/bundler/lockfile_generator.rb +95 -0
- data/lib/bundler/lockfile_parser.rb +10 -4
- data/lib/bundler/match_platform.rb +1 -0
- data/lib/bundler/mirror.rb +8 -5
- data/lib/bundler/plugin/api/source.rb +9 -2
- data/lib/bundler/plugin/events.rb +61 -0
- data/lib/bundler/plugin/index.rb +7 -2
- data/lib/bundler/plugin/installer.rb +7 -6
- data/lib/bundler/plugin/source_list.rb +7 -8
- data/lib/bundler/plugin.rb +13 -5
- data/lib/bundler/process_lock.rb +24 -0
- data/lib/bundler/psyched_yaml.rb +10 -0
- data/lib/bundler/remote_specification.rb +10 -1
- data/lib/bundler/resolver/spec_group.rb +106 -0
- data/lib/bundler/resolver.rb +158 -195
- data/lib/bundler/retry.rb +1 -0
- data/lib/bundler/ruby_dsl.rb +1 -0
- data/lib/bundler/ruby_version.rb +2 -1
- data/lib/bundler/rubygems_ext.rb +5 -4
- data/lib/bundler/rubygems_gem_installer.rb +31 -1
- data/lib/bundler/rubygems_integration.rb +71 -32
- data/lib/bundler/runtime.rb +11 -9
- data/lib/bundler/settings/validator.rb +102 -0
- data/lib/bundler/settings.rb +213 -86
- data/lib/bundler/setup.rb +4 -7
- data/lib/bundler/shared_helpers.rb +131 -26
- data/lib/bundler/similarity_detector.rb +1 -0
- data/lib/bundler/source/gemspec.rb +1 -0
- data/lib/bundler/source/git/git_proxy.rb +21 -11
- data/lib/bundler/source/git.rb +24 -19
- data/lib/bundler/source/metadata.rb +62 -0
- data/lib/bundler/source/path/installer.rb +2 -0
- data/lib/bundler/source/path.rb +11 -7
- data/lib/bundler/source/rubygems/remote.rb +8 -2
- data/lib/bundler/source/rubygems.rb +161 -84
- data/lib/bundler/source.rb +36 -0
- data/lib/bundler/source_list.rb +75 -15
- data/lib/bundler/spec_set.rb +12 -6
- data/lib/bundler/ssl_certs/certificate_manager.rb +2 -1
- data/lib/bundler/stub_specification.rb +1 -0
- data/lib/bundler/templates/.document +1 -0
- data/lib/bundler/templates/Executable +12 -0
- data/lib/bundler/templates/Executable.bundler +105 -0
- data/lib/bundler/templates/Gemfile +3 -0
- data/lib/bundler/templates/gems.rb +8 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +2 -0
- data/lib/bundler/templates/newgem/README.md.tt +1 -1
- data/lib/bundler/templates/newgem/gitignore.tt +0 -1
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +12 -3
- data/lib/bundler/templates/newgem/rspec.tt +1 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +0 -2
- data/lib/bundler/templates/newgem/{.travis.yml.tt → travis.yml.tt} +2 -0
- data/lib/bundler/ui/rg_proxy.rb +1 -0
- data/lib/bundler/ui/shell.rb +17 -4
- data/lib/bundler/ui/silent.rb +1 -0
- data/lib/bundler/ui.rb +1 -0
- data/lib/bundler/uri_credentials_filter.rb +1 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1638 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/compatibility.rb +26 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +7 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +15 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +3 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +75 -7
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +2 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +3 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +491 -148
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +1 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +8 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +2 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +3 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +9 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +45 -8
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +9 -3
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -3
- data/lib/bundler/vendor/thor/lib/thor/base.rb +27 -4
- data/lib/bundler/vendor/thor/lib/thor/command.rb +9 -7
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +12 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +2 -0
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +6 -5
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +6 -4
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -9
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +25 -8
- data/lib/bundler/vendored_fileutils.rb +9 -0
- data/lib/bundler/vendored_molinillo.rb +1 -0
- data/lib/bundler/vendored_persistent.rb +35 -0
- data/lib/bundler/vendored_thor.rb +1 -0
- data/lib/bundler/version.rb +6 -2
- data/lib/bundler/version_ranges.rb +1 -0
- data/lib/bundler/vlad.rb +5 -0
- data/lib/bundler/worker.rb +1 -0
- data/lib/bundler/yaml_serializer.rb +3 -3
- data/lib/bundler.rb +86 -52
- data/man/bundle-add.1 +18 -3
- data/man/bundle-add.1.txt +26 -14
- data/man/bundle-add.ronn +13 -2
- data/man/bundle-binstubs.1 +11 -1
- data/man/bundle-binstubs.1.txt +33 -18
- data/man/bundle-binstubs.ronn +15 -1
- data/man/bundle-check.1 +4 -4
- data/man/bundle-check.1.txt +15 -14
- data/man/bundle-check.ronn +3 -3
- data/man/bundle-clean.1 +1 -1
- data/man/bundle-clean.1.txt +10 -10
- data/man/bundle-config.1 +129 -29
- data/man/bundle-config.1.txt +285 -174
- data/man/bundle-config.ronn +167 -88
- data/man/bundle-doctor.1 +44 -0
- data/man/bundle-doctor.1.txt +44 -0
- data/man/bundle-doctor.ronn +33 -0
- data/man/bundle-exec.1 +6 -3
- data/man/bundle-exec.1.txt +78 -71
- data/man/bundle-exec.ronn +10 -3
- data/man/bundle-gem.1 +4 -4
- data/man/bundle-gem.1.txt +41 -40
- data/man/bundle-gem.ronn +3 -2
- data/man/bundle-info.1 +1 -1
- data/man/bundle-info.1.txt +8 -8
- data/man/bundle-init.1 +9 -4
- data/man/bundle-init.1.txt +23 -13
- data/man/bundle-init.ronn +15 -4
- data/man/bundle-inject.1 +4 -4
- data/man/bundle-inject.1.txt +10 -10
- data/man/bundle-inject.ronn +3 -3
- data/man/bundle-install.1 +31 -28
- data/man/bundle-install.1.txt +205 -194
- data/man/bundle-install.ronn +44 -35
- data/man/bundle-list.1 +50 -0
- data/man/bundle-list.1.txt +43 -0
- data/man/bundle-list.ronn +33 -0
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +47 -47
- data/man/bundle-lock.ronn +1 -1
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +7 -7
- data/man/bundle-outdated.1 +7 -3
- data/man/bundle-outdated.1.txt +40 -36
- data/man/bundle-outdated.ronn +6 -2
- data/man/bundle-package.1 +6 -3
- data/man/bundle-package.1.txt +44 -39
- data/man/bundle-package.ronn +7 -2
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +13 -13
- data/man/bundle-pristine.1 +21 -3
- data/man/bundle-pristine.1.txt +33 -10
- data/man/bundle-pristine.ronn +24 -3
- data/man/bundle-remove.1 +31 -0
- data/man/bundle-remove.1.txt +34 -0
- data/man/bundle-remove.ronn +23 -0
- data/man/bundle-show.1 +3 -3
- data/man/bundle-show.1.txt +14 -12
- data/man/bundle-show.ronn +3 -2
- data/man/bundle-update.1 +13 -9
- data/man/bundle-update.1.txt +133 -130
- data/man/bundle-update.ronn +21 -17
- data/man/bundle-viz.1 +7 -7
- data/man/bundle-viz.1.txt +17 -15
- data/man/bundle-viz.ronn +6 -6
- data/man/bundle.1 +31 -32
- data/man/bundle.1.txt +63 -75
- data/man/bundle.ronn +35 -47
- data/man/gemfile.5 +44 -8
- data/man/gemfile.5.ronn +54 -8
- data/man/gemfile.5.txt +218 -165
- data/man/index.txt +25 -15
- metadata +36 -44
- data/.codeclimate.yml +0 -25
- data/.gitignore +0 -18
- data/.rspec +0 -3
- data/.rubocop.yml +0 -131
- data/.rubocop_todo.yml +0 -418
- data/.travis.yml +0 -122
- data/CODE_OF_CONDUCT.md +0 -42
- data/CONTRIBUTING.md +0 -17
- data/Rakefile +0 -346
- data/bin/rake +0 -19
- data/bin/rspec +0 -15
- data/bin/rubocop +0 -17
- data/bin/with_rubygems +0 -39
- data/doc/README.md +0 -30
- data/doc/TROUBLESHOOTING.md +0 -64
- data/doc/contributing/BUG_TRIAGE.md +0 -36
- data/doc/contributing/COMMUNITY.md +0 -13
- data/doc/contributing/GETTING_HELP.md +0 -11
- data/doc/contributing/HOW_YOU_CAN_HELP.md +0 -27
- data/doc/contributing/ISSUES.md +0 -51
- data/doc/contributing/README.md +0 -38
- data/doc/development/NEW_FEATURES.md +0 -10
- data/doc/development/PULL_REQUESTS.md +0 -40
- data/doc/development/README.md +0 -19
- data/doc/development/RELEASING.md +0 -9
- data/doc/development/SETUP.md +0 -29
- data/doc/documentation/README.md +0 -29
- data/doc/documentation/VISION.md +0 -26
- data/doc/documentation/WRITING.md +0 -54
- data/lib/bundler/postit_trampoline.rb +0 -73
- data/lib/bundler/vendor/postit/lib/postit/environment.rb +0 -44
- data/lib/bundler/vendor/postit/lib/postit/installer.rb +0 -28
- data/lib/bundler/vendor/postit/lib/postit/parser.rb +0 -21
- data/lib/bundler/vendor/postit/lib/postit/setup.rb +0 -12
- data/lib/bundler/vendor/postit/lib/postit/version.rb +0 -3
- data/lib/bundler/vendor/postit/lib/postit.rb +0 -15
- data/task/release.rake +0 -116
data/lib/bundler/settings.rb
CHANGED
@@ -1,60 +1,96 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "uri"
|
3
4
|
|
4
5
|
module Bundler
|
5
6
|
class Settings
|
6
7
|
autoload :Mirror, "bundler/mirror"
|
7
8
|
autoload :Mirrors, "bundler/mirror"
|
9
|
+
autoload :Validator, "bundler/settings/validator"
|
8
10
|
|
9
|
-
BOOL_KEYS = %w
|
11
|
+
BOOL_KEYS = %w[
|
12
|
+
allow_bundler_dependency_conflicts
|
13
|
+
allow_deployment_source_credential_changes
|
10
14
|
allow_offline_install
|
15
|
+
auto_clean_without_path
|
11
16
|
auto_install
|
17
|
+
auto_config_jobs
|
12
18
|
cache_all
|
13
19
|
cache_all_platforms
|
20
|
+
cache_command_is_package
|
21
|
+
console_command
|
22
|
+
default_install_uses_path
|
23
|
+
deployment
|
24
|
+
deployment_means_frozen
|
14
25
|
disable_checksum_validation
|
15
26
|
disable_exec_load
|
16
27
|
disable_local_branch_check
|
28
|
+
disable_multisource
|
29
|
+
disable_platform_warnings
|
17
30
|
disable_shared_gems
|
18
31
|
disable_version_check
|
32
|
+
error_on_stderr
|
19
33
|
force_ruby_platform
|
34
|
+
forget_cli_options
|
20
35
|
frozen
|
21
36
|
gem.coc
|
22
37
|
gem.mit
|
38
|
+
global_path_appends_ruby_scope
|
39
|
+
global_gem_cache
|
23
40
|
ignore_messages
|
41
|
+
init_gems_rb
|
42
|
+
list_command
|
43
|
+
lockfile_uses_separate_rubygems_sources
|
24
44
|
major_deprecations
|
25
45
|
no_install
|
26
46
|
no_prune
|
27
47
|
only_update_to_newer_versions
|
48
|
+
path_relative_to_cwd
|
49
|
+
path.system
|
28
50
|
plugins
|
51
|
+
prefer_gems_rb
|
52
|
+
print_only_version_number
|
53
|
+
setup_makes_kernel_gem_public
|
29
54
|
silence_root_warning
|
30
|
-
|
31
|
-
|
32
|
-
|
55
|
+
skip_default_git_sources
|
56
|
+
specific_platform
|
57
|
+
suppress_install_using_messages
|
58
|
+
unlock_source_unlocks_spec
|
59
|
+
update_requires_all_flag
|
60
|
+
use_gem_version_promoter_for_major_updates
|
61
|
+
viz_command
|
62
|
+
].freeze
|
63
|
+
|
64
|
+
NUMBER_KEYS = %w[
|
65
|
+
jobs
|
33
66
|
redirect
|
34
67
|
retry
|
35
68
|
ssl_verify_mode
|
36
69
|
timeout
|
37
|
-
|
70
|
+
].freeze
|
71
|
+
|
72
|
+
ARRAY_KEYS = %w[
|
73
|
+
with
|
74
|
+
without
|
75
|
+
].freeze
|
38
76
|
|
39
77
|
DEFAULT_CONFIG = {
|
78
|
+
:disable_version_check => true,
|
40
79
|
:redirect => 5,
|
41
80
|
:retry => 3,
|
42
81
|
:timeout => 10,
|
43
82
|
}.freeze
|
44
83
|
|
45
|
-
attr_accessor :cli_flags_given
|
46
|
-
|
47
84
|
def initialize(root = nil)
|
48
85
|
@root = root
|
49
86
|
@local_config = load_config(local_config_file)
|
50
87
|
@global_config = load_config(global_config_file)
|
51
|
-
@cli_flags_given = false
|
52
88
|
@temporary = {}
|
53
89
|
end
|
54
90
|
|
55
91
|
def [](name)
|
56
92
|
key = key_for(name)
|
57
|
-
value = @temporary.fetch(
|
93
|
+
value = @temporary.fetch(key) do
|
58
94
|
@local_config.fetch(key) do
|
59
95
|
ENV.fetch(key) do
|
60
96
|
@global_config.fetch(key) do
|
@@ -62,59 +98,62 @@ module Bundler
|
|
62
98
|
nil
|
63
99
|
end end end end end
|
64
100
|
|
65
|
-
|
66
|
-
nil
|
67
|
-
elsif is_bool(name) || value == "false"
|
68
|
-
to_bool(value)
|
69
|
-
elsif is_num(name)
|
70
|
-
value.to_i
|
71
|
-
else
|
72
|
-
value
|
73
|
-
end
|
101
|
+
converted_value(value, name)
|
74
102
|
end
|
75
103
|
|
76
|
-
def
|
77
|
-
if
|
104
|
+
def set_command_option(key, value)
|
105
|
+
if Bundler.feature_flag.forget_cli_options?
|
106
|
+
temporary(key => value)
|
107
|
+
value
|
108
|
+
else
|
78
109
|
command = if value.nil?
|
79
110
|
"bundle config --delete #{key}"
|
80
111
|
else
|
81
112
|
"bundle config #{key} #{Array(value).join(":")}"
|
82
113
|
end
|
83
114
|
|
84
|
-
Bundler::SharedHelpers.major_deprecation
|
115
|
+
Bundler::SharedHelpers.major_deprecation 2,\
|
85
116
|
"flags passed to commands " \
|
86
117
|
"will no longer be automatically remembered. Instead please set flags " \
|
87
118
|
"you want remembered between commands using `bundle config " \
|
88
119
|
"<setting name> <setting value>`, i.e. `#{command}`"
|
120
|
+
|
121
|
+
set_local(key, value)
|
89
122
|
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def set_command_option_if_given(key, value)
|
126
|
+
return if value.nil?
|
127
|
+
set_command_option(key, value)
|
128
|
+
end
|
129
|
+
|
130
|
+
def set_local(key, value)
|
90
131
|
local_config_file || raise(GemfileNotFound, "Could not locate Gemfile")
|
132
|
+
|
91
133
|
set_key(key, value, @local_config, local_config_file)
|
92
134
|
end
|
93
|
-
alias_method :set_local, :[]=
|
94
135
|
|
95
136
|
def temporary(update)
|
96
|
-
existing = Hash[update.map {|k, _| [k, @temporary[k]] }]
|
97
|
-
|
137
|
+
existing = Hash[update.map {|k, _| [k, @temporary[key_for(k)]] }]
|
138
|
+
update.each do |k, v|
|
139
|
+
set_key(k, v, @temporary, nil)
|
140
|
+
end
|
98
141
|
return unless block_given?
|
99
142
|
begin
|
100
143
|
yield
|
101
144
|
ensure
|
102
|
-
existing.each {|k, v|
|
145
|
+
existing.each {|k, v| set_key(k, v, @temporary, nil) }
|
103
146
|
end
|
104
147
|
end
|
105
148
|
|
106
|
-
def delete(key)
|
107
|
-
@local_config.delete(key_for(key))
|
108
|
-
end
|
109
|
-
|
110
149
|
def set_global(key, value)
|
111
150
|
set_key(key, value, @global_config, global_config_file)
|
112
151
|
end
|
113
152
|
|
114
153
|
def all
|
115
|
-
env_keys = ENV.keys.
|
154
|
+
env_keys = ENV.keys.grep(/\ABUNDLE_.+/)
|
116
155
|
|
117
|
-
keys = @global_config.keys | @local_config.keys | env_keys
|
156
|
+
keys = @temporary.keys | @global_config.keys | @local_config.keys | env_keys
|
118
157
|
|
119
158
|
keys.map do |key|
|
120
159
|
key.sub(/^BUNDLE_/, "").gsub(/__/, ".").downcase
|
@@ -140,7 +179,7 @@ module Bundler
|
|
140
179
|
|
141
180
|
def gem_mirrors
|
142
181
|
all.inject(Mirrors.new) do |mirrors, k|
|
143
|
-
mirrors.parse(k, self[k]) if k
|
182
|
+
mirrors.parse(k, self[k]) if k.start_with?("mirror.")
|
144
183
|
mirrors
|
145
184
|
end
|
146
185
|
end
|
@@ -148,6 +187,7 @@ module Bundler
|
|
148
187
|
def locations(key)
|
149
188
|
key = key_for(key)
|
150
189
|
locations = {}
|
190
|
+
locations[:temporary] = @temporary[key] if @temporary.key?(key)
|
151
191
|
locations[:local] = @local_config[key] if @local_config.key?(key)
|
152
192
|
locations[:env] = ENV[key] if ENV[key]
|
153
193
|
locations[:global] = @global_config[key] if @global_config.key?(key)
|
@@ -159,53 +199,91 @@ module Bundler
|
|
159
199
|
key = key_for(exposed_key)
|
160
200
|
|
161
201
|
locations = []
|
202
|
+
|
203
|
+
if @temporary.key?(key)
|
204
|
+
locations << "Set for the current command: #{converted_value(@temporary[key], exposed_key).inspect}"
|
205
|
+
end
|
206
|
+
|
162
207
|
if @local_config.key?(key)
|
163
|
-
locations << "Set for your local app (#{local_config_file}): #{@local_config[key].inspect}"
|
208
|
+
locations << "Set for your local app (#{local_config_file}): #{converted_value(@local_config[key], exposed_key).inspect}"
|
164
209
|
end
|
165
210
|
|
166
211
|
if value = ENV[key]
|
167
|
-
locations << "Set via #{key}: #{value.inspect}"
|
212
|
+
locations << "Set via #{key}: #{converted_value(value, exposed_key).inspect}"
|
168
213
|
end
|
169
214
|
|
170
215
|
if @global_config.key?(key)
|
171
|
-
locations << "Set for the current user (#{global_config_file}): #{@global_config[key].inspect}"
|
216
|
+
locations << "Set for the current user (#{global_config_file}): #{converted_value(@global_config[key], exposed_key).inspect}"
|
172
217
|
end
|
173
218
|
|
174
219
|
return ["You have not configured a value for `#{exposed_key}`"] if locations.empty?
|
175
220
|
locations
|
176
221
|
end
|
177
222
|
|
178
|
-
|
179
|
-
|
180
|
-
|
223
|
+
# for legacy reasons, in Bundler 1, the ruby scope isnt appended when the setting comes from ENV or the global config,
|
224
|
+
# nor do we respect :disable_shared_gems
|
225
|
+
def path
|
226
|
+
key = key_for(:path)
|
227
|
+
path = ENV[key] || @global_config[key]
|
228
|
+
if path && !@temporary.key?(key) && !@local_config.key?(key)
|
229
|
+
return Path.new(path, Bundler.feature_flag.global_path_appends_ruby_scope?, false, false)
|
230
|
+
end
|
181
231
|
|
182
|
-
|
183
|
-
|
232
|
+
system_path = self["path.system"] || (self[:disable_shared_gems] == false)
|
233
|
+
Path.new(self[:path], true, system_path, Bundler.feature_flag.default_install_uses_path?)
|
184
234
|
end
|
185
235
|
|
186
|
-
|
187
|
-
|
188
|
-
|
236
|
+
Path = Struct.new(:explicit_path, :append_ruby_scope, :system_path, :default_install_uses_path) do
|
237
|
+
def path
|
238
|
+
path = base_path
|
239
|
+
path = File.join(path, Bundler.ruby_scope) if append_ruby_scope && !use_system_gems?
|
240
|
+
path
|
241
|
+
end
|
189
242
|
|
190
|
-
|
191
|
-
|
192
|
-
|
243
|
+
def use_system_gems?
|
244
|
+
return true if system_path
|
245
|
+
return false if explicit_path
|
246
|
+
!default_install_uses_path
|
247
|
+
end
|
193
248
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
249
|
+
def base_path
|
250
|
+
path = explicit_path
|
251
|
+
path ||= ".bundle" unless use_system_gems?
|
252
|
+
path ||= Bundler.rubygems.gem_dir
|
253
|
+
path
|
254
|
+
end
|
199
255
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
256
|
+
def base_path_relative_to_pwd
|
257
|
+
base_path = Pathname.new(self.base_path)
|
258
|
+
expanded_base_path = base_path.expand_path(Bundler.root)
|
259
|
+
relative_path = expanded_base_path.relative_path_from(Pathname.pwd)
|
260
|
+
if relative_path.to_s.start_with?("..")
|
261
|
+
relative_path = base_path if base_path.absolute?
|
262
|
+
else
|
263
|
+
relative_path = Pathname.new(File.join(".", relative_path))
|
264
|
+
end
|
265
|
+
relative_path
|
266
|
+
rescue ArgumentError
|
267
|
+
expanded_base_path
|
268
|
+
end
|
269
|
+
|
270
|
+
def validate!
|
271
|
+
return unless explicit_path && system_path
|
272
|
+
path = Bundler.settings.pretty_values_for(:path)
|
273
|
+
path.unshift(nil, "path:") unless path.empty?
|
274
|
+
system_path = Bundler.settings.pretty_values_for("path.system")
|
275
|
+
system_path.unshift(nil, "path.system:") unless system_path.empty?
|
276
|
+
disable_shared_gems = Bundler.settings.pretty_values_for(:disable_shared_gems)
|
277
|
+
disable_shared_gems.unshift(nil, "disable_shared_gems:") unless disable_shared_gems.empty?
|
278
|
+
raise InvalidOption,
|
279
|
+
"Using a custom path while using system gems is unsupported.\n#{path.join("\n")}\n#{system_path.join("\n")}\n#{disable_shared_gems.join("\n")}"
|
204
280
|
end
|
205
281
|
end
|
206
282
|
|
207
283
|
def allow_sudo?
|
208
|
-
|
284
|
+
key = key_for(:path)
|
285
|
+
path_configured = @temporary.key?(key) || @local_config.key?(key)
|
286
|
+
!path_configured
|
209
287
|
end
|
210
288
|
|
211
289
|
def ignore_config?
|
@@ -213,14 +291,17 @@ module Bundler
|
|
213
291
|
end
|
214
292
|
|
215
293
|
def app_cache_path
|
216
|
-
@app_cache_path ||=
|
217
|
-
path = self[:cache_path] || "vendor/cache"
|
218
|
-
raise InvalidOption, "Cache path must be relative to the bundle path" if path.start_with?("/")
|
219
|
-
path
|
220
|
-
end
|
294
|
+
@app_cache_path ||= self[:cache_path] || "vendor/cache"
|
221
295
|
end
|
222
296
|
|
223
|
-
|
297
|
+
def validate!
|
298
|
+
all.each do |raw_key|
|
299
|
+
[@local_config, ENV, @global_config].each do |settings|
|
300
|
+
value = converted_value(settings[key_for(raw_key)], raw_key)
|
301
|
+
Validator.validate!(raw_key, value, settings.to_hash.dup)
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
224
305
|
|
225
306
|
def key_for(key)
|
226
307
|
key = Settings.normalize_uri(key).to_s if key.is_a?(String) && /https?:/ =~ key
|
@@ -228,15 +309,17 @@ module Bundler
|
|
228
309
|
"BUNDLE_#{key}"
|
229
310
|
end
|
230
311
|
|
312
|
+
private
|
313
|
+
|
231
314
|
def parent_setting_for(name)
|
232
|
-
|
315
|
+
split_specific_setting_for(name)[0]
|
233
316
|
end
|
234
317
|
|
235
|
-
def
|
236
|
-
|
318
|
+
def specific_gem_for(name)
|
319
|
+
split_specific_setting_for(name)[1]
|
237
320
|
end
|
238
321
|
|
239
|
-
def
|
322
|
+
def split_specific_setting_for(name)
|
240
323
|
name.split(".")
|
241
324
|
end
|
242
325
|
|
@@ -253,32 +336,58 @@ module Bundler
|
|
253
336
|
end
|
254
337
|
end
|
255
338
|
|
256
|
-
def is_num(
|
257
|
-
NUMBER_KEYS.include?(
|
339
|
+
def is_num(key)
|
340
|
+
NUMBER_KEYS.include?(key.to_s)
|
258
341
|
end
|
259
342
|
|
260
|
-
def
|
261
|
-
|
343
|
+
def is_array(key)
|
344
|
+
ARRAY_KEYS.include?(key.to_s)
|
262
345
|
end
|
263
346
|
|
264
|
-
def
|
265
|
-
|
347
|
+
def to_array(value)
|
348
|
+
return [] unless value
|
349
|
+
value.split(":").map(&:to_sym)
|
266
350
|
end
|
267
351
|
|
268
|
-
def
|
269
|
-
|
352
|
+
def array_to_s(array)
|
353
|
+
array = Array(array)
|
354
|
+
return nil if array.empty?
|
355
|
+
array.join(":").tr(" ", ":")
|
356
|
+
end
|
270
357
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
358
|
+
def set_key(raw_key, value, hash, file)
|
359
|
+
raw_key = raw_key.to_s
|
360
|
+
value = array_to_s(value) if is_array(raw_key)
|
361
|
+
|
362
|
+
key = key_for(raw_key)
|
363
|
+
|
364
|
+
return if hash[key] == value
|
365
|
+
|
366
|
+
hash[key] = value
|
367
|
+
hash.delete(key) if value.nil?
|
368
|
+
|
369
|
+
Validator.validate!(raw_key, converted_value(value, raw_key), hash)
|
370
|
+
|
371
|
+
return unless file
|
372
|
+
SharedHelpers.filesystem_access(file) do |p|
|
373
|
+
FileUtils.mkdir_p(p.dirname)
|
374
|
+
require "bundler/yaml_serializer"
|
375
|
+
p.open("w") {|f| f.write(YAMLSerializer.dump(hash)) }
|
279
376
|
end
|
377
|
+
end
|
280
378
|
|
281
|
-
|
379
|
+
def converted_value(value, key)
|
380
|
+
if is_array(key)
|
381
|
+
to_array(value)
|
382
|
+
elsif value.nil?
|
383
|
+
nil
|
384
|
+
elsif is_bool(key) || value == "false"
|
385
|
+
to_bool(value)
|
386
|
+
elsif is_num(key)
|
387
|
+
value.to_i
|
388
|
+
else
|
389
|
+
value.to_s
|
390
|
+
end
|
282
391
|
end
|
283
392
|
|
284
393
|
def global_config_file
|
@@ -286,7 +395,7 @@ module Bundler
|
|
286
395
|
Pathname.new(ENV["BUNDLE_CONFIG"])
|
287
396
|
else
|
288
397
|
begin
|
289
|
-
Bundler.user_bundle_path
|
398
|
+
Bundler.user_bundle_path("config")
|
290
399
|
rescue PermissionError, GenericSystemCallError
|
291
400
|
nil
|
292
401
|
end
|
@@ -321,16 +430,34 @@ module Bundler
|
|
321
430
|
end
|
322
431
|
end
|
323
432
|
|
433
|
+
PER_URI_OPTIONS = %w[
|
434
|
+
fallback_timeout
|
435
|
+
].freeze
|
436
|
+
|
437
|
+
NORMALIZE_URI_OPTIONS_PATTERN =
|
438
|
+
/
|
439
|
+
\A
|
440
|
+
(\w+\.)? # optional prefix key
|
441
|
+
(https?.*?) # URI
|
442
|
+
(\.#{Regexp.union(PER_URI_OPTIONS)})? # optional suffix key
|
443
|
+
\z
|
444
|
+
/ix
|
445
|
+
|
324
446
|
# TODO: duplicates Rubygems#normalize_uri
|
325
447
|
# TODO: is this the correct place to validate mirror URIs?
|
326
448
|
def self.normalize_uri(uri)
|
327
449
|
uri = uri.to_s
|
328
|
-
|
450
|
+
if uri =~ NORMALIZE_URI_OPTIONS_PATTERN
|
451
|
+
prefix = $1
|
452
|
+
uri = $2
|
453
|
+
suffix = $3
|
454
|
+
end
|
455
|
+
uri = "#{uri}/" unless uri.end_with?("/")
|
329
456
|
uri = URI(uri)
|
330
457
|
unless uri.absolute?
|
331
458
|
raise ArgumentError, format("Gem sources must be absolute. You provided '%s'.", uri)
|
332
459
|
end
|
333
|
-
uri
|
460
|
+
"#{prefix}#{uri}#{suffix}"
|
334
461
|
end
|
335
462
|
end
|
336
463
|
end
|
data/lib/bundler/setup.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
3
|
require "bundler/shared_helpers"
|
4
4
|
|
5
5
|
if Bundler::SharedHelpers.in_bundle?
|
@@ -20,12 +20,9 @@ if Bundler::SharedHelpers.in_bundle?
|
|
20
20
|
Bundler.setup
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
bundler_lib = File.expand_path("../..", __FILE__)
|
27
|
-
$LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
|
28
|
-
end
|
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)
|
29
26
|
|
30
27
|
Bundler.ui = nil
|
31
28
|
end
|