bundler 2.0.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 +735 -574
- data/LICENSE.md +18 -19
- data/README.md +8 -7
- data/bundler.gemspec +5 -23
- data/exe/bundle +19 -3
- data/lib/bundler.rb +202 -87
- data/lib/bundler/build_metadata.rb +3 -3
- data/lib/bundler/capistrano.rb +5 -5
- data/lib/bundler/cli.rb +179 -143
- data/lib/bundler/cli/add.rb +28 -16
- data/lib/bundler/cli/cache.rb +25 -13
- data/lib/bundler/cli/common.rb +10 -11
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +2 -2
- data/lib/bundler/cli/doctor.rb +4 -4
- data/lib/bundler/cli/exec.rb +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 +3 -3
- data/lib/bundler/cli/issue.rb +1 -1
- data/lib/bundler/cli/open.rb +10 -6
- data/lib/bundler/cli/outdated.rb +85 -81
- data/lib/bundler/cli/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 +8 -7
- data/lib/bundler/definition.rb +33 -26
- data/lib/bundler/dependency.rb +16 -4
- data/lib/bundler/deployment.rb +2 -2
- data/lib/bundler/dsl.rb +19 -43
- data/lib/bundler/env.rb +6 -5
- data/lib/bundler/environment_preserver.rb +0 -1
- data/lib/bundler/feature_flag.rb +1 -13
- 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 +4 -1
- data/lib/bundler/fetcher/index.rb +5 -3
- data/lib/bundler/friendly_errors.rb +6 -7
- data/lib/bundler/gem_helper.rb +14 -14
- data/lib/bundler/gem_helpers.rb +2 -4
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +3 -3
- data/lib/bundler/graph.rb +2 -2
- data/lib/bundler/injector.rb +3 -1
- data/lib/bundler/inline.rb +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 -4
- 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 +29 -18
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/api/source.rb +4 -6
- data/lib/bundler/plugin/index.rb +10 -2
- data/lib/bundler/plugin/installer.rb +28 -15
- data/lib/bundler/psyched_yaml.rb +1 -1
- data/lib/bundler/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 -66
- data/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +133 -410
- data/lib/bundler/runtime.rb +2 -9
- data/lib/bundler/settings.rb +22 -52
- data/lib/bundler/setup.rb +7 -13
- data/lib/bundler/shared_helpers.rb +46 -74
- 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 +7 -2
- 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 +1 -6
- data/lib/bundler/stub_specification.rb +18 -30
- data/lib/bundler/templates/Executable.bundler +22 -13
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +3 -3
- data/lib/bundler/templates/newgem/Gemfile.tt +8 -0
- data/lib/bundler/templates/newgem/README.md.tt +4 -3
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +2 -18
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +0 -4
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +4 -8
- data/lib/bundler/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 +134 -111
- 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 +17 -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 +5 -5
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/lib/bundler/vendor/thor/lib/thor/base.rb +51 -39
- data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/lib/bundler/vendor/thor/lib/thor/error.rb +14 -18
- data/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
- 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 +13 -3
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +13 -12
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +10 -1
- 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 +3 -3
- data/lib/bundler/worker.rb +1 -3
- data/lib/bundler/yaml_serializer.rb +2 -3
- data/man/bundle-add.1 +10 -2
- data/man/bundle-add.1.txt +11 -5
- data/man/bundle-add.ronn +7 -1
- data/man/bundle-binstubs.1 +2 -2
- data/man/bundle-binstubs.1.txt +2 -2
- data/man/bundle-binstubs.ronn +1 -1
- data/man/bundle-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 +35 -35
- data/man/bundle-config.1.txt +65 -66
- data/man/bundle-config.ronn +41 -39
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-doctor.1.txt +1 -1
- data/man/bundle-exec.1 +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 +1 -1
- data/man/bundle-init.1.txt +1 -1
- data/man/bundle-inject.1 +1 -1
- data/man/bundle-inject.1.txt +1 -1
- data/man/bundle-install.1 +8 -5
- data/man/bundle-install.1.txt +56 -51
- data/man/bundle-install.ronn +9 -4
- data/man/bundle-list.1 +1 -1
- data/man/bundle-list.1.txt +1 -1
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +16 -16
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +1 -1
- data/man/bundle-outdated.1 +1 -1
- data/man/bundle-outdated.1.txt +1 -1
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +1 -1
- data/man/bundle-pristine.1 +1 -1
- data/man/bundle-pristine.1.txt +1 -1
- data/man/bundle-remove.1 +1 -1
- data/man/bundle-remove.1.txt +1 -1
- data/man/bundle-show.1 +1 -1
- data/man/bundle-show.1.txt +1 -1
- data/man/bundle-update.1 +4 -4
- data/man/bundle-update.1.txt +64 -65
- data/man/bundle-update.ronn +3 -3
- data/man/bundle-viz.1 +1 -1
- data/man/bundle-viz.1.txt +1 -1
- data/man/bundle.1 +2 -2
- data/man/bundle.1.txt +7 -7
- data/man/bundle.ronn +1 -1
- data/man/gemfile.5 +12 -15
- data/man/gemfile.5.ronn +9 -13
- data/man/gemfile.5.txt +103 -107
- data/man/index.txt +1 -1
- metadata +30 -120
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -49
- data/lib/bundler/compatibility_guard.rb +0 -13
- 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/fileutils/lib/fileutils/version.rb +0 -5
- 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
@@ -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
|
data/lib/bundler/source.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
module Bundler
|
4
4
|
class Source
|
5
|
-
autoload :Gemspec, "
|
6
|
-
autoload :Git, "
|
7
|
-
autoload :Metadata, "
|
8
|
-
autoload :Path, "
|
9
|
-
autoload :Rubygems, "
|
5
|
+
autoload :Gemspec, File.expand_path("source/gemspec", __dir__)
|
6
|
+
autoload :Git, File.expand_path("source/git", __dir__)
|
7
|
+
autoload :Metadata, File.expand_path("source/metadata", __dir__)
|
8
|
+
autoload :Path, File.expand_path("source/path", __dir__)
|
9
|
+
autoload :Rubygems, File.expand_path("source/rubygems", __dir__)
|
10
10
|
|
11
11
|
attr_accessor :dependency_names
|
12
12
|
|
data/lib/bundler/source/git.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require "uri"
|
3
|
+
require_relative "../vendored_fileutils"
|
5
4
|
|
6
5
|
module Bundler
|
7
6
|
class Source
|
8
7
|
class Git < Path
|
9
|
-
autoload :GitProxy, "
|
8
|
+
autoload :GitProxy, File.expand_path("git/git_proxy", __dir__)
|
10
9
|
|
11
|
-
attr_reader :uri, :ref, :branch, :options, :submodules
|
10
|
+
attr_reader :uri, :ref, :branch, :options, :glob, :submodules
|
12
11
|
|
13
12
|
def initialize(options)
|
14
13
|
@options = options
|
@@ -48,13 +47,14 @@ module Bundler
|
|
48
47
|
end
|
49
48
|
|
50
49
|
def hash
|
51
|
-
[self.class, uri, ref, branch, name, version, submodules].hash
|
50
|
+
[self.class, uri, ref, branch, name, version, glob, submodules].hash
|
52
51
|
end
|
53
52
|
|
54
53
|
def eql?(other)
|
55
54
|
other.is_a?(Git) && uri == other.uri && ref == other.ref &&
|
56
55
|
branch == other.branch && name == other.name &&
|
57
|
-
version == other.version &&
|
56
|
+
version == other.version && glob == other.glob &&
|
57
|
+
submodules == other.submodules
|
58
58
|
end
|
59
59
|
|
60
60
|
alias_method :==, :eql?
|
@@ -118,18 +118,19 @@ module Bundler
|
|
118
118
|
def local_override!(path)
|
119
119
|
return false if local?
|
120
120
|
|
121
|
+
original_path = path
|
121
122
|
path = Pathname.new(path)
|
122
123
|
path = path.expand_path(Bundler.root) unless path.relative?
|
123
124
|
|
124
125
|
unless options["branch"] || Bundler.settings[:disable_local_branch_check]
|
125
126
|
raise GitError, "Cannot use local override for #{name} at #{path} because " \
|
126
|
-
":branch is not specified in Gemfile. Specify a branch or
|
127
|
-
"`bundle config
|
127
|
+
":branch is not specified in Gemfile. Specify a branch or run " \
|
128
|
+
"`bundle config unset local.#{override_for(original_path)}` to remove the local override"
|
128
129
|
end
|
129
130
|
|
130
131
|
unless path.exist?
|
131
132
|
raise GitError, "Cannot use local override for #{name} because #{path} " \
|
132
|
-
"does not exist.
|
133
|
+
"does not exist. Run `bundle config unset local.#{override_for(original_path)}` to remove the local override"
|
133
134
|
end
|
134
135
|
|
135
136
|
set_local!(path)
|
@@ -260,7 +261,11 @@ module Bundler
|
|
260
261
|
end
|
261
262
|
|
262
263
|
def requires_checkout?
|
263
|
-
allow_git_ops? && !local?
|
264
|
+
allow_git_ops? && !local? && !cached_revision_checked_out?
|
265
|
+
end
|
266
|
+
|
267
|
+
def cached_revision_checked_out?
|
268
|
+
cached_revision && cached_revision == revision && install_path.exist?
|
264
269
|
end
|
265
270
|
|
266
271
|
def base_name
|
@@ -279,7 +284,7 @@ module Bundler
|
|
279
284
|
if uri =~ %r{^\w+://(\w+@)?}
|
280
285
|
# Downcase the domain component of the URI
|
281
286
|
# and strip off a trailing slash, if one is present
|
282
|
-
input = URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
|
287
|
+
input = Bundler::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
|
283
288
|
else
|
284
289
|
# If there is no URI scheme, assume it is an ssh/git URI
|
285
290
|
input = uri
|
@@ -309,12 +314,10 @@ module Bundler
|
|
309
314
|
# no-op, since we validate when re-serializing the gemspec
|
310
315
|
def validate_spec(_spec); end
|
311
316
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
StubSpecification.from_stub(stub)
|
317
|
-
end
|
317
|
+
def load_gemspec(file)
|
318
|
+
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
|
319
|
+
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
320
|
+
StubSpecification.from_stub(stub)
|
318
321
|
end
|
319
322
|
|
320
323
|
def git_scope
|
@@ -324,6 +327,10 @@ module Bundler
|
|
324
327
|
def extension_cache_slug(_)
|
325
328
|
extension_dir_name
|
326
329
|
end
|
330
|
+
|
331
|
+
def override_for(path)
|
332
|
+
Bundler.settings.local_overrides.key(path)
|
333
|
+
end
|
327
334
|
end
|
328
335
|
end
|
329
336
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "shellwords"
|
4
|
-
|
4
|
+
|
5
5
|
module Bundler
|
6
6
|
class Source
|
7
7
|
class Git
|
@@ -18,14 +18,18 @@ module Bundler
|
|
18
18
|
def initialize(command)
|
19
19
|
msg = String.new
|
20
20
|
msg << "Bundler is trying to run a `git #{command}` at runtime. You probably need to run `bundle install`. However, "
|
21
|
-
msg << "this error message could probably be more useful. Please submit a ticket at
|
21
|
+
msg << "this error message could probably be more useful. Please submit a ticket at https://github.com/bundler/bundler/issues "
|
22
22
|
msg << "with steps to reproduce as well as the following\n\nCALLER: #{caller.join("\n")}"
|
23
23
|
super msg
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
class GitCommandError < GitError
|
28
|
+
attr_reader :command
|
29
|
+
|
28
30
|
def initialize(command, path = nil, extra_info = nil)
|
31
|
+
@command = command
|
32
|
+
|
29
33
|
msg = String.new
|
30
34
|
msg << "Git error: command `git #{command}` in directory #{SharedHelpers.pwd} has failed."
|
31
35
|
msg << "\n#{extra_info}" if extra_info
|
@@ -34,10 +38,10 @@ module Bundler
|
|
34
38
|
end
|
35
39
|
end
|
36
40
|
|
37
|
-
class MissingGitRevisionError <
|
38
|
-
def initialize(ref, repo)
|
41
|
+
class MissingGitRevisionError < GitCommandError
|
42
|
+
def initialize(command, path, ref, repo)
|
39
43
|
msg = "Revision #{ref} does not exist in the repository #{repo}. Maybe you misspelled it?"
|
40
|
-
super msg
|
44
|
+
super command, path, msg
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
@@ -62,8 +66,8 @@ module Bundler
|
|
62
66
|
|
63
67
|
begin
|
64
68
|
@revision ||= find_local_revision
|
65
|
-
rescue GitCommandError
|
66
|
-
raise MissingGitRevisionError.new(ref, URICredentialsFilter.credential_filtered_uri(uri))
|
69
|
+
rescue GitCommandError => e
|
70
|
+
raise MissingGitRevisionError.new(e.command, path, ref, URICredentialsFilter.credential_filtered_uri(uri))
|
67
71
|
end
|
68
72
|
|
69
73
|
@revision
|
@@ -77,8 +81,8 @@ module Bundler
|
|
77
81
|
|
78
82
|
def contains?(commit)
|
79
83
|
allowed_in_path do
|
80
|
-
result = git_null("branch --contains #{commit}")
|
81
|
-
|
84
|
+
result, status = git_null("branch --contains #{commit}")
|
85
|
+
status.success? && result =~ /^\* (.*)$/
|
82
86
|
end
|
83
87
|
end
|
84
88
|
|
@@ -134,8 +138,8 @@ module Bundler
|
|
134
138
|
|
135
139
|
begin
|
136
140
|
git "reset --hard #{@revision}"
|
137
|
-
rescue GitCommandError
|
138
|
-
raise MissingGitRevisionError.new(@revision, URICredentialsFilter.credential_filtered_uri(uri))
|
141
|
+
rescue GitCommandError => e
|
142
|
+
raise MissingGitRevisionError.new(e.command, path, @revision, URICredentialsFilter.credential_filtered_uri(uri))
|
139
143
|
end
|
140
144
|
|
141
145
|
if submodules
|
@@ -148,13 +152,15 @@ module Bundler
|
|
148
152
|
|
149
153
|
private
|
150
154
|
|
151
|
-
# TODO: Do not rely on /dev/null.
|
152
|
-
# Given that open3 is not cross platform until Ruby 1.9.3,
|
153
|
-
# the best solution is to pipe to /dev/null if it exists.
|
154
|
-
# If it doesn't, everything will work fine, but the user
|
155
|
-
# will get the $stderr messages as well.
|
156
155
|
def git_null(command)
|
157
|
-
|
156
|
+
command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
|
157
|
+
raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
|
158
|
+
|
159
|
+
out, status = SharedHelpers.with_clean_git_env do
|
160
|
+
capture_and_ignore_stderr("git #{command}")
|
161
|
+
end
|
162
|
+
|
163
|
+
[URICredentialsFilter.credential_filtered_string(out, uri), status]
|
158
164
|
end
|
159
165
|
|
160
166
|
def git_retry(command)
|
@@ -167,12 +173,12 @@ module Bundler
|
|
167
173
|
command_with_no_credentials = URICredentialsFilter.credential_filtered_string(command, uri)
|
168
174
|
raise GitNotAllowedError.new(command_with_no_credentials) unless allow?
|
169
175
|
|
170
|
-
out = SharedHelpers.with_clean_git_env do
|
171
|
-
capture_and_filter_stderr(uri
|
176
|
+
out, status = SharedHelpers.with_clean_git_env do
|
177
|
+
capture_and_filter_stderr(uri, "git #{command}")
|
172
178
|
end
|
173
179
|
|
174
180
|
stdout_with_no_credentials = URICredentialsFilter.credential_filtered_string(out, uri)
|
175
|
-
raise GitCommandError.new(command_with_no_credentials, path, error_msg) if check_errors &&
|
181
|
+
raise GitCommandError.new(command_with_no_credentials, path, error_msg) if check_errors && !status.success?
|
176
182
|
stdout_with_no_credentials
|
177
183
|
end
|
178
184
|
|
@@ -211,7 +217,7 @@ module Bundler
|
|
211
217
|
# Adds credentials to the URI as Fetcher#configured_uri_for does
|
212
218
|
def configured_uri_for(uri)
|
213
219
|
if /https?:/ =~ uri
|
214
|
-
remote = URI(uri)
|
220
|
+
remote = Bundler::URI(uri)
|
215
221
|
config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
|
216
222
|
remote.userinfo ||= config_auth
|
217
223
|
remote.to_s
|
@@ -235,26 +241,17 @@ module Bundler
|
|
235
241
|
raise GitError, "The git source #{uri} is not yet checked out. Please run `bundle install` before trying to start your application"
|
236
242
|
end
|
237
243
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
return_value = yield
|
250
|
-
f.rewind
|
251
|
-
captured_err = f.read
|
252
|
-
end
|
253
|
-
ensure
|
254
|
-
STDERR.reopen backup_stderr
|
255
|
-
end
|
256
|
-
$stderr.puts URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
|
257
|
-
return_value
|
244
|
+
def capture_and_filter_stderr(uri, cmd)
|
245
|
+
require "open3"
|
246
|
+
return_value, captured_err, status = Open3.capture3(cmd)
|
247
|
+
Bundler.ui.warn URICredentialsFilter.credential_filtered_string(captured_err, uri) if uri && !captured_err.empty?
|
248
|
+
[return_value, status]
|
249
|
+
end
|
250
|
+
|
251
|
+
def capture_and_ignore_stderr(cmd)
|
252
|
+
require "open3"
|
253
|
+
return_value, _, status = Open3.capture3(cmd)
|
254
|
+
[return_value, status]
|
258
255
|
end
|
259
256
|
end
|
260
257
|
end
|
@@ -5,16 +5,21 @@ module Bundler
|
|
5
5
|
class Metadata < Source
|
6
6
|
def specs
|
7
7
|
@specs ||= Index.build do |idx|
|
8
|
-
idx << Gem::Specification.new("
|
9
|
-
idx << Gem::Specification.new("
|
8
|
+
idx << Gem::Specification.new("Ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
|
9
|
+
idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.default
|
11
|
+
end
|
10
12
|
|
11
13
|
idx << Gem::Specification.new do |s|
|
12
14
|
s.name = "bundler"
|
13
15
|
s.version = VERSION
|
16
|
+
s.license = "MIT"
|
14
17
|
s.platform = Gem::Platform::RUBY
|
15
18
|
s.source = self
|
16
19
|
s.authors = ["bundler team"]
|
17
20
|
s.bindir = "exe"
|
21
|
+
s.homepage = "https://bundler.io"
|
22
|
+
s.summary = "The best way to manage your application's dependencies"
|
18
23
|
s.executables = %w[bundle]
|
19
24
|
# can't point to the actual gemspec or else the require paths will be wrong
|
20
25
|
s.loaded_from = File.expand_path("..", __FILE__)
|
data/lib/bundler/source/path.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Bundler
|
4
4
|
class Source
|
5
5
|
class Path < Source
|
6
|
-
autoload :Installer, "
|
6
|
+
autoload :Installer, File.expand_path("path/installer", __dir__)
|
7
7
|
|
8
8
|
attr_reader :path, :options, :root_path, :original_path
|
9
9
|
attr_writer :name
|
@@ -20,11 +20,16 @@ module Bundler
|
|
20
20
|
@allow_cached = false
|
21
21
|
@allow_remote = false
|
22
22
|
|
23
|
-
@root_path = options["root_path"] ||
|
23
|
+
@root_path = options["root_path"] || root
|
24
24
|
|
25
25
|
if options["path"]
|
26
26
|
@path = Pathname.new(options["path"])
|
27
|
-
|
27
|
+
expanded_path = expand(@path)
|
28
|
+
@path = if @path.relative?
|
29
|
+
expanded_path.relative_path_from(root_path.expand_path)
|
30
|
+
else
|
31
|
+
expanded_path
|
32
|
+
end
|
28
33
|
end
|
29
34
|
|
30
35
|
@name = options["name"]
|
@@ -136,7 +141,7 @@ module Bundler
|
|
136
141
|
|
137
142
|
def lockfile_path
|
138
143
|
return relative_path(original_path) if original_path.absolute?
|
139
|
-
expand(original_path).relative_path_from(
|
144
|
+
expand(original_path).relative_path_from(root)
|
140
145
|
end
|
141
146
|
|
142
147
|
def app_cache_path(custom_path = nil)
|
@@ -191,10 +196,10 @@ module Bundler
|
|
191
196
|
else
|
192
197
|
message = String.new("The path `#{expanded_path}` ")
|
193
198
|
message << if File.exist?(expanded_path)
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
199
|
+
"is not a directory."
|
200
|
+
else
|
201
|
+
"does not exist."
|
202
|
+
end
|
198
203
|
raise PathError, message
|
199
204
|
end
|
200
205
|
|
@@ -1,12 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "uri"
|
4
3
|
require "rubygems/user_interaction"
|
5
4
|
|
6
5
|
module Bundler
|
7
6
|
class Source
|
8
7
|
class Rubygems < Source
|
9
|
-
autoload :Remote, "
|
8
|
+
autoload :Remote, File.expand_path("rubygems/remote", __dir__)
|
10
9
|
|
11
10
|
# Use the API when installing less than X gems
|
12
11
|
API_REQUEST_LIMIT = 500
|
@@ -51,7 +50,7 @@ module Bundler
|
|
51
50
|
end
|
52
51
|
|
53
52
|
def can_lock?(spec)
|
54
|
-
return super if Bundler.feature_flag.
|
53
|
+
return super if Bundler.feature_flag.disable_multisource?
|
55
54
|
spec.source.is_a?(Rubygems)
|
56
55
|
end
|
57
56
|
|
@@ -106,7 +105,7 @@ module Bundler
|
|
106
105
|
end
|
107
106
|
end
|
108
107
|
|
109
|
-
if installed?(spec) && !force
|
108
|
+
if (installed?(spec) || Plugin.installed?(spec.name)) && !force
|
110
109
|
print_using_message "Using #{version_message(spec)}"
|
111
110
|
return nil # no post-install message
|
112
111
|
end
|
@@ -120,8 +119,14 @@ module Bundler
|
|
120
119
|
uris.uniq!
|
121
120
|
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
|
122
121
|
|
123
|
-
|
124
|
-
|
122
|
+
path = fetch_gem(spec)
|
123
|
+
begin
|
124
|
+
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
|
125
|
+
spec.__swap__(s)
|
126
|
+
rescue StandardError
|
127
|
+
Bundler.rm_rf(path)
|
128
|
+
raise
|
129
|
+
end
|
125
130
|
end
|
126
131
|
|
127
132
|
unless Bundler.settings[:no_install]
|
@@ -322,9 +327,10 @@ module Bundler
|
|
322
327
|
def normalize_uri(uri)
|
323
328
|
uri = uri.to_s
|
324
329
|
uri = "#{uri}/" unless uri =~ %r{/$}
|
325
|
-
|
330
|
+
require_relative "../vendored_uri"
|
331
|
+
uri = Bundler::URI(uri)
|
326
332
|
raise ArgumentError, "The source must be an absolute URI. For example:\n" \
|
327
|
-
"source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(URI::HTTP) && uri.host.nil?)
|
333
|
+
"source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(Bundler::URI::HTTP) && uri.host.nil?)
|
328
334
|
uri
|
329
335
|
end
|
330
336
|
|
@@ -25,8 +25,7 @@ module Bundler
|
|
25
25
|
|
26
26
|
cache_uri = original_uri || uri
|
27
27
|
|
28
|
-
|
29
|
-
host = defined?(URI::File) && cache_uri.is_a?(URI::File) ? nil : cache_uri.host
|
28
|
+
host = cache_uri.to_s.start_with?("file://") ? nil : cache_uri.host
|
30
29
|
|
31
30
|
uri_parts = [host, cache_uri.user, cache_uri.port, cache_uri.path]
|
32
31
|
uri_digest = SharedHelpers.digest(:MD5).hexdigest(uri_parts.compact.join("."))
|
@@ -49,7 +48,7 @@ module Bundler
|
|
49
48
|
end
|
50
49
|
|
51
50
|
uri
|
52
|
-
rescue URI::InvalidComponentError
|
51
|
+
rescue Bundler::URI::InvalidComponentError
|
53
52
|
error_message = "Please CGI escape your usernames and passwords before " \
|
54
53
|
"setting them for authentication."
|
55
54
|
raise HTTPError.new(error_message)
|