bundler 2.0.0 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +778 -572
- data/LICENSE.md +18 -19
- data/README.md +9 -8
- data/bundler.gemspec +8 -25
- data/exe/bundle +19 -3
- data/lib/bundler.rb +202 -87
- data/lib/bundler/build_metadata.rb +3 -3
- data/lib/bundler/capistrano.rb +5 -5
- data/lib/bundler/cli.rb +182 -144
- data/lib/bundler/cli/add.rb +28 -16
- data/lib/bundler/cli/cache.rb +25 -13
- data/lib/bundler/cli/common.rb +11 -12
- data/lib/bundler/cli/config.rb +161 -86
- data/lib/bundler/cli/console.rb +2 -2
- data/lib/bundler/cli/doctor.rb +4 -4
- data/lib/bundler/cli/exec.rb +4 -16
- 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 +12 -11
- data/lib/bundler/cli/issue.rb +3 -3
- data/lib/bundler/cli/open.rb +10 -6
- data/lib/bundler/cli/outdated.rb +85 -81
- data/lib/bundler/cli/plugin.rb +9 -2
- data/lib/bundler/cli/pristine.rb +1 -1
- data/lib/bundler/cli/show.rb +1 -1
- data/lib/bundler/cli/update.rb +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 +36 -27
- 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 +8 -13
- data/lib/bundler/environment_preserver.rb +0 -1
- data/lib/bundler/feature_flag.rb +2 -14
- data/lib/bundler/fetcher.rb +16 -13
- data/lib/bundler/fetcher/compact_index.rb +26 -12
- data/lib/bundler/fetcher/dependency.rb +1 -1
- data/lib/bundler/fetcher/downloader.rb +5 -2
- data/lib/bundler/fetcher/index.rb +5 -3
- data/lib/bundler/friendly_errors.rb +6 -7
- data/lib/bundler/gem_helper.rb +40 -25
- data/lib/bundler/gem_helpers.rb +2 -4
- data/lib/bundler/gem_tasks.rb +1 -1
- data/lib/bundler/gem_version_promoter.rb +3 -3
- data/lib/bundler/graph.rb +2 -2
- data/lib/bundler/injector.rb +10 -8
- data/lib/bundler/inline.rb +40 -30
- data/lib/bundler/installer.rb +7 -14
- data/lib/bundler/installer/gem_installer.rb +5 -1
- data/lib/bundler/installer/parallel_installer.rb +4 -8
- data/lib/bundler/installer/standalone.rb +1 -2
- data/lib/bundler/lazy_specification.rb +2 -3
- data/lib/bundler/lockfile_parser.rb +14 -21
- data/lib/bundler/match_platform.rb +1 -1
- data/lib/bundler/mirror.rb +3 -3
- data/lib/bundler/plugin.rb +42 -29
- data/lib/bundler/plugin/api.rb +1 -1
- data/lib/bundler/plugin/api/source.rb +4 -6
- data/lib/bundler/plugin/index.rb +14 -3
- data/lib/bundler/plugin/installer.rb +28 -15
- data/lib/bundler/psyched_yaml.rb +1 -1
- data/lib/bundler/remote_specification.rb +0 -2
- data/lib/bundler/resolver.rb +72 -24
- data/lib/bundler/resolver/spec_group.rb +3 -2
- data/lib/bundler/retry.rb +2 -2
- data/lib/bundler/ruby_version.rb +4 -19
- data/lib/bundler/rubygems_ext.rb +11 -67
- data/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +148 -398
- data/lib/bundler/runtime.rb +2 -9
- data/lib/bundler/settings.rb +22 -52
- data/lib/bundler/setup.rb +11 -12
- data/lib/bundler/shared_helpers.rb +51 -77
- data/lib/bundler/similarity_detector.rb +2 -2
- data/lib/bundler/source.rb +5 -5
- data/lib/bundler/source/git.rb +24 -17
- data/lib/bundler/source/git/git_proxy.rb +38 -41
- data/lib/bundler/source/metadata.rb +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 +23 -14
- 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 +6 -27
- data/lib/bundler/templates/newgem/test/test_helper.rb.tt +1 -1
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -1
- data/lib/bundler/ui.rb +3 -3
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +4 -8
- data/lib/bundler/uri_credentials_filter.rb +7 -3
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +161 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +66 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +176 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +3 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +273 -147
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +6 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +30 -8
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +4 -4
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +2 -2
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +273 -304
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +40 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +53 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +79 -0
- data/lib/bundler/vendor/thor/lib/thor.rb +19 -4
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +27 -12
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/create_link.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +7 -17
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +16 -7
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +19 -8
- data/lib/bundler/vendor/thor/lib/thor/base.rb +54 -43
- data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/lib/bundler/vendor/thor/lib/thor/error.rb +78 -0
- data/lib/bundler/vendor/thor/lib/thor/group.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/parser.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +20 -7
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +20 -5
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +15 -14
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +4 -4
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +62 -8
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +6 -2
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +3 -3
- data/lib/bundler/vendor/thor/lib/thor/util.rb +18 -2
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri.rb +104 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +744 -0
- data/lib/bundler/vendor/uri/lib/uri/file.rb +94 -0
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +1568 -0
- data/lib/bundler/vendor/uri/lib/uri/http.rb +88 -0
- data/lib/bundler/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +21 -0
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +294 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +546 -0
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +125 -0
- data/lib/bundler/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/bundler/vendored_fileutils.rb +1 -6
- data/lib/bundler/vendored_molinillo.rb +1 -1
- data/lib/bundler/vendored_persistent.rb +7 -5
- data/lib/bundler/vendored_thor.rb +2 -2
- data/lib/bundler/vendored_uri.rb +4 -0
- data/lib/bundler/version.rb +1 -20
- data/lib/bundler/version_ranges.rb +51 -5
- data/lib/bundler/vlad.rb +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 +36 -36
- data/man/bundle-config.1.txt +66 -67
- data/man/bundle-config.ronn +42 -40
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-doctor.1.txt +1 -1
- data/man/bundle-exec.1 +2 -2
- data/man/bundle-exec.1.txt +2 -2
- data/man/bundle-exec.ronn +1 -1
- data/man/bundle-gem.1 +1 -1
- data/man/bundle-gem.1.txt +3 -3
- data/man/bundle-info.1 +1 -1
- data/man/bundle-info.1.txt +1 -1
- data/man/bundle-init.1 +2 -2
- data/man/bundle-init.1.txt +2 -2
- data/man/bundle-init.ronn +1 -1
- data/man/bundle-inject.1 +1 -1
- data/man/bundle-inject.1.txt +1 -1
- data/man/bundle-install.1 +8 -5
- data/man/bundle-install.1.txt +56 -51
- data/man/bundle-install.ronn +9 -4
- data/man/bundle-list.1 +1 -1
- data/man/bundle-list.1.txt +1 -1
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +16 -16
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +1 -1
- data/man/bundle-outdated.1 +1 -1
- data/man/bundle-outdated.1.txt +1 -1
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +1 -1
- data/man/bundle-pristine.1 +1 -1
- data/man/bundle-pristine.1.txt +1 -1
- data/man/bundle-remove.1 +1 -1
- data/man/bundle-remove.1.txt +1 -1
- data/man/bundle-show.1 +1 -1
- data/man/bundle-show.1.txt +1 -1
- data/man/bundle-update.1 +4 -4
- data/man/bundle-update.1.txt +64 -65
- data/man/bundle-update.ronn +3 -3
- data/man/bundle-viz.1 +1 -1
- data/man/bundle-viz.1.txt +1 -1
- data/man/bundle.1 +3 -3
- data/man/bundle.1.txt +8 -8
- data/man/bundle.ronn +2 -2
- data/man/gemfile.5 +13 -16
- data/man/gemfile.5.ronn +10 -14
- data/man/gemfile.5.txt +104 -108
- data/man/index.txt +1 -1
- metadata +33 -108
- data/exe/bundle_ruby +0 -60
- data/lib/bundler/cli/package.rb +0 -49
- data/lib/bundler/compatibility_guard.rb +0 -14
- data/lib/bundler/gem_remote_fetcher.rb +0 -43
- data/lib/bundler/ssl_certs/.document +0 -1
- data/lib/bundler/ssl_certs/certificate_manager.rb +0 -66
- data/lib/bundler/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem +0 -21
- data/lib/bundler/ssl_certs/rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem +0 -23
- data/lib/bundler/ssl_certs/rubygems.org/AddTrustExternalCARoot.pem +0 -25
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/faster.rb +0 -27
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/ssl_reuse.rb +0 -129
- data/lib/bundler/vendor/thor/lib/thor/core_ext/io_binary_read.rb +0 -12
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/man/bundle-package.1 +0 -55
- data/man/bundle-package.1.txt +0 -79
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "shellwords"
|
4
|
+
|
3
5
|
module Bundler
|
4
6
|
class GemInstaller
|
5
7
|
attr_reader :spec, :standalone, :worker, :force, :installer
|
@@ -56,7 +58,9 @@ module Bundler
|
|
56
58
|
|
57
59
|
def spec_settings
|
58
60
|
# Fetch the build settings, if there are any
|
59
|
-
Bundler.settings["build.#{spec.name}"]
|
61
|
+
if settings = Bundler.settings["build.#{spec.name}"]
|
62
|
+
Shellwords.shellsplit(settings)
|
63
|
+
end
|
60
64
|
end
|
61
65
|
|
62
66
|
def install
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
require_relative "../worker"
|
4
|
+
require_relative "gem_installer"
|
5
5
|
|
6
6
|
module Bundler
|
7
7
|
class ParallelInstaller
|
@@ -91,10 +91,6 @@ module Bundler
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def call
|
94
|
-
# Since `autoload` has the potential for threading issues on 1.8.7
|
95
|
-
# TODO: remove in bundler 2.0
|
96
|
-
require "bundler/gem_remote_fetcher" if RUBY_VERSION < "1.9"
|
97
|
-
|
98
94
|
check_for_corrupt_lockfile
|
99
95
|
|
100
96
|
if @size > 1
|
@@ -115,7 +111,7 @@ module Bundler
|
|
115
111
|
s,
|
116
112
|
s.missing_lockfile_dependencies(@specs.map(&:name)),
|
117
113
|
]
|
118
|
-
end.reject {
|
114
|
+
end.reject {|a| a.last.empty? }
|
119
115
|
return if missing_dependencies.empty?
|
120
116
|
|
121
117
|
warning = []
|
@@ -150,7 +146,7 @@ module Bundler
|
|
150
146
|
end
|
151
147
|
|
152
148
|
def worker_pool
|
153
|
-
@worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda {
|
149
|
+
@worker_pool ||= Bundler::Worker.new @size, "Parallel Installer", lambda {|spec_install, worker_num|
|
154
150
|
do_install(spec_install, worker_num)
|
155
151
|
}
|
156
152
|
end
|
@@ -12,8 +12,7 @@ module Bundler
|
|
12
12
|
end
|
13
13
|
File.open File.join(bundler_path, "setup.rb"), "w" do |file|
|
14
14
|
file.puts "require 'rbconfig'"
|
15
|
-
file.puts "
|
16
|
-
file.puts "ruby_engine = defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'ruby'"
|
15
|
+
file.puts "ruby_engine = RUBY_ENGINE"
|
17
16
|
file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
|
18
17
|
file.puts "path = File.expand_path('..', __FILE__)"
|
19
18
|
paths.each do |path|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require "bundler/match_platform"
|
3
|
+
require_relative "match_platform"
|
5
4
|
|
6
5
|
module Bundler
|
7
6
|
class LazySpecification
|
@@ -77,7 +76,7 @@ module Bundler
|
|
77
76
|
if search && Gem::Platform.new(search.platform) != Gem::Platform.new(platform) && !search.runtime_dependencies.-(dependencies.reject {|d| d.type == :development }).empty?
|
78
77
|
Bundler.ui.warn "Unable to use the platform-specific (#{search.platform}) version of #{name} (#{version}) " \
|
79
78
|
"because it has different dependencies from the #{platform} version. " \
|
80
|
-
"To use the platform-specific version of the gem, run `bundle config specific_platform true` and install again."
|
79
|
+
"To use the platform-specific version of the gem, run `bundle config set specific_platform true` and install again."
|
81
80
|
search = source.specs.search(self).last
|
82
81
|
end
|
83
82
|
search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
#--
|
3
4
|
# Some versions of the Bundler 1.1 RC series introduced corrupted
|
4
5
|
# lockfiles. There were two major problems:
|
5
6
|
#
|
@@ -23,16 +24,14 @@ module Bundler
|
|
23
24
|
PATH = "PATH".freeze
|
24
25
|
PLUGIN = "PLUGIN SOURCE".freeze
|
25
26
|
SPECS = " specs:".freeze
|
26
|
-
OPTIONS = /^ ([a-z]+): (.*)$/i
|
27
|
+
OPTIONS = /^ ([a-z]+): (.*)$/i.freeze
|
27
28
|
SOURCE = [GIT, GEM, PATH, PLUGIN].freeze
|
28
29
|
|
29
30
|
SECTIONS_BY_VERSION_INTRODUCED = {
|
30
|
-
|
31
|
-
|
32
|
-
Gem::Version.create("1.
|
33
|
-
Gem::Version.create("1.
|
34
|
-
Gem::Version.create("1.12".dup) => [RUBY].freeze,
|
35
|
-
Gem::Version.create("1.13".dup) => [PLUGIN].freeze,
|
31
|
+
Gem::Version.create("1.0") => [DEPENDENCIES, PLATFORMS, GIT, GEM, PATH].freeze,
|
32
|
+
Gem::Version.create("1.10") => [BUNDLED].freeze,
|
33
|
+
Gem::Version.create("1.12") => [RUBY].freeze,
|
34
|
+
Gem::Version.create("1.13") => [PLUGIN].freeze,
|
36
35
|
}.freeze
|
37
36
|
|
38
37
|
KNOWN_SECTIONS = SECTIONS_BY_VERSION_INTRODUCED.values.flatten.freeze
|
@@ -90,7 +89,7 @@ module Bundler
|
|
90
89
|
send("parse_#{@state}", line)
|
91
90
|
end
|
92
91
|
end
|
93
|
-
@sources << @rubygems_aggregate unless Bundler.feature_flag.
|
92
|
+
@sources << @rubygems_aggregate unless Bundler.feature_flag.disable_multisource?
|
94
93
|
@specs = @specs.values.sort_by(&:identifier)
|
95
94
|
warn_for_outdated_bundler_version
|
96
95
|
rescue ArgumentError => e
|
@@ -103,17 +102,11 @@ module Bundler
|
|
103
102
|
return unless bundler_version
|
104
103
|
prerelease_text = bundler_version.prerelease? ? " --pre" : ""
|
105
104
|
current_version = Gem::Version.create(Bundler::VERSION)
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \
|
112
|
-
"than the version that created the lockfile (#{bundler_version}). We suggest you " \
|
113
|
-
"upgrade to the latest version of Bundler by running `gem " \
|
114
|
-
"install bundler#{prerelease_text}`.\n"
|
115
|
-
end
|
116
|
-
end
|
105
|
+
return unless current_version < bundler_version
|
106
|
+
Bundler.ui.warn "Warning: the running version of Bundler (#{current_version}) is older " \
|
107
|
+
"than the version that created the lockfile (#{bundler_version}). We suggest you to " \
|
108
|
+
"upgrade to the version that created the lockfile by running `gem install " \
|
109
|
+
"bundler:#{bundler_version}#{prerelease_text}`.\n"
|
117
110
|
end
|
118
111
|
|
119
112
|
private
|
@@ -141,7 +134,7 @@ module Bundler
|
|
141
134
|
@sources << @current_source
|
142
135
|
end
|
143
136
|
when GEM
|
144
|
-
if Bundler.feature_flag.
|
137
|
+
if Bundler.feature_flag.disable_multisource?
|
145
138
|
@opts["remotes"] = @opts.delete("remote")
|
146
139
|
@current_source = TYPES[@type].from_lock(@opts)
|
147
140
|
@sources << @current_source
|
@@ -185,7 +178,7 @@ module Bundler
|
|
185
178
|
(?:-(.*))?\))? # Optional platform
|
186
179
|
(!)? # Optional pinned marker
|
187
180
|
$ # Line end
|
188
|
-
/xo
|
181
|
+
/xo.freeze
|
189
182
|
|
190
183
|
def parse_dependency(line)
|
191
184
|
return unless line =~ NAME_VERSION
|
data/lib/bundler/mirror.rb
CHANGED
@@ -47,7 +47,7 @@ module Bundler
|
|
47
47
|
|
48
48
|
def fetch_valid_mirror_for(uri)
|
49
49
|
downcased = uri.to_s.downcase
|
50
|
-
mirror = @mirrors[downcased] || @mirrors[URI(downcased).host] || Mirror.new(uri)
|
50
|
+
mirror = @mirrors[downcased] || @mirrors[Bundler::URI(downcased).host] || Mirror.new(uri)
|
51
51
|
mirror.validate!(@prober)
|
52
52
|
mirror = Mirror.new(uri) unless mirror.valid?
|
53
53
|
mirror
|
@@ -74,7 +74,7 @@ module Bundler
|
|
74
74
|
@uri = if uri.nil?
|
75
75
|
nil
|
76
76
|
else
|
77
|
-
URI(uri.to_s)
|
77
|
+
Bundler::URI(uri.to_s)
|
78
78
|
end
|
79
79
|
@valid = nil
|
80
80
|
end
|
@@ -126,7 +126,7 @@ module Bundler
|
|
126
126
|
if uri == "all"
|
127
127
|
@all = true
|
128
128
|
else
|
129
|
-
@uri = URI(uri).absolute? ? Settings.normalize_uri(uri) : uri
|
129
|
+
@uri = Bundler::URI(uri).absolute? ? Settings.normalize_uri(uri) : uri
|
130
130
|
end
|
131
131
|
@value = value
|
132
132
|
end
|
data/lib/bundler/plugin.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "plugin/api"
|
4
4
|
|
5
5
|
module Bundler
|
6
6
|
module Plugin
|
7
|
-
autoload :DSL, "
|
8
|
-
autoload :Events, "
|
9
|
-
autoload :Index, "
|
10
|
-
autoload :Installer, "
|
11
|
-
autoload :SourceList, "
|
7
|
+
autoload :DSL, File.expand_path("plugin/dsl", __dir__)
|
8
|
+
autoload :Events, File.expand_path("plugin/events", __dir__)
|
9
|
+
autoload :Index, File.expand_path("plugin/index", __dir__)
|
10
|
+
autoload :Installer, File.expand_path("plugin/installer", __dir__)
|
11
|
+
autoload :SourceList, File.expand_path("plugin/source_list", __dir__)
|
12
12
|
|
13
13
|
class MalformattedPlugin < PluginError; end
|
14
14
|
class UndefinedCommandError < PluginError; end
|
@@ -47,26 +47,48 @@ module Bundler
|
|
47
47
|
Bundler.ui.error "Failed to install plugin #{name}: #{e.message}\n #{e.backtrace.join("\n ")}"
|
48
48
|
end
|
49
49
|
|
50
|
+
# List installed plugins and commands
|
51
|
+
#
|
52
|
+
def list
|
53
|
+
installed_plugins = index.installed_plugins
|
54
|
+
if installed_plugins.any?
|
55
|
+
output = String.new
|
56
|
+
installed_plugins.each do |plugin|
|
57
|
+
output << "#{plugin}\n"
|
58
|
+
output << "-----\n"
|
59
|
+
index.plugin_commands(plugin).each do |command|
|
60
|
+
output << " #{command}\n"
|
61
|
+
end
|
62
|
+
output << "\n"
|
63
|
+
end
|
64
|
+
else
|
65
|
+
output = "No plugins installed"
|
66
|
+
end
|
67
|
+
Bundler.ui.info output
|
68
|
+
end
|
69
|
+
|
50
70
|
# Evaluates the Gemfile with a limited DSL and installs the plugins
|
51
71
|
# specified by plugin method
|
52
72
|
#
|
53
73
|
# @param [Pathname] gemfile path
|
54
74
|
# @param [Proc] block that can be evaluated for (inline) Gemfile
|
55
75
|
def gemfile_install(gemfile = nil, &inline)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
76
|
+
Bundler.settings.temporary(:frozen => false, :deployment => false) do
|
77
|
+
builder = DSL.new
|
78
|
+
if block_given?
|
79
|
+
builder.instance_eval(&inline)
|
80
|
+
else
|
81
|
+
builder.eval_gemfile(gemfile)
|
82
|
+
end
|
83
|
+
definition = builder.to_definition(nil, true)
|
63
84
|
|
64
|
-
|
85
|
+
return if definition.dependencies.empty?
|
65
86
|
|
66
|
-
|
67
|
-
|
87
|
+
plugins = definition.dependencies.map(&:name).reject {|p| index.installed? p }
|
88
|
+
installed_specs = Installer.new.install_definition(definition)
|
68
89
|
|
69
|
-
|
90
|
+
save_plugins plugins, installed_specs, builder.inferred_plugins
|
91
|
+
end
|
70
92
|
rescue RuntimeError => e
|
71
93
|
unless e.is_a?(GemfileError)
|
72
94
|
Bundler.ui.error "Failed to install plugin: #{e.message}\n #{e.backtrace[0]}"
|
@@ -234,7 +256,7 @@ module Bundler
|
|
234
256
|
@hooks_by_event = Hash.new {|h, k| h[k] = [] }
|
235
257
|
|
236
258
|
load_paths = spec.load_paths
|
237
|
-
add_to_load_path(load_paths)
|
259
|
+
Bundler.rubygems.add_to_load_path(load_paths)
|
238
260
|
path = Pathname.new spec.full_gem_path
|
239
261
|
|
240
262
|
begin
|
@@ -266,7 +288,7 @@ module Bundler
|
|
266
288
|
# done to avoid conflicts
|
267
289
|
path = index.plugin_path(name)
|
268
290
|
|
269
|
-
add_to_load_path(index.load_paths(name))
|
291
|
+
Bundler.rubygems.add_to_load_path(index.load_paths(name))
|
270
292
|
|
271
293
|
load path.join(PLUGIN_FILE_NAME)
|
272
294
|
|
@@ -276,17 +298,8 @@ module Bundler
|
|
276
298
|
raise
|
277
299
|
end
|
278
300
|
|
279
|
-
def add_to_load_path(load_paths)
|
280
|
-
if insert_index = Bundler.rubygems.load_path_insert_index
|
281
|
-
$LOAD_PATH.insert(insert_index, *load_paths)
|
282
|
-
else
|
283
|
-
$LOAD_PATH.unshift(*load_paths)
|
284
|
-
end
|
285
|
-
end
|
286
|
-
|
287
301
|
class << self
|
288
|
-
private :load_plugin, :register_plugin, :save_plugins, :validate_plugin
|
289
|
-
:add_to_load_path
|
302
|
+
private :load_plugin, :register_plugin, :save_plugins, :validate_plugin!
|
290
303
|
end
|
291
304
|
end
|
292
305
|
end
|
data/lib/bundler/plugin/api.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "uri"
|
4
|
-
|
5
3
|
module Bundler
|
6
4
|
module Plugin
|
7
5
|
class API
|
@@ -37,7 +35,7 @@ module Bundler
|
|
37
35
|
#
|
38
36
|
# @!attribute [rw] dependency_names
|
39
37
|
# @return [Array<String>] Names of dependencies that the source should
|
40
|
-
# try to resolve. It is not necessary to use this list
|
38
|
+
# try to resolve. It is not necessary to use this list internally. This
|
41
39
|
# is present to be compatible with `Definition` and is used by
|
42
40
|
# rubygems source.
|
43
41
|
module Source
|
@@ -108,7 +106,7 @@ module Bundler
|
|
108
106
|
def install_path
|
109
107
|
@install_path ||=
|
110
108
|
begin
|
111
|
-
base_name = File.basename(URI.parse(uri).normalize.path)
|
109
|
+
base_name = File.basename(Bundler::URI.parse(uri).normalize.path)
|
112
110
|
|
113
111
|
gem_install_dir.join("#{base_name}-#{uri_hash[0..11]}")
|
114
112
|
end
|
@@ -170,7 +168,7 @@ module Bundler
|
|
170
168
|
#
|
171
169
|
# This is used by `app_cache_path`
|
172
170
|
def app_cache_dirname
|
173
|
-
base_name = File.basename(URI.parse(uri).normalize.path)
|
171
|
+
base_name = File.basename(Bundler::URI.parse(uri).normalize.path)
|
174
172
|
"#{base_name}-#{uri_hash}"
|
175
173
|
end
|
176
174
|
|
@@ -196,7 +194,7 @@ module Bundler
|
|
196
194
|
# This shall check if two source object represent the same source.
|
197
195
|
#
|
198
196
|
# The comparison shall take place only on the attribute that can be
|
199
|
-
# inferred from the options passed from Gemfile and not on
|
197
|
+
# inferred from the options passed from Gemfile and not on attributes
|
200
198
|
# that are used to pin down the gem to specific version (e.g. Git
|
201
199
|
# sources should compare on branch and tag but not on commit hash)
|
202
200
|
#
|
data/lib/bundler/plugin/index.rb
CHANGED
@@ -58,7 +58,10 @@ module Bundler
|
|
58
58
|
raise SourceConflict.new(name, common) unless common.empty?
|
59
59
|
sources.each {|k| @sources[k] = name }
|
60
60
|
|
61
|
-
hooks.each
|
61
|
+
hooks.each do |event|
|
62
|
+
event_hooks = (@hooks[event] ||= []) << name
|
63
|
+
event_hooks.uniq!
|
64
|
+
end
|
62
65
|
|
63
66
|
@plugin_paths[name] = path
|
64
67
|
@load_paths[name] = load_paths
|
@@ -100,6 +103,14 @@ module Bundler
|
|
100
103
|
@plugin_paths[name]
|
101
104
|
end
|
102
105
|
|
106
|
+
def installed_plugins
|
107
|
+
@plugin_paths.keys
|
108
|
+
end
|
109
|
+
|
110
|
+
def plugin_commands(plugin)
|
111
|
+
@commands.find_all {|_, n| n == plugin }.map(&:first)
|
112
|
+
end
|
113
|
+
|
103
114
|
def source?(source)
|
104
115
|
@sources.key? source
|
105
116
|
end
|
@@ -128,7 +139,7 @@ module Bundler
|
|
128
139
|
|
129
140
|
data = index_f.read
|
130
141
|
|
131
|
-
|
142
|
+
require_relative "../yaml_serializer"
|
132
143
|
index = YAMLSerializer.load(data)
|
133
144
|
|
134
145
|
@commands.merge!(index["commands"])
|
@@ -151,7 +162,7 @@ module Bundler
|
|
151
162
|
"sources" => @sources,
|
152
163
|
}
|
153
164
|
|
154
|
-
|
165
|
+
require_relative "../yaml_serializer"
|
155
166
|
SharedHelpers.filesystem_access(index_file) do |index_f|
|
156
167
|
FileUtils.mkdir_p(index_f.dirname)
|
157
168
|
File.open(index_f, "w") {|f| f.puts YAMLSerializer.dump(index) }
|
@@ -8,14 +8,19 @@ module Bundler
|
|
8
8
|
# are heavily dependent on the Gemfile.
|
9
9
|
module Plugin
|
10
10
|
class Installer
|
11
|
-
autoload :Rubygems, "
|
12
|
-
autoload :Git, "
|
11
|
+
autoload :Rubygems, File.expand_path("installer/rubygems", __dir__)
|
12
|
+
autoload :Git, File.expand_path("installer/git", __dir__)
|
13
13
|
|
14
14
|
def install(names, options)
|
15
|
+
check_sources_consistency!(options)
|
16
|
+
|
15
17
|
version = options[:version] || [">= 0"]
|
16
|
-
|
18
|
+
|
19
|
+
Bundler.settings.temporary(:disable_multisource => false) do
|
17
20
|
if options[:git]
|
18
21
|
install_git(names, version, options)
|
22
|
+
elsif options[:local_git]
|
23
|
+
install_local_git(names, version, options)
|
19
24
|
else
|
20
25
|
sources = options[:source] || Bundler.rubygems.sources
|
21
26
|
install_rubygems(names, version, sources)
|
@@ -38,22 +43,24 @@ module Bundler
|
|
38
43
|
|
39
44
|
private
|
40
45
|
|
46
|
+
def check_sources_consistency!(options)
|
47
|
+
if options.key?(:git) && options.key?(:local_git)
|
48
|
+
raise InvalidOption, "Remote and local plugin git sources can't be both specified"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
41
52
|
def install_git(names, version, options)
|
42
53
|
uri = options.delete(:git)
|
43
54
|
options["uri"] = uri
|
44
55
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
# To support both sources
|
49
|
-
if options[:source]
|
50
|
-
source_list.add_rubygems_source("remotes" => options[:source])
|
51
|
-
end
|
56
|
+
install_all_sources(names, version, options, options[:source])
|
57
|
+
end
|
52
58
|
|
53
|
-
|
59
|
+
def install_local_git(names, version, options)
|
60
|
+
uri = options.delete(:local_git)
|
61
|
+
options["uri"] = uri
|
54
62
|
|
55
|
-
|
56
|
-
install_definition(definition)
|
63
|
+
install_all_sources(names, version, options, options[:source])
|
57
64
|
end
|
58
65
|
|
59
66
|
# Installs the plugin from rubygems source and returns the path where the
|
@@ -65,10 +72,16 @@ module Bundler
|
|
65
72
|
#
|
66
73
|
# @return [Hash] map of names to the specs of plugins installed
|
67
74
|
def install_rubygems(names, version, sources)
|
68
|
-
|
75
|
+
install_all_sources(names, version, nil, sources)
|
76
|
+
end
|
69
77
|
|
78
|
+
def install_all_sources(names, version, git_source_options, rubygems_source)
|
70
79
|
source_list = SourceList.new
|
71
|
-
|
80
|
+
|
81
|
+
source_list.add_git_source(git_source_options) if git_source_options
|
82
|
+
source_list.add_rubygems_source("remotes" => rubygems_source) if rubygems_source
|
83
|
+
|
84
|
+
deps = names.map {|name| Dependency.new name, version }
|
72
85
|
|
73
86
|
definition = Definition.new(nil, deps, source_list, true)
|
74
87
|
install_definition(definition)
|