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
@@ -1,7 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/compatibility_guard"
|
4
|
+
|
2
5
|
require "pathname"
|
3
6
|
require "rubygems"
|
4
7
|
|
8
|
+
require "bundler/version"
|
5
9
|
require "bundler/constants"
|
6
10
|
require "bundler/rubygems_integration"
|
7
11
|
require "bundler/current_ruby"
|
@@ -19,10 +23,16 @@ end
|
|
19
23
|
|
20
24
|
module Bundler
|
21
25
|
module SharedHelpers
|
22
|
-
def
|
26
|
+
def root
|
23
27
|
gemfile = find_gemfile
|
24
28
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
25
|
-
Pathname.new(gemfile).untaint
|
29
|
+
Pathname.new(gemfile).untaint.expand_path.parent
|
30
|
+
end
|
31
|
+
|
32
|
+
def default_gemfile
|
33
|
+
gemfile = find_gemfile(:order_matters)
|
34
|
+
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
35
|
+
Pathname.new(gemfile).untaint.expand_path
|
26
36
|
end
|
27
37
|
|
28
38
|
def default_lockfile
|
@@ -63,7 +73,7 @@ module Bundler
|
|
63
73
|
end
|
64
74
|
|
65
75
|
def with_clean_git_env(&block)
|
66
|
-
keys = %w
|
76
|
+
keys = %w[GIT_DIR GIT_WORK_TREE]
|
67
77
|
old_env = keys.inject({}) do |h, k|
|
68
78
|
h.update(k => ENV[k])
|
69
79
|
end
|
@@ -129,20 +139,34 @@ module Bundler
|
|
129
139
|
namespace.const_get(constant_name)
|
130
140
|
end
|
131
141
|
|
132
|
-
def major_deprecation(message)
|
142
|
+
def major_deprecation(major_version, message)
|
143
|
+
if Bundler.bundler_major_version >= major_version
|
144
|
+
require "bundler/errors"
|
145
|
+
raise DeprecatedError, "[REMOVED FROM #{major_version}.0] #{message}"
|
146
|
+
end
|
147
|
+
|
133
148
|
return unless prints_major_deprecations?
|
134
149
|
@major_deprecation_ui ||= Bundler::UI::Shell.new("no-color" => true)
|
135
150
|
ui = Bundler.ui.is_a?(@major_deprecation_ui.class) ? Bundler.ui : @major_deprecation_ui
|
136
|
-
ui.warn("[DEPRECATED FOR #{
|
151
|
+
ui.warn("[DEPRECATED FOR #{major_version}.0] #{message}")
|
137
152
|
end
|
138
153
|
|
139
154
|
def print_major_deprecations!
|
140
|
-
|
155
|
+
multiple_gemfiles = search_up(".") do |dir|
|
156
|
+
gemfiles = gemfile_names.select {|gf| File.file? File.expand_path(gf, dir) }
|
157
|
+
next if gemfiles.empty?
|
158
|
+
break false if gemfiles.size == 1
|
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
|
+
|
141
165
|
if RUBY_VERSION < "2"
|
142
|
-
major_deprecation("Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
|
166
|
+
major_deprecation(2, "Bundler will only support ruby >= 2.0, you are running #{RUBY_VERSION}")
|
143
167
|
end
|
144
168
|
return if Bundler.rubygems.provides?(">= 2")
|
145
|
-
major_deprecation("Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
|
169
|
+
major_deprecation(2, "Bundler will only support rubygems >= 2.0, you are running #{Bundler.rubygems.version}")
|
146
170
|
end
|
147
171
|
|
148
172
|
def trap(signal, override = false, &block)
|
@@ -170,12 +194,65 @@ module Bundler
|
|
170
194
|
"\nEither installing with `--full-index` or running `bundle update #{spec.name}` should fix the problem."
|
171
195
|
end
|
172
196
|
|
197
|
+
def pretty_dependency(dep, print_source = false)
|
198
|
+
msg = String.new(dep.name)
|
199
|
+
msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default
|
200
|
+
|
201
|
+
if dep.is_a?(Bundler::Dependency)
|
202
|
+
platform_string = dep.platforms.join(", ")
|
203
|
+
msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
|
204
|
+
end
|
205
|
+
|
206
|
+
msg << " from the `#{dep.source}` source" if print_source && dep.source
|
207
|
+
msg
|
208
|
+
end
|
209
|
+
|
210
|
+
def md5_available?
|
211
|
+
return @md5_available if defined?(@md5_available)
|
212
|
+
@md5_available = begin
|
213
|
+
require "openssl"
|
214
|
+
OpenSSL::Digest::MD5.digest("")
|
215
|
+
true
|
216
|
+
rescue LoadError
|
217
|
+
true
|
218
|
+
rescue OpenSSL::Digest::DigestError
|
219
|
+
false
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def digest(name)
|
224
|
+
require "digest"
|
225
|
+
Digest(name)
|
226
|
+
end
|
227
|
+
|
228
|
+
def write_to_gemfile(gemfile_path, contents)
|
229
|
+
filesystem_access(gemfile_path) {|g| File.open(g, "w") {|file| file.puts contents } }
|
230
|
+
end
|
231
|
+
|
173
232
|
private
|
174
233
|
|
175
|
-
def
|
234
|
+
def validate_bundle_path
|
235
|
+
path_separator = Bundler.rubygems.path_separator
|
236
|
+
return unless Bundler.bundle_path.to_s.split(path_separator).size > 1
|
237
|
+
message = "Your bundle path contains text matching #{path_separator.inspect}, " \
|
238
|
+
"which is the path separator for your system. Bundler cannot " \
|
239
|
+
"function correctly when the Bundle path contains the " \
|
240
|
+
"system's PATH separator. Please change your " \
|
241
|
+
"bundle path to not match #{path_separator.inspect}." \
|
242
|
+
"\nYour current bundle path is '#{Bundler.bundle_path}'."
|
243
|
+
raise Bundler::PathError, message
|
244
|
+
end
|
245
|
+
|
246
|
+
def find_gemfile(order_matters = false)
|
176
247
|
given = ENV["BUNDLE_GEMFILE"]
|
177
248
|
return given if given && !given.empty?
|
178
|
-
|
249
|
+
names = gemfile_names
|
250
|
+
names.reverse! if order_matters && Bundler.feature_flag.prefer_gems_rb?
|
251
|
+
find_file(*names)
|
252
|
+
end
|
253
|
+
|
254
|
+
def gemfile_names
|
255
|
+
["Gemfile", "gems.rb"]
|
179
256
|
end
|
180
257
|
|
181
258
|
def find_file(*names)
|
@@ -197,7 +274,15 @@ module Bundler
|
|
197
274
|
until !File.directory?(current) || current == previous
|
198
275
|
if ENV["BUNDLE_SPEC_RUN"]
|
199
276
|
# avoid stepping above the tmp directory when testing
|
200
|
-
|
277
|
+
gemspec = if ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]
|
278
|
+
# for Ruby Core
|
279
|
+
"lib/bundler.gemspec"
|
280
|
+
else
|
281
|
+
"bundler.gemspec"
|
282
|
+
end
|
283
|
+
|
284
|
+
# avoid stepping above the tmp directory when testing
|
285
|
+
return nil if File.file?(File.join(current, gemspec))
|
201
286
|
end
|
202
287
|
|
203
288
|
names.each do |name|
|
@@ -209,39 +294,58 @@ module Bundler
|
|
209
294
|
end
|
210
295
|
end
|
211
296
|
|
297
|
+
def set_env(key, value)
|
298
|
+
raise ArgumentError, "new key #{key}" unless EnvironmentPreserver::BUNDLER_KEYS.include?(key)
|
299
|
+
orig_key = "#{EnvironmentPreserver::BUNDLER_PREFIX}#{key}"
|
300
|
+
orig = ENV[key]
|
301
|
+
orig ||= EnvironmentPreserver::INTENTIONALLY_NIL
|
302
|
+
ENV[orig_key] ||= orig
|
303
|
+
|
304
|
+
ENV[key] = value
|
305
|
+
end
|
306
|
+
public :set_env
|
307
|
+
|
212
308
|
def set_bundle_variables
|
213
309
|
begin
|
214
|
-
|
310
|
+
exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
|
311
|
+
unless File.exist?(exe_file)
|
312
|
+
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
|
313
|
+
end
|
314
|
+
Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
|
215
315
|
rescue Gem::GemNotFoundException
|
216
|
-
|
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
|
217
320
|
end
|
218
321
|
|
219
322
|
# Set BUNDLE_GEMFILE
|
220
|
-
|
221
|
-
|
323
|
+
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile(:order_matters).to_s
|
324
|
+
Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
|
222
325
|
end
|
223
326
|
|
224
327
|
def set_path
|
328
|
+
validate_bundle_path
|
225
329
|
paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
|
226
330
|
paths.unshift "#{Bundler.bundle_path}/bin"
|
227
|
-
|
331
|
+
Bundler::SharedHelpers.set_env "PATH", paths.uniq.join(File::PATH_SEPARATOR)
|
228
332
|
end
|
229
333
|
|
230
334
|
def set_rubyopt
|
231
335
|
rubyopt = [ENV["RUBYOPT"]].compact
|
232
336
|
return if !rubyopt.empty? && rubyopt.first =~ %r{-rbundler/setup}
|
233
337
|
rubyopt.unshift %(-rbundler/setup)
|
234
|
-
|
338
|
+
Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
|
235
339
|
end
|
236
340
|
|
237
341
|
def set_rubylib
|
238
342
|
rubylib = (ENV["RUBYLIB"] || "").split(File::PATH_SEPARATOR)
|
239
343
|
rubylib.unshift bundler_ruby_lib
|
240
|
-
|
344
|
+
Bundler::SharedHelpers.set_env "RUBYLIB", rubylib.uniq.join(File::PATH_SEPARATOR)
|
241
345
|
end
|
242
346
|
|
243
347
|
def bundler_ruby_lib
|
244
|
-
File.expand_path("../..", __FILE__)
|
348
|
+
resolve_path File.expand_path("../..", __FILE__)
|
245
349
|
end
|
246
350
|
|
247
351
|
def clean_load_path
|
@@ -253,12 +357,19 @@ module Bundler
|
|
253
357
|
loaded_gem_paths = Bundler.rubygems.loaded_gem_paths
|
254
358
|
|
255
359
|
$LOAD_PATH.reject! do |p|
|
256
|
-
next if
|
360
|
+
next if resolve_path(p).start_with?(bundler_lib)
|
257
361
|
loaded_gem_paths.delete(p)
|
258
362
|
end
|
259
363
|
$LOAD_PATH.uniq!
|
260
364
|
end
|
261
365
|
|
366
|
+
def resolve_path(path)
|
367
|
+
expanded = File.expand_path(path)
|
368
|
+
return expanded unless File.respond_to?(:realpath) && File.exist?(expanded)
|
369
|
+
|
370
|
+
File.realpath(expanded)
|
371
|
+
end
|
372
|
+
|
262
373
|
def prints_major_deprecations?
|
263
374
|
require "bundler"
|
264
375
|
deprecation_release = Bundler::VERSION.split(".").drop(1).include?("99")
|
@@ -268,12 +379,6 @@ module Bundler
|
|
268
379
|
true
|
269
380
|
end
|
270
381
|
|
271
|
-
def deprecate_gemfile(gemfile)
|
272
|
-
return unless gemfile && File.basename(gemfile) == "Gemfile"
|
273
|
-
Bundler::SharedHelpers.major_deprecation \
|
274
|
-
"gems.rb and gems.locked will be preferred to Gemfile and Gemfile.lock."
|
275
|
-
end
|
276
|
-
|
277
382
|
extend self
|
278
383
|
end
|
279
384
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "shellwords"
|
3
4
|
require "tempfile"
|
4
5
|
module Bundler
|
@@ -62,7 +63,7 @@ module Bundler
|
|
62
63
|
begin
|
63
64
|
@revision ||= find_local_revision
|
64
65
|
rescue GitCommandError
|
65
|
-
raise MissingGitRevisionError.new(ref, uri)
|
66
|
+
raise MissingGitRevisionError.new(ref, URICredentialsFilter.credential_filtered_uri(uri))
|
66
67
|
end
|
67
68
|
|
68
69
|
@revision
|
@@ -90,18 +91,21 @@ module Bundler
|
|
90
91
|
end
|
91
92
|
|
92
93
|
def checkout
|
93
|
-
if path.exist?
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
else
|
100
|
-
Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
|
94
|
+
return if path.exist? && has_revision_cached?
|
95
|
+
extra_ref = "#{Shellwords.shellescape(ref)}:#{Shellwords.shellescape(ref)}" if ref && ref.start_with?("refs/")
|
96
|
+
|
97
|
+
Bundler.ui.info "Fetching #{URICredentialsFilter.credential_filtered_uri(uri)}"
|
98
|
+
|
99
|
+
unless path.exist?
|
101
100
|
SharedHelpers.filesystem_access(path.dirname) do |p|
|
102
101
|
FileUtils.mkdir_p(p)
|
103
102
|
end
|
104
103
|
git_retry %(clone #{uri_escaped_with_configured_credentials} "#{path}" --bare --no-hardlinks --quiet)
|
104
|
+
return unless extra_ref
|
105
|
+
end
|
106
|
+
|
107
|
+
in_path do
|
108
|
+
git_retry %(fetch --force --quiet --tags #{uri_escaped_with_configured_credentials} "refs/heads/*:refs/heads/*" #{extra_ref})
|
105
109
|
end
|
106
110
|
end
|
107
111
|
|
@@ -127,7 +131,12 @@ module Bundler
|
|
127
131
|
# method 2
|
128
132
|
SharedHelpers.chdir(destination) do
|
129
133
|
git_retry %(fetch --force --quiet --tags "#{path}")
|
130
|
-
|
134
|
+
|
135
|
+
begin
|
136
|
+
git "reset --hard #{@revision}"
|
137
|
+
rescue GitCommandError
|
138
|
+
raise MissingGitRevisionError.new(@revision, URICredentialsFilter.credential_filtered_uri(uri))
|
139
|
+
end
|
131
140
|
|
132
141
|
if submodules
|
133
142
|
git_retry "submodule update --init --recursive"
|
@@ -149,7 +158,7 @@ module Bundler
|
|
149
158
|
end
|
150
159
|
|
151
160
|
def git_retry(command)
|
152
|
-
Bundler::Retry.new("`git #{command}`", GitNotAllowedError).attempts do
|
161
|
+
Bundler::Retry.new("`git #{URICredentialsFilter.credential_filtered_string(command, uri)}`", GitNotAllowedError).attempts do
|
153
162
|
git(command)
|
154
163
|
end
|
155
164
|
end
|
@@ -217,6 +226,7 @@ module Bundler
|
|
217
226
|
|
218
227
|
def in_path(&blk)
|
219
228
|
checkout unless path.exist?
|
229
|
+
_ = URICredentialsFilter # load it before we chdir
|
220
230
|
SharedHelpers.chdir(path, &blk)
|
221
231
|
end
|
222
232
|
|
data/lib/bundler/source/git.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
require "bundler/vendored_fileutils"
|
3
4
|
require "uri"
|
4
|
-
require "digest/sha1"
|
5
5
|
|
6
6
|
module Bundler
|
7
7
|
class Source
|
@@ -18,9 +18,10 @@ module Bundler
|
|
18
18
|
@allow_remote = false
|
19
19
|
|
20
20
|
# Stringify options that could be set as symbols
|
21
|
-
%w
|
21
|
+
%w[ref branch tag revision].each {|k| options[k] = options[k].to_s if options[k] }
|
22
22
|
|
23
23
|
@uri = options["uri"] || ""
|
24
|
+
@safe_uri = URICredentialsFilter.credential_filtered_uri(@uri)
|
24
25
|
@branch = options["branch"]
|
25
26
|
@ref = options["ref"] || options["branch"] || options["tag"] || "master"
|
26
27
|
@submodules = options["submodules"]
|
@@ -39,7 +40,7 @@ module Bundler
|
|
39
40
|
out = String.new("GIT\n")
|
40
41
|
out << " remote: #{@uri}\n"
|
41
42
|
out << " revision: #{revision}\n"
|
42
|
-
%w
|
43
|
+
%w[ref branch tag submodules].each do |opt|
|
43
44
|
out << " #{opt}: #{options[opt]}\n" if options[opt]
|
44
45
|
end
|
45
46
|
out << " glob: #{@glob}\n" unless @glob == DEFAULT_GLOB
|
@@ -77,7 +78,7 @@ module Bundler
|
|
77
78
|
nil
|
78
79
|
end
|
79
80
|
|
80
|
-
"#{
|
81
|
+
"#{@safe_uri} (at #{at}#{rev})"
|
81
82
|
end
|
82
83
|
|
83
84
|
def name
|
@@ -169,15 +170,13 @@ module Bundler
|
|
169
170
|
def install(spec, options = {})
|
170
171
|
force = options[:force]
|
171
172
|
|
172
|
-
|
173
|
+
print_using_message "Using #{version_message(spec)} from #{self}"
|
173
174
|
|
174
|
-
if requires_checkout? && !@copied
|
175
|
+
if (requires_checkout? && !@copied) || force
|
175
176
|
Bundler.ui.debug " * Checking out revision: #{ref}"
|
176
177
|
git_proxy.copy_to(install_path, submodules)
|
177
178
|
serialize_gemspecs_in(install_path)
|
178
179
|
@copied = true
|
179
|
-
elsif force
|
180
|
-
git_proxy.copy_to(install_path, submodules)
|
181
180
|
end
|
182
181
|
|
183
182
|
generate_bin_options = { :disable_extensions => !Bundler.rubygems.spec_missing_extensions?(spec), :build_args => options[:build_args] }
|
@@ -188,7 +187,7 @@ module Bundler
|
|
188
187
|
|
189
188
|
def cache(spec, custom_path = nil)
|
190
189
|
app_cache_path = app_cache_path(custom_path)
|
191
|
-
return unless Bundler.
|
190
|
+
return unless Bundler.feature_flag.cache_all?
|
192
191
|
return if path == app_cache_path
|
193
192
|
cached!
|
194
193
|
FileUtils.rm_rf(app_cache_path)
|
@@ -210,13 +209,11 @@ module Bundler
|
|
210
209
|
# When using local git repos, this is set to the local repo.
|
211
210
|
def cache_path
|
212
211
|
@cache_path ||= begin
|
213
|
-
|
214
|
-
|
215
|
-
if Bundler.requires_sudo?
|
216
|
-
Bundler.user_bundle_path.join("cache/git", git_scope)
|
212
|
+
if Bundler.requires_sudo? || Bundler.feature_flag.global_gem_cache?
|
213
|
+
Bundler.user_cache
|
217
214
|
else
|
218
|
-
Bundler.
|
219
|
-
end
|
215
|
+
Bundler.bundle_path.join("cache", "bundler")
|
216
|
+
end.join("git", git_scope)
|
220
217
|
end
|
221
218
|
end
|
222
219
|
|
@@ -287,7 +284,7 @@ module Bundler
|
|
287
284
|
# If there is no URI scheme, assume it is an ssh/git URI
|
288
285
|
input = uri
|
289
286
|
end
|
290
|
-
|
287
|
+
SharedHelpers.digest(:SHA1).hexdigest(input)
|
291
288
|
end
|
292
289
|
|
293
290
|
def cached_revision
|
@@ -304,9 +301,9 @@ module Bundler
|
|
304
301
|
|
305
302
|
def fetch
|
306
303
|
git_proxy.checkout
|
307
|
-
rescue GitError
|
304
|
+
rescue GitError => e
|
308
305
|
raise unless Bundler.feature_flag.allow_offline_install?
|
309
|
-
Bundler.ui.warn "Using cached git data because of network errors"
|
306
|
+
Bundler.ui.warn "Using cached git data because of network errors:\n#{e}"
|
310
307
|
end
|
311
308
|
|
312
309
|
# no-op, since we validate when re-serializing the gemspec
|
@@ -319,6 +316,14 @@ module Bundler
|
|
319
316
|
StubSpecification.from_stub(stub)
|
320
317
|
end
|
321
318
|
end
|
319
|
+
|
320
|
+
def git_scope
|
321
|
+
"#{base_name}-#{uri_hash}"
|
322
|
+
end
|
323
|
+
|
324
|
+
def extension_cache_slug(_)
|
325
|
+
extension_dir_name
|
326
|
+
end
|
322
327
|
end
|
323
328
|
end
|
324
329
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Bundler
|
4
|
+
class Source
|
5
|
+
class Metadata < Source
|
6
|
+
def specs
|
7
|
+
@specs ||= Index.build do |idx|
|
8
|
+
idx << Gem::Specification.new("ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
|
9
|
+
idx << Gem::Specification.new("rubygems\0", Gem::VERSION)
|
10
|
+
|
11
|
+
idx << Gem::Specification.new do |s|
|
12
|
+
s.name = "bundler"
|
13
|
+
s.version = VERSION
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
s.source = self
|
16
|
+
s.authors = ["bundler team"]
|
17
|
+
s.bindir = "exe"
|
18
|
+
s.executables = %w[bundle]
|
19
|
+
# can't point to the actual gemspec or else the require paths will be wrong
|
20
|
+
s.loaded_from = File.expand_path("..", __FILE__)
|
21
|
+
end
|
22
|
+
|
23
|
+
if local_spec = Bundler.rubygems.find_name("bundler").find {|s| s.version.to_s == VERSION }
|
24
|
+
idx << local_spec
|
25
|
+
end
|
26
|
+
|
27
|
+
idx.each {|s| s.source = self }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def cached!; end
|
32
|
+
|
33
|
+
def remote!; end
|
34
|
+
|
35
|
+
def options
|
36
|
+
{}
|
37
|
+
end
|
38
|
+
|
39
|
+
def install(spec, _opts = {})
|
40
|
+
print_using_message "Using #{version_message(spec)}"
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
|
44
|
+
def to_s
|
45
|
+
"the local ruby installation"
|
46
|
+
end
|
47
|
+
|
48
|
+
def ==(other)
|
49
|
+
self.class == other.class
|
50
|
+
end
|
51
|
+
alias_method :eql?, :==
|
52
|
+
|
53
|
+
def hash
|
54
|
+
self.class.hash
|
55
|
+
end
|
56
|
+
|
57
|
+
def version_message(spec)
|
58
|
+
"#{spec.name} #{spec.version}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class Source
|
4
5
|
class Path
|
@@ -6,6 +7,7 @@ module Bundler
|
|
6
7
|
attr_reader :spec
|
7
8
|
|
8
9
|
def initialize(spec, options = {})
|
10
|
+
@options = options
|
9
11
|
@spec = spec
|
10
12
|
@gem_dir = Bundler.rubygems.path(spec.full_gem_path)
|
11
13
|
@wrappers = true
|
data/lib/bundler/source/path.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class Source
|
4
5
|
class Path < Source
|
@@ -35,10 +36,12 @@ module Bundler
|
|
35
36
|
end
|
36
37
|
|
37
38
|
def remote!
|
39
|
+
@local_specs = nil
|
38
40
|
@allow_remote = true
|
39
41
|
end
|
40
42
|
|
41
43
|
def cached!
|
44
|
+
@local_specs = nil
|
42
45
|
@allow_cached = true
|
43
46
|
end
|
44
47
|
|
@@ -63,7 +66,7 @@ module Bundler
|
|
63
66
|
|
64
67
|
def eql?(other)
|
65
68
|
return unless other.class == self.class
|
66
|
-
|
69
|
+
expanded_original_path == other.expanded_original_path &&
|
67
70
|
version == other.version
|
68
71
|
end
|
69
72
|
|
@@ -74,14 +77,14 @@ module Bundler
|
|
74
77
|
end
|
75
78
|
|
76
79
|
def install(spec, options = {})
|
77
|
-
|
80
|
+
print_using_message "Using #{version_message(spec)} from #{self}"
|
78
81
|
generate_bin(spec, :disable_extensions => true)
|
79
82
|
nil # no post-install message
|
80
83
|
end
|
81
84
|
|
82
85
|
def cache(spec, custom_path = nil)
|
83
86
|
app_cache_path = app_cache_path(custom_path)
|
84
|
-
return unless Bundler.
|
87
|
+
return unless Bundler.feature_flag.cache_all?
|
85
88
|
return if expand(@original_path).to_s.index(root_path.to_s + "/") == 0
|
86
89
|
|
87
90
|
unless @original_path.exist?
|
@@ -113,8 +116,8 @@ module Bundler
|
|
113
116
|
Bundler.root
|
114
117
|
end
|
115
118
|
|
116
|
-
def
|
117
|
-
|
119
|
+
def expanded_original_path
|
120
|
+
@expanded_original_path ||= expand(original_path)
|
118
121
|
end
|
119
122
|
|
120
123
|
private
|
@@ -224,7 +227,8 @@ module Bundler
|
|
224
227
|
spec,
|
225
228
|
:env_shebang => false,
|
226
229
|
:disable_extensions => options[:disable_extensions],
|
227
|
-
:build_args => options[:build_args]
|
230
|
+
:build_args => options[:build_args],
|
231
|
+
:bundler_extension_cache_path => extension_cache_path(spec)
|
228
232
|
)
|
229
233
|
installer.post_install
|
230
234
|
rescue Gem::InvalidSpecificationException => e
|
@@ -238,7 +242,7 @@ module Bundler
|
|
238
242
|
"to modify their .gemspec so it can work with `gem build`."
|
239
243
|
end
|
240
244
|
|
241
|
-
Bundler.ui.warn "The validation message from
|
245
|
+
Bundler.ui.warn "The validation message from RubyGems was:\n #{e.message}"
|
242
246
|
end
|
243
247
|
end
|
244
248
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Bundler
|
3
4
|
class Source
|
4
5
|
class Rubygems
|
@@ -20,10 +21,15 @@ module Bundler
|
|
20
21
|
#
|
21
22
|
def cache_slug
|
22
23
|
@cache_slug ||= begin
|
24
|
+
return nil unless SharedHelpers.md5_available?
|
25
|
+
|
23
26
|
cache_uri = original_uri || uri
|
24
27
|
|
25
|
-
|
26
|
-
|
28
|
+
# URI::File of Ruby 2.6 returns empty string when given "file://".
|
29
|
+
host = defined?(URI::File) && cache_uri.is_a?(URI::File) ? nil : cache_uri.host
|
30
|
+
|
31
|
+
uri_parts = [host, cache_uri.user, cache_uri.port, cache_uri.path]
|
32
|
+
uri_digest = SharedHelpers.digest(:MD5).hexdigest(uri_parts.compact.join("."))
|
27
33
|
|
28
34
|
uri_parts[-1] = uri_digest
|
29
35
|
uri_parts.compact.join(".")
|