bundler 2.2.24 → 2.2.28
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 +62 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/cache.rb +1 -1
- data/lib/bundler/cli/doctor.rb +1 -1
- data/lib/bundler/cli/exec.rb +1 -6
- data/lib/bundler/cli/gem.rb +3 -2
- data/lib/bundler/cli/install.rb +4 -17
- data/lib/bundler/cli/list.rb +7 -1
- data/lib/bundler/cli/open.rb +1 -2
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/update.rb +1 -1
- data/lib/bundler/cli.rb +12 -9
- data/lib/bundler/definition.rb +25 -29
- data/lib/bundler/dsl.rb +14 -1
- data/lib/bundler/errors.rb +1 -1
- data/lib/bundler/installer/gem_installer.rb +3 -16
- data/lib/bundler/installer/standalone.rb +13 -8
- data/lib/bundler/installer.rb +0 -1
- data/lib/bundler/lockfile_parser.rb +1 -0
- data/lib/bundler/plugin/installer.rb +2 -0
- data/lib/bundler/plugin.rb +23 -6
- data/lib/bundler/resolver.rb +10 -17
- data/lib/bundler/rubygems_gem_installer.rb +5 -1
- data/lib/bundler/rubygems_integration.rb +2 -0
- data/lib/bundler/runtime.rb +15 -6
- data/lib/bundler/settings.rb +13 -1
- data/lib/bundler/setup.rb +2 -2
- data/lib/bundler/shared_helpers.rb +0 -7
- data/lib/bundler/source/git/git_proxy.rb +1 -2
- data/lib/bundler/source/rubygems.rb +23 -2
- data/lib/bundler/source/rubygems_aggregate.rb +4 -0
- data/lib/bundler/source.rb +4 -0
- data/lib/bundler/source_list.rb +16 -3
- data/lib/bundler/spec_set.rb +13 -35
- data/lib/bundler/templates/Executable.bundler +6 -6
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +13 -2
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +4 -2
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +17 -2
- data/lib/bundler.rb +11 -21
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35773b207a2a4289d58aa6ddd95848ac7a5ad74d1d252c82c55375cc2faa34c3
|
4
|
+
data.tar.gz: 5221811c1f5564852c18e319872f63edfb435612406ce99f5bad97357e1483d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba8a4dfd5a819525341a772361466517157b7c49ab29e36e0a4d24d80939f6ed3ab412fe5709c0dd5d70a57737fca1d4b595c3636b9949d18951d5bf6a77138
|
7
|
+
data.tar.gz: e8c90fead6ac38c7cc693cf2d56269dbcce9f6b99704784a46ff433cd5b402574e878d314ea7728066d60c87afc82d22b381957cf81af3ca4b9c0d483afd4e96
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,65 @@
|
|
1
|
+
# 2.2.28 (September 23, 2021)
|
2
|
+
|
3
|
+
## Enhancements:
|
4
|
+
|
5
|
+
- Use example.com in new gem template, since it will never have a potentially dangerous backing website [#4918](https://github.com/rubygems/rubygems/pull/4918)
|
6
|
+
- Deprecate `--install` flag to `bundle remove` and trigger install by default [#4891](https://github.com/rubygems/rubygems/pull/4891)
|
7
|
+
|
8
|
+
# 2.2.27 (September 3, 2021)
|
9
|
+
|
10
|
+
## Enhancements:
|
11
|
+
|
12
|
+
- Optimize some requires [#4887](https://github.com/rubygems/rubygems/pull/4887)
|
13
|
+
- Correctly redact credentials when using x-oauth-basic [#4866](https://github.com/rubygems/rubygems/pull/4866)
|
14
|
+
|
15
|
+
## Bug fixes:
|
16
|
+
|
17
|
+
- Add missing key `branches:` to template for GitHub Actions [#4883](https://github.com/rubygems/rubygems/pull/4883)
|
18
|
+
- Fix `bundle plugin install` detection of already installed plugins [#4869](https://github.com/rubygems/rubygems/pull/4869)
|
19
|
+
- Make plugin installation idempotent [#4864](https://github.com/rubygems/rubygems/pull/4864)
|
20
|
+
- Fix `bundle check` showing duplicated gems when multiple platforms are locked [#4854](https://github.com/rubygems/rubygems/pull/4854)
|
21
|
+
- Fix `bundle check` incorrectly considering cached gems [#4853](https://github.com/rubygems/rubygems/pull/4853)
|
22
|
+
|
23
|
+
# 2.2.26 (August 17, 2021)
|
24
|
+
|
25
|
+
## Enhancements:
|
26
|
+
|
27
|
+
- Remove `RUBYGEMS_GEMDEPS` warning [#4827](https://github.com/rubygems/rubygems/pull/4827)
|
28
|
+
- Better defaults for GitHub Actions template generated by `bundle gem` [#4619](https://github.com/rubygems/rubygems/pull/4619)
|
29
|
+
- Make `bundle exec` keep file descriptors by default [#4812](https://github.com/rubygems/rubygems/pull/4812)
|
30
|
+
- Exclude gemspec file itself from file list of gems generated by `bundle gem` [#4650](https://github.com/rubygems/rubygems/pull/4650)
|
31
|
+
- Fix a couple small typos in deprecation / error messages [#4806](https://github.com/rubygems/rubygems/pull/4806)
|
32
|
+
- Make script generated by `bundle install --standalone` resilient to moving the application to a differently nested folder when `path` sources are used [#4792](https://github.com/rubygems/rubygems/pull/4792)
|
33
|
+
- Exclude CI files and issue templates from file list of gems generated by `bundle gem` [#4033](https://github.com/rubygems/rubygems/pull/4033)
|
34
|
+
|
35
|
+
## Bug fixes:
|
36
|
+
|
37
|
+
- Respect `BUNDLE_USER_HOME` env when choosing config location [#4828](https://github.com/rubygems/rubygems/pull/4828)
|
38
|
+
- Fix `bundle gem` on path with spaces [#4816](https://github.com/rubygems/rubygems/pull/4816)
|
39
|
+
- Fix bundler hitting the network in some cases where not allowed [#4805](https://github.com/rubygems/rubygems/pull/4805)
|
40
|
+
|
41
|
+
# 2.2.25 (July 30, 2021)
|
42
|
+
|
43
|
+
## Deprecations:
|
44
|
+
|
45
|
+
- Deprecate Gemfile without an explicit global source [#4779](https://github.com/rubygems/rubygems/pull/4779)
|
46
|
+
- Deprecate `bundle cache --path` [#4496](https://github.com/rubygems/rubygems/pull/4496)
|
47
|
+
|
48
|
+
## Enhancements:
|
49
|
+
|
50
|
+
- Give better errors when materialization fails [#4788](https://github.com/rubygems/rubygems/pull/4788)
|
51
|
+
- Lazily load `shellwords` library [#4786](https://github.com/rubygems/rubygems/pull/4786)
|
52
|
+
- Show original error and backtrace directly on `bundle install` errors instead of a more brittle `gem install` hint [#4778](https://github.com/rubygems/rubygems/pull/4778)
|
53
|
+
- Remove LoadError message in regards to requiring a relative file [#4772](https://github.com/rubygems/rubygems/pull/4772)
|
54
|
+
|
55
|
+
## Bug fixes:
|
56
|
+
|
57
|
+
- Fix `BUNDLE_USER_CONFIG` no longer respected as config location [#4797](https://github.com/rubygems/rubygems/pull/4797)
|
58
|
+
- Fix `--standalone` installation of default gems [#4782](https://github.com/rubygems/rubygems/pull/4782)
|
59
|
+
- Fix `--quiet` flag not printing warnings [#4781](https://github.com/rubygems/rubygems/pull/4781)
|
60
|
+
- Fix bundler binstub version selection [#4775](https://github.com/rubygems/rubygems/pull/4775)
|
61
|
+
- Fix interrupt handling in Bundler workers [#4767](https://github.com/rubygems/rubygems/pull/4767)
|
62
|
+
|
1
63
|
# 2.2.24 (July 15, 2021)
|
2
64
|
|
3
65
|
## Bug fixes:
|
@@ -4,8 +4,8 @@ module Bundler
|
|
4
4
|
# Represents metadata from when the Bundler gem was built.
|
5
5
|
module BuildMetadata
|
6
6
|
# begin ivars
|
7
|
-
@built_at = "2021-
|
8
|
-
@git_commit_sha = "
|
7
|
+
@built_at = "2021-09-23".freeze
|
8
|
+
@git_commit_sha = "99b72cbd55".freeze
|
9
9
|
@release = true
|
10
10
|
# end ivars
|
11
11
|
|
data/lib/bundler/cli/cache.rb
CHANGED
@@ -9,7 +9,7 @@ module Bundler
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def run
|
12
|
-
Bundler.ui.level = "
|
12
|
+
Bundler.ui.level = "warn" if options[:quiet]
|
13
13
|
Bundler.settings.set_command_option_if_given :path, options[:path]
|
14
14
|
Bundler.settings.set_command_option_if_given :cache_path, options["cache-path"]
|
15
15
|
|
data/lib/bundler/cli/doctor.rb
CHANGED
data/lib/bundler/cli/exec.rb
CHANGED
@@ -12,12 +12,7 @@ module Bundler
|
|
12
12
|
@options = options
|
13
13
|
@cmd = args.shift
|
14
14
|
@args = args
|
15
|
-
|
16
|
-
if !Bundler.current_ruby.jruby?
|
17
|
-
@args << { :close_others => !options.keep_file_descriptors? }
|
18
|
-
elsif options.keep_file_descriptors?
|
19
|
-
Bundler.ui.warn "Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec."
|
20
|
-
end
|
15
|
+
@args << { :close_others => !options.keep_file_descriptors? } unless Bundler.current_ruby.jruby?
|
21
16
|
end
|
22
17
|
|
23
18
|
def run
|
data/lib/bundler/cli/gem.rb
CHANGED
@@ -184,14 +184,15 @@ module Bundler
|
|
184
184
|
)
|
185
185
|
end
|
186
186
|
|
187
|
-
if
|
187
|
+
if target.exist? && !target.directory?
|
188
188
|
Bundler.ui.error "Couldn't create a new gem named `#{gem_name}` because there's an existing file named `#{gem_name}`."
|
189
189
|
exit Bundler::BundlerError.all_errors[Bundler::GenericSystemCallError]
|
190
190
|
end
|
191
191
|
|
192
192
|
if use_git
|
193
193
|
Bundler.ui.info "Initializing git repo in #{target}"
|
194
|
-
|
194
|
+
require "shellwords"
|
195
|
+
`git init #{target.to_s.shellescape}`
|
195
196
|
|
196
197
|
config[:git_default_branch] = File.read("#{target}/.git/HEAD").split("/").last.chomp
|
197
198
|
end
|
data/lib/bundler/cli/install.rb
CHANGED
@@ -8,7 +8,7 @@ module Bundler
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def run
|
11
|
-
Bundler.ui.level = "
|
11
|
+
Bundler.ui.level = "warn" if options[:quiet]
|
12
12
|
|
13
13
|
warn_if_root
|
14
14
|
|
@@ -60,7 +60,7 @@ module Bundler
|
|
60
60
|
installer = Installer.install(Bundler.root, definition, options)
|
61
61
|
|
62
62
|
Bundler.settings.temporary(:cache_all_platforms => options[:local] ? false : Bundler.settings[:cache_all_platforms]) do
|
63
|
-
Bundler.load.cache if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
|
63
|
+
Bundler.load.cache(nil, options[:local]) if Bundler.app_cache.exist? && !options["no-cache"] && !Bundler.frozen_bundle?
|
64
64
|
end
|
65
65
|
|
66
66
|
Bundler.ui.confirm "Bundle complete! #{dependencies_count_for(definition)}, #{gems_installed_for(definition)}."
|
@@ -83,22 +83,9 @@ module Bundler
|
|
83
83
|
end
|
84
84
|
|
85
85
|
Bundler::CLI::Common.output_fund_metadata_summary
|
86
|
-
rescue
|
87
|
-
if options[:local] && Bundler.app_cache.exist?
|
88
|
-
Bundler.ui.warn "Some gems seem to be missing from your #{Bundler.settings.app_cache_path} directory."
|
89
|
-
end
|
90
|
-
|
91
|
-
unless Bundler.definition.has_rubygems_remotes?
|
92
|
-
Bundler.ui.warn <<-WARN, :wrap => true
|
93
|
-
Your Gemfile has no gem server sources. If you need gems that are \
|
94
|
-
not already on your machine, add a line like this to your Gemfile:
|
95
|
-
source 'https://rubygems.org'
|
96
|
-
WARN
|
97
|
-
end
|
98
|
-
raise e
|
99
|
-
rescue Gem::InvalidSpecificationException => e
|
86
|
+
rescue Gem::InvalidSpecificationException
|
100
87
|
Bundler.ui.warn "You have one or more invalid gemspecs that need to be fixed."
|
101
|
-
raise
|
88
|
+
raise
|
102
89
|
end
|
103
90
|
|
104
91
|
private
|
data/lib/bundler/cli/list.rb
CHANGED
@@ -16,7 +16,13 @@ module Bundler
|
|
16
16
|
specs = if @only_group.any? || @without_group.any?
|
17
17
|
filtered_specs_by_groups
|
18
18
|
else
|
19
|
-
|
19
|
+
begin
|
20
|
+
Bundler.load.specs
|
21
|
+
rescue GemNotFound => e
|
22
|
+
Bundler.ui.error e.message
|
23
|
+
Bundler.ui.warn "Install missing gems with `bundle install`."
|
24
|
+
exit 1
|
25
|
+
end
|
20
26
|
end.reject {|s| s.name == "bundler" }.sort_by(&:name)
|
21
27
|
|
22
28
|
return Bundler.ui.info "No gems in the Gemfile" if specs.empty?
|
data/lib/bundler/cli/open.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "shellwords"
|
4
|
-
|
5
3
|
module Bundler
|
6
4
|
class CLI::Open
|
7
5
|
attr_reader :options, :name
|
@@ -19,6 +17,7 @@ module Bundler
|
|
19
17
|
else
|
20
18
|
path = spec.full_gem_path
|
21
19
|
Dir.chdir(path) do
|
20
|
+
require "shellwords"
|
22
21
|
command = Shellwords.split(editor) + [path]
|
23
22
|
Bundler.with_original_env do
|
24
23
|
system(*command)
|
data/lib/bundler/cli/remove.rb
CHANGED
@@ -11,8 +11,7 @@ module Bundler
|
|
11
11
|
raise InvalidOption, "Please specify gems to remove." if @gems.empty?
|
12
12
|
|
13
13
|
Injector.remove(@gems, {})
|
14
|
-
|
15
|
-
Installer.install(Bundler.root, Bundler.definition) if @options["install"]
|
14
|
+
Installer.install(Bundler.root, Bundler.definition)
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
data/lib/bundler/cli/update.rb
CHANGED
data/lib/bundler/cli.rb
CHANGED
@@ -73,14 +73,6 @@ module Bundler
|
|
73
73
|
Bundler.ui = UI::Shell.new(options)
|
74
74
|
Bundler.ui.level = "debug" if options["verbose"]
|
75
75
|
unprinted_warnings.each {|w| Bundler.ui.warn(w) }
|
76
|
-
|
77
|
-
if ENV["RUBYGEMS_GEMDEPS"] && !ENV["RUBYGEMS_GEMDEPS"].empty?
|
78
|
-
Bundler.ui.warn(
|
79
|
-
"The RUBYGEMS_GEMDEPS environment variable is set. This enables RubyGems' " \
|
80
|
-
"experimental Gemfile mode, which may conflict with Bundler and cause unexpected errors. " \
|
81
|
-
"To remove this warning, unset RUBYGEMS_GEMDEPS.", :wrap => true
|
82
|
-
)
|
83
|
-
end
|
84
76
|
end
|
85
77
|
|
86
78
|
check_unknown_options!(:except => [:config, :exec])
|
@@ -192,6 +184,7 @@ module Bundler
|
|
192
184
|
method_option "install", :type => :boolean, :banner =>
|
193
185
|
"Runs 'bundle install' after removing the gems from the Gemfile"
|
194
186
|
def remove(*gems)
|
187
|
+
SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install")
|
195
188
|
require_relative "cli/remove"
|
196
189
|
Remove.new(gems, options).run
|
197
190
|
end
|
@@ -456,6 +449,12 @@ module Bundler
|
|
456
449
|
"do in future versions. Instead please use `bundle config set cache_all true`, " \
|
457
450
|
"and stop using this flag" if ARGV.include?("--all")
|
458
451
|
|
452
|
+
SharedHelpers.major_deprecation 2,
|
453
|
+
"The `--path` flag is deprecated because its semantics are unclear. " \
|
454
|
+
"Use `bundle config cache_path` to configure the path of your cache of gems, " \
|
455
|
+
"and `bundle config path` to configure the path where your gems are installed, " \
|
456
|
+
"and stop using this flag" if ARGV.include?("--path")
|
457
|
+
|
459
458
|
require_relative "cli/cache"
|
460
459
|
Cache.new(options).run
|
461
460
|
end
|
@@ -463,7 +462,7 @@ module Bundler
|
|
463
462
|
map aliases_for("cache")
|
464
463
|
|
465
464
|
desc "exec [OPTIONS]", "Run the command in context of the bundle"
|
466
|
-
method_option :keep_file_descriptors, :type => :boolean, :default =>
|
465
|
+
method_option :keep_file_descriptors, :type => :boolean, :default => true
|
467
466
|
method_option :gemfile, :type => :string, :required => false
|
468
467
|
long_desc <<-D
|
469
468
|
Exec runs a command, providing it access to the gems in the bundle. While using
|
@@ -471,6 +470,10 @@ module Bundler
|
|
471
470
|
into the system wide RubyGems repository.
|
472
471
|
D
|
473
472
|
def exec(*args)
|
473
|
+
if ARGV.include?("--no-keep-file-descriptors")
|
474
|
+
SharedHelpers.major_deprecation(2, "The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to")
|
475
|
+
end
|
476
|
+
|
474
477
|
require_relative "cli/exec"
|
475
478
|
Exec.new(options, args).run
|
476
479
|
end
|
data/lib/bundler/definition.rb
CHANGED
@@ -133,7 +133,7 @@ module Bundler
|
|
133
133
|
@unlock[:gems] ||= @dependencies.map(&:name)
|
134
134
|
else
|
135
135
|
eager_unlock = expand_dependencies(@unlock[:gems] || [], true)
|
136
|
-
@unlock[:gems] = @locked_specs.for(eager_unlock, false, false
|
136
|
+
@unlock[:gems] = @locked_specs.for(eager_unlock, false, false).map(&:name)
|
137
137
|
end
|
138
138
|
|
139
139
|
@dependency_changes = converge_dependencies
|
@@ -185,15 +185,7 @@ module Bundler
|
|
185
185
|
#
|
186
186
|
# @return [Bundler::SpecSet]
|
187
187
|
def specs
|
188
|
-
@specs ||=
|
189
|
-
rescue GemNotFound => e # Handle yanked gem
|
190
|
-
gem_name, gem_version = extract_gem_info(e)
|
191
|
-
locked_gem = @locked_specs[gem_name].last
|
192
|
-
raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote
|
193
|
-
raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
|
194
|
-
"no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
|
195
|
-
"You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
|
196
|
-
"removed in order to install."
|
188
|
+
@specs ||= materialize(requested_dependencies)
|
197
189
|
end
|
198
190
|
|
199
191
|
def new_specs
|
@@ -205,9 +197,7 @@ module Bundler
|
|
205
197
|
end
|
206
198
|
|
207
199
|
def missing_specs
|
208
|
-
|
209
|
-
resolve.materialize(requested_dependencies, missing)
|
210
|
-
missing
|
200
|
+
resolve.materialize(requested_dependencies).missing_specs
|
211
201
|
end
|
212
202
|
|
213
203
|
def missing_specs?
|
@@ -241,7 +231,7 @@ module Bundler
|
|
241
231
|
def specs_for(groups)
|
242
232
|
groups = requested_groups if groups.empty?
|
243
233
|
deps = dependencies_for(groups)
|
244
|
-
|
234
|
+
materialize(expand_dependencies(deps))
|
245
235
|
end
|
246
236
|
|
247
237
|
def dependencies_for(groups)
|
@@ -274,10 +264,6 @@ module Bundler
|
|
274
264
|
end
|
275
265
|
end
|
276
266
|
|
277
|
-
def has_rubygems_remotes?
|
278
|
-
sources.rubygems_sources.any? {|s| s.remotes.any? }
|
279
|
-
end
|
280
|
-
|
281
267
|
def spec_git_paths
|
282
268
|
sources.git_sources.map {|s| File.realpath(s.path) if File.exist?(s.path) }.compact
|
283
269
|
end
|
@@ -493,7 +479,23 @@ module Bundler
|
|
493
479
|
|
494
480
|
private
|
495
481
|
|
496
|
-
def
|
482
|
+
def materialize(dependencies)
|
483
|
+
specs = resolve.materialize(dependencies)
|
484
|
+
missing_specs = specs.missing_specs
|
485
|
+
|
486
|
+
if missing_specs.any?
|
487
|
+
missing_specs.each do |s|
|
488
|
+
locked_gem = @locked_specs[s.name].last
|
489
|
+
next if locked_gem.nil? || locked_gem.version != s.version || !@remote
|
490
|
+
raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
|
491
|
+
"no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
|
492
|
+
"You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
|
493
|
+
"removed in order to install."
|
494
|
+
end
|
495
|
+
|
496
|
+
raise GemNotFound, "Could not find #{missing_specs.map(&:full_name).join(", ")} in any of the sources"
|
497
|
+
end
|
498
|
+
|
497
499
|
unless specs["bundler"].any?
|
498
500
|
bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
|
499
501
|
specs["bundler"] = bundler
|
@@ -503,7 +505,7 @@ module Bundler
|
|
503
505
|
end
|
504
506
|
|
505
507
|
def precompute_source_requirements_for_indirect_dependencies?
|
506
|
-
sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
|
508
|
+
@remote && sources.non_global_rubygems_sources.all?(&:dependency_api_available?) && !sources.aggregate_global_source?
|
507
509
|
end
|
508
510
|
|
509
511
|
def current_ruby_platform_locked?
|
@@ -712,7 +714,7 @@ module Bundler
|
|
712
714
|
@locked_specs.each do |s|
|
713
715
|
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
714
716
|
dep = @dependencies.find {|d| s.satisfies?(d) }
|
715
|
-
s.source = (dep && dep.source) || sources.get(s.source)
|
717
|
+
s.source = (dep && dep.source) || sources.get(s.source) unless multisource_allowed?
|
716
718
|
|
717
719
|
# Don't add a spec to the list if its source is expired. For example,
|
718
720
|
# if you change a Git gem to RubyGems.
|
@@ -730,7 +732,7 @@ module Bundler
|
|
730
732
|
# if we won't need the source (according to the lockfile),
|
731
733
|
# don't error if the path/git source isn't available
|
732
734
|
next if @locked_specs.
|
733
|
-
for(requested_dependencies, false, true
|
735
|
+
for(requested_dependencies, false, true).
|
734
736
|
none? {|locked_spec| locked_spec.source == s.source }
|
735
737
|
|
736
738
|
raise
|
@@ -750,7 +752,7 @@ module Bundler
|
|
750
752
|
|
751
753
|
resolve = SpecSet.new(converged)
|
752
754
|
@locked_specs_incomplete_for_platform = !resolve.for(expand_dependencies(requested_dependencies & deps), true, true)
|
753
|
-
resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false
|
755
|
+
resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
|
754
756
|
diff = nil
|
755
757
|
|
756
758
|
# Now, we unlock any sources that do not have anymore gems pinned to it
|
@@ -854,12 +856,6 @@ module Bundler
|
|
854
856
|
current == proposed
|
855
857
|
end
|
856
858
|
|
857
|
-
def extract_gem_info(error)
|
858
|
-
# This method will extract the error message like "Could not find foo-1.2.3 in any of the sources"
|
859
|
-
# to an array. The first element will be the gem name (e.g. foo), the second will be the version number.
|
860
|
-
error.message.scan(/Could not find (\w+)-(\d+(?:\.\d+)+)/).flatten
|
861
|
-
end
|
862
|
-
|
863
859
|
def compute_requires
|
864
860
|
dependencies.reduce({}) do |requires, dep|
|
865
861
|
next requires unless dep.should_include?
|
data/lib/bundler/dsl.rb
CHANGED
@@ -447,8 +447,21 @@ repo_name ||= user_name
|
|
447
447
|
end
|
448
448
|
|
449
449
|
def check_rubygems_source_safety
|
450
|
-
|
450
|
+
if @sources.implicit_global_source?
|
451
|
+
implicit_global_source_warning
|
452
|
+
elsif @sources.aggregate_global_source?
|
453
|
+
multiple_global_source_warning
|
454
|
+
end
|
455
|
+
end
|
456
|
+
|
457
|
+
def implicit_global_source_warning
|
458
|
+
Bundler::SharedHelpers.major_deprecation 2, "This Gemfile does not include an explicit global source. " \
|
459
|
+
"Not using an explicit global source may result in a different lockfile being generated depending on " \
|
460
|
+
"the gems you have installed locally before bundler is run. " \
|
461
|
+
"Instead, define a global source in your Gemfile like this: source \"https://rubygems.org\"."
|
462
|
+
end
|
451
463
|
|
464
|
+
def multiple_global_source_warning
|
452
465
|
if Bundler.feature_flag.bundler_3_mode?
|
453
466
|
msg = "This Gemfile contains multiple primary sources. " \
|
454
467
|
"Each source after the first must include a block to indicate which gems " \
|
data/lib/bundler/errors.rb
CHANGED
@@ -122,7 +122,7 @@ module Bundler
|
|
122
122
|
|
123
123
|
class VirtualProtocolError < BundlerError
|
124
124
|
def message
|
125
|
-
"There was an error relating to virtualization and file access." \
|
125
|
+
"There was an error relating to virtualization and file access. " \
|
126
126
|
"It is likely that you need to grant access to or mount some file system correctly."
|
127
127
|
end
|
128
128
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "shellwords"
|
4
|
-
|
5
3
|
module Bundler
|
6
4
|
class GemInstaller
|
7
5
|
attr_reader :spec, :standalone, :worker, :force, :installer
|
@@ -31,34 +29,23 @@ module Bundler
|
|
31
29
|
|
32
30
|
def specific_failure_message(e)
|
33
31
|
message = "#{e.class}: #{e.message}\n"
|
34
|
-
message += " " + e.backtrace.join("\n ") + "\n\n"
|
32
|
+
message += " " + e.backtrace.join("\n ") + "\n\n"
|
35
33
|
message = message.lines.first + Bundler.ui.add_color(message.lines.drop(1).join, :clear)
|
36
34
|
message + Bundler.ui.add_color(failure_message, :red)
|
37
35
|
end
|
38
36
|
|
39
37
|
def failure_message
|
40
|
-
|
41
|
-
"#{install_error_message}\n#{gem_install_message}"
|
38
|
+
install_error_message
|
42
39
|
end
|
43
40
|
|
44
41
|
def install_error_message
|
45
42
|
"An error occurred while installing #{spec.name} (#{spec.version}), and Bundler cannot continue."
|
46
43
|
end
|
47
44
|
|
48
|
-
def gem_install_message
|
49
|
-
source = spec.source
|
50
|
-
return unless source.respond_to?(:remotes)
|
51
|
-
|
52
|
-
if source.remotes.size == 1
|
53
|
-
"Make sure that `gem install #{spec.name} -v '#{spec.version}' --source '#{source.remotes.first}'` succeeds before bundling."
|
54
|
-
else
|
55
|
-
"Make sure that `gem install #{spec.name} -v '#{spec.version}'` succeeds before bundling."
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
45
|
def spec_settings
|
60
46
|
# Fetch the build settings, if there are any
|
61
47
|
if settings = Bundler.settings["build.#{spec.name}"]
|
48
|
+
require "shellwords"
|
62
49
|
Shellwords.shellsplit(settings)
|
63
50
|
end
|
64
51
|
end
|
@@ -12,12 +12,13 @@ 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 "ruby_engine = RUBY_ENGINE"
|
16
|
-
file.puts "ruby_version = RbConfig::CONFIG[\"ruby_version\"]"
|
17
|
-
file.puts "path = File.expand_path('..', __FILE__)"
|
18
15
|
file.puts reverse_rubygems_kernel_mixin
|
19
16
|
paths.each do |path|
|
20
|
-
|
17
|
+
if Pathname.new(path).absolute?
|
18
|
+
file.puts %($:.unshift "#{path}")
|
19
|
+
else
|
20
|
+
file.puts %($:.unshift File.expand_path("\#{__dir__}/#{path}"))
|
21
|
+
end
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
@@ -28,14 +29,14 @@ module Bundler
|
|
28
29
|
@specs.map do |spec|
|
29
30
|
next if spec.name == "bundler"
|
30
31
|
Array(spec.require_paths).map do |path|
|
31
|
-
gem_path(path, spec).sub(version_dir, '#{
|
32
|
+
gem_path(path, spec).sub(version_dir, '#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}')
|
32
33
|
# This is a static string intentionally. It's interpolated at a later time.
|
33
34
|
end
|
34
|
-
end.flatten
|
35
|
+
end.flatten.compact
|
35
36
|
end
|
36
37
|
|
37
38
|
def version_dir
|
38
|
-
"#{
|
39
|
+
"#{RUBY_ENGINE}/#{RbConfig::CONFIG["ruby_version"]}"
|
39
40
|
end
|
40
41
|
|
41
42
|
def bundler_path
|
@@ -44,7 +45,11 @@ module Bundler
|
|
44
45
|
|
45
46
|
def gem_path(path, spec)
|
46
47
|
full_path = Pathname.new(path).absolute? ? path : File.join(spec.full_gem_path, path)
|
47
|
-
|
48
|
+
if spec.source.instance_of?(Source::Path)
|
49
|
+
full_path
|
50
|
+
else
|
51
|
+
Pathname.new(full_path).relative_path_from(Bundler.root.join(bundler_path)).to_s
|
52
|
+
end
|
48
53
|
rescue TypeError
|
49
54
|
error_message = "#{spec.name} #{spec.version} has an invalid gemspec"
|
50
55
|
raise Gem::InvalidSpecificationException.new(error_message)
|
data/lib/bundler/installer.rb
CHANGED
@@ -195,6 +195,7 @@ module Bundler
|
|
195
195
|
platform = platform ? Gem::Platform.new(platform) : Gem::Platform::RUBY
|
196
196
|
@current_spec = LazySpecification.new(name, version, platform)
|
197
197
|
@current_spec.source = @current_source
|
198
|
+
@current_source.add_dependency_names(name)
|
198
199
|
|
199
200
|
@specs[@current_spec.identifier] = @current_spec
|
200
201
|
elsif spaces.size == 6
|
data/lib/bundler/plugin.rb
CHANGED
@@ -13,6 +13,7 @@ module Bundler
|
|
13
13
|
class MalformattedPlugin < PluginError; end
|
14
14
|
class UndefinedCommandError < PluginError; end
|
15
15
|
class UnknownSourceError < PluginError; end
|
16
|
+
class PluginInstallError < PluginError; end
|
16
17
|
|
17
18
|
PLUGIN_FILE_NAME = "plugins.rb".freeze
|
18
19
|
|
@@ -38,12 +39,11 @@ module Bundler
|
|
38
39
|
specs = Installer.new.install(names, options)
|
39
40
|
|
40
41
|
save_plugins names, specs
|
41
|
-
rescue PluginError
|
42
|
+
rescue PluginError
|
42
43
|
specs_to_delete = specs.select {|k, _v| names.include?(k) && !index.commands.values.include?(k) }
|
43
44
|
specs_to_delete.each_value {|spec| Bundler.rm_rf(spec.full_gem_path) }
|
44
45
|
|
45
|
-
|
46
|
-
Bundler.ui.error "Failed to install the following plugins: #{names_list}. The underlying error was: #{e.message}.\n #{e.backtrace.join("\n ")}"
|
46
|
+
raise
|
47
47
|
end
|
48
48
|
|
49
49
|
# Uninstalls plugins by the given names
|
@@ -245,10 +245,11 @@ module Bundler
|
|
245
245
|
# @param [Array<String>] names of inferred source plugins that can be ignored
|
246
246
|
def save_plugins(plugins, specs, optional_plugins = [])
|
247
247
|
plugins.each do |name|
|
248
|
+
next if index.installed?(name)
|
249
|
+
|
248
250
|
spec = specs[name]
|
249
|
-
|
250
|
-
|
251
|
-
Bundler.ui.info "Installed plugin #{name}" if installed
|
251
|
+
|
252
|
+
save_plugin(name, spec, optional_plugins.include?(name))
|
252
253
|
end
|
253
254
|
end
|
254
255
|
|
@@ -263,6 +264,22 @@ module Bundler
|
|
263
264
|
raise MalformattedPlugin, "#{PLUGIN_FILE_NAME} was not found in the plugin." unless plugin_file.file?
|
264
265
|
end
|
265
266
|
|
267
|
+
# Validates and registers a plugin.
|
268
|
+
#
|
269
|
+
# @param [String] name the name of the plugin
|
270
|
+
# @param [Specification] spec of installed plugin
|
271
|
+
# @param [Boolean] optional_plugin, removed if there is conflict with any
|
272
|
+
# other plugin (used for default source plugins)
|
273
|
+
#
|
274
|
+
# @raise [PluginInstallError] if validation or registration raises any error
|
275
|
+
def save_plugin(name, spec, optional_plugin = false)
|
276
|
+
validate_plugin! Pathname.new(spec.full_gem_path)
|
277
|
+
installed = register_plugin(name, spec, optional_plugin)
|
278
|
+
Bundler.ui.info "Installed plugin #{name}" if installed
|
279
|
+
rescue PluginError => e
|
280
|
+
raise PluginInstallError, "Failed to install plugin `#{spec.name}`, due to #{e.class} (#{e.message})"
|
281
|
+
end
|
282
|
+
|
266
283
|
# Runs the plugins.rb file in an isolated namespace, records the plugin
|
267
284
|
# actions it registers for and then passes the data to index to be stored.
|
268
285
|
#
|