bundler 2.2.26 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +206 -1
- data/README.md +1 -1
- data/exe/bundle +7 -8
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli/check.rb +1 -1
- data/lib/bundler/cli/config.rb +10 -1
- data/lib/bundler/cli/doctor.rb +12 -3
- data/lib/bundler/cli/gem.rb +98 -9
- data/lib/bundler/cli/info.rb +26 -5
- data/lib/bundler/cli/install.rb +8 -28
- data/lib/bundler/cli/issue.rb +4 -3
- data/lib/bundler/cli/platform.rb +1 -1
- data/lib/bundler/cli/remove.rb +1 -2
- data/lib/bundler/cli/update.rb +8 -4
- data/lib/bundler/cli.rb +13 -11
- data/lib/bundler/compact_index_client/cache.rb +0 -9
- data/lib/bundler/compact_index_client/updater.rb +0 -5
- data/lib/bundler/compact_index_client.rb +2 -8
- data/lib/bundler/definition.rb +79 -133
- data/lib/bundler/dependency.rb +5 -7
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +18 -30
- data/lib/bundler/endpoint_specification.rb +21 -11
- data/lib/bundler/env.rb +1 -1
- data/lib/bundler/environment_preserver.rb +4 -1
- data/lib/bundler/errors.rb +18 -2
- data/lib/bundler/fetcher/compact_index.rb +9 -14
- data/lib/bundler/fetcher/index.rb +0 -26
- data/lib/bundler/fetcher.rb +13 -20
- data/lib/bundler/friendly_errors.rb +5 -30
- data/lib/bundler/gem_helper.rb +7 -18
- data/lib/bundler/injector.rb +10 -1
- data/lib/bundler/installer/gem_installer.rb +1 -6
- data/lib/bundler/installer.rb +1 -5
- data/lib/bundler/lazy_specification.rb +19 -3
- data/lib/bundler/lockfile_generator.rb +1 -1
- data/lib/bundler/lockfile_parser.rb +10 -12
- data/lib/bundler/man/bundle-add.1 +10 -2
- data/lib/bundler/man/bundle-add.1.ronn +7 -1
- data/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/lib/bundler/man/bundle-cache.1 +1 -1
- data/lib/bundler/man/bundle-check.1 +1 -1
- data/lib/bundler/man/bundle-clean.1 +1 -1
- data/lib/bundler/man/bundle-config.1 +5 -5
- data/lib/bundler/man/bundle-config.1.ronn +5 -5
- data/lib/bundler/man/bundle-doctor.1 +1 -1
- data/lib/bundler/man/bundle-exec.1 +1 -1
- data/lib/bundler/man/bundle-gem.1 +14 -1
- data/lib/bundler/man/bundle-gem.1.ronn +16 -0
- data/lib/bundler/man/bundle-info.1 +1 -1
- data/lib/bundler/man/bundle-init.1 +1 -1
- data/lib/bundler/man/bundle-inject.1 +1 -1
- data/lib/bundler/man/bundle-install.1 +2 -2
- data/lib/bundler/man/bundle-install.1.ronn +2 -2
- data/lib/bundler/man/bundle-list.1 +1 -1
- data/lib/bundler/man/bundle-lock.1 +1 -1
- data/lib/bundler/man/bundle-open.1 +1 -1
- data/lib/bundler/man/bundle-outdated.1 +1 -1
- data/lib/bundler/man/bundle-platform.1 +1 -1
- data/lib/bundler/man/bundle-pristine.1 +1 -1
- data/lib/bundler/man/bundle-remove.1 +1 -1
- data/lib/bundler/man/bundle-show.1 +1 -1
- data/lib/bundler/man/bundle-update.1 +2 -2
- data/lib/bundler/man/bundle-update.1.ronn +2 -1
- data/lib/bundler/man/bundle-viz.1 +1 -1
- data/lib/bundler/man/bundle.1 +1 -1
- data/lib/bundler/man/gemfile.5 +28 -2
- data/lib/bundler/man/gemfile.5.ronn +9 -1
- data/lib/bundler/plugin/api/source.rb +1 -0
- data/lib/bundler/plugin/installer.rb +3 -1
- data/lib/bundler/plugin.rb +23 -6
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +7 -0
- data/lib/bundler/resolver/spec_group.rb +1 -1
- data/lib/bundler/resolver.rb +38 -40
- data/lib/bundler/ruby_version.rb +1 -1
- data/lib/bundler/rubygems_ext.rb +19 -10
- data/lib/bundler/rubygems_gem_installer.rb +21 -5
- data/lib/bundler/rubygems_integration.rb +40 -70
- data/lib/bundler/runtime.rb +2 -2
- data/lib/bundler/self_manager.rb +168 -0
- data/lib/bundler/settings.rb +11 -2
- data/lib/bundler/shared_helpers.rb +4 -12
- data/lib/bundler/source/git/git_proxy.rb +7 -4
- data/lib/bundler/source/git.rb +22 -4
- data/lib/bundler/source/metadata.rb +1 -1
- data/lib/bundler/source/rubygems.rb +60 -85
- data/lib/bundler/source/rubygems_aggregate.rb +1 -1
- data/lib/bundler/source.rb +3 -1
- data/lib/bundler/source_list.rb +11 -29
- data/lib/bundler/spec_set.rb +2 -2
- data/lib/bundler/templates/Executable.bundler +1 -1
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/gems.rb +0 -3
- data/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/lib/bundler/templates/newgem/Rakefile.tt +15 -2
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +4 -3
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +15 -15
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/lib/bundler/ui/shell.rb +1 -1
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +57 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +39 -74
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/molinillo/LICENSE +9 -0
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- data/lib/bundler/vendored_tsort.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/lib/bundler/worker.rb +2 -2
- data/lib/bundler.rb +23 -22
- metadata +25 -10
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/psyched_yaml.rb +0 -22
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
data/lib/bundler/cli/issue.rb
CHANGED
@@ -20,9 +20,10 @@ module Bundler
|
|
20
20
|
|
21
21
|
Hopefully the troubleshooting steps above resolved your problem! If things
|
22
22
|
still aren't working the way you expect them to, please let us know so
|
23
|
-
that we can diagnose and help fix the problem you're having
|
24
|
-
|
25
|
-
https://github.com/rubygems/rubygems/
|
23
|
+
that we can diagnose and help fix the problem you're having, by filling
|
24
|
+
in the new issue form located at
|
25
|
+
https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md,
|
26
|
+
and copy and pasting the information below.
|
26
27
|
|
27
28
|
EOS
|
28
29
|
|
data/lib/bundler/cli/platform.rb
CHANGED
@@ -23,7 +23,7 @@ module Bundler
|
|
23
23
|
output << "No ruby version specified"
|
24
24
|
end
|
25
25
|
else
|
26
|
-
output << "Your platform is: #{
|
26
|
+
output << "Your platform is: #{Gem::Platform.local}"
|
27
27
|
output << "Your app has gems that work on these platforms:\n#{platforms.join("\n")}"
|
28
28
|
|
29
29
|
if ruby_version
|
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
@@ -11,12 +11,16 @@ module Bundler
|
|
11
11
|
def run
|
12
12
|
Bundler.ui.level = "warn" if options[:quiet]
|
13
13
|
|
14
|
+
update_bundler = options[:bundler]
|
15
|
+
|
16
|
+
Bundler.self_manager.update_bundler_and_restart_with_it_if_needed(update_bundler) if update_bundler
|
17
|
+
|
14
18
|
Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins?
|
15
19
|
|
16
20
|
sources = Array(options[:source])
|
17
21
|
groups = Array(options[:group]).map(&:to_sym)
|
18
22
|
|
19
|
-
full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !
|
23
|
+
full_update = gems.empty? && sources.empty? && groups.empty? && !options[:ruby] && !update_bundler
|
20
24
|
|
21
25
|
if full_update && !options[:all]
|
22
26
|
if Bundler.feature_flag.update_requires_all_flag?
|
@@ -49,7 +53,7 @@ module Bundler
|
|
49
53
|
|
50
54
|
Bundler.definition(:gems => gems, :sources => sources, :ruby => options[:ruby],
|
51
55
|
:conservative => conservative,
|
52
|
-
:bundler =>
|
56
|
+
:bundler => update_bundler)
|
53
57
|
end
|
54
58
|
|
55
59
|
Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
|
@@ -66,7 +70,7 @@ module Bundler
|
|
66
70
|
|
67
71
|
if locked_gems = Bundler.definition.locked_gems
|
68
72
|
previous_locked_info = locked_gems.specs.reduce({}) do |h, s|
|
69
|
-
h[s.name] = { :spec => s, :version => s.version, :source => s.source.
|
73
|
+
h[s.name] = { :spec => s, :version => s.version, :source => s.source.identifier }
|
70
74
|
h
|
71
75
|
end
|
72
76
|
end
|
@@ -95,7 +99,7 @@ module Bundler
|
|
95
99
|
end
|
96
100
|
|
97
101
|
locked_source = locked_info[:source]
|
98
|
-
new_source = new_spec.source.
|
102
|
+
new_source = new_spec.source.identifier
|
99
103
|
next if locked_source != new_source
|
100
104
|
|
101
105
|
new_version = new_spec.version
|
data/lib/bundler/cli.rb
CHANGED
@@ -61,6 +61,8 @@ module Bundler
|
|
61
61
|
Bundler.reset_settings_and_root!
|
62
62
|
end
|
63
63
|
|
64
|
+
Bundler.self_manager.restart_with_locked_bundler_if_needed
|
65
|
+
|
64
66
|
Bundler.settings.set_command_option_if_given :retry, options[:retry]
|
65
67
|
|
66
68
|
current_cmd = args.last[:current_command].name
|
@@ -184,6 +186,7 @@ module Bundler
|
|
184
186
|
method_option "install", :type => :boolean, :banner =>
|
185
187
|
"Runs 'bundle install' after removing the gems from the Gemfile"
|
186
188
|
def remove(*gems)
|
189
|
+
SharedHelpers.major_deprecation(2, "The `--install` flag has been deprecated. `bundle install` is triggered by default.") if ARGV.include?("--install")
|
187
190
|
require_relative "cli/remove"
|
188
191
|
Remove.new(gems, options).run
|
189
192
|
end
|
@@ -330,6 +333,7 @@ module Bundler
|
|
330
333
|
|
331
334
|
desc "info GEM [OPTIONS]", "Show information for the given gem"
|
332
335
|
method_option "path", :type => :boolean, :banner => "Print full path to gem"
|
336
|
+
method_option "version", :type => :boolean, :banner => "Print gem version"
|
333
337
|
def info(gem_name)
|
334
338
|
require_relative "cli/info"
|
335
339
|
Info.new(options, gem_name).run
|
@@ -365,8 +369,11 @@ module Bundler
|
|
365
369
|
method_option "version", :aliases => "-v", :type => :string
|
366
370
|
method_option "group", :aliases => "-g", :type => :string
|
367
371
|
method_option "source", :aliases => "-s", :type => :string
|
372
|
+
method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string."
|
368
373
|
method_option "git", :type => :string
|
374
|
+
method_option "github", :type => :string
|
369
375
|
method_option "branch", :type => :string
|
376
|
+
method_option "ref", :type => :string
|
370
377
|
method_option "skip-install", :type => :boolean, :banner =>
|
371
378
|
"Adds gem to the Gemfile but does not install it"
|
372
379
|
method_option "optimistic", :type => :boolean, :banner => "Adds optimistic declaration of version to gem"
|
@@ -551,7 +558,7 @@ module Bundler
|
|
551
558
|
method_option :version, :type => :boolean, :default => false, :aliases => "-v", :desc => "Set to show each gem version."
|
552
559
|
method_option :without, :type => :array, :default => [], :aliases => "-W", :banner => "GROUP[ GROUP...]", :desc => "Exclude gems that are part of the specified named group."
|
553
560
|
def viz
|
554
|
-
SharedHelpers.major_deprecation 2, "The `viz` command has been
|
561
|
+
SharedHelpers.major_deprecation 2, "The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph"
|
555
562
|
require_relative "cli/viz"
|
556
563
|
Viz.new(options.dup).run
|
557
564
|
end
|
@@ -574,6 +581,8 @@ module Bundler
|
|
574
581
|
:desc => "Generate a test directory for your library, either rspec, minitest or test-unit. Set a default with `bundle config set --global gem.test (rspec|minitest|test-unit)`."
|
575
582
|
method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
|
576
583
|
:desc => "Generate CI configuration, either GitHub Actions, Travis CI, GitLab CI or CircleCI. Set a default with `bundle config set --global gem.ci (github|travis|gitlab|circle)`"
|
584
|
+
method_option :linter, :type => :string, :lazy_default => Bundler.settings["gem.linter"] || "",
|
585
|
+
:desc => "Add a linter and code formatter, either RuboCop or Standard. Set a default with `bundle config set --global gem.linter (rubocop|standard)`"
|
577
586
|
method_option :github_username, :type => :string, :default => Bundler.settings["gem.github_username"], :banner => "Set your username on GitHub", :desc => "Fill in GitHub username on README so that you don't have to do it manually. Set a default with `bundle config set --global gem.github_username <your_username>`."
|
578
587
|
|
579
588
|
def gem(name)
|
@@ -800,17 +809,10 @@ module Bundler
|
|
800
809
|
|
801
810
|
current = Gem::Version.new(VERSION)
|
802
811
|
return if current >= latest
|
803
|
-
latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max
|
804
|
-
|
805
|
-
installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
|
806
|
-
if latest_installed && latest_installed > current
|
807
|
-
suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
|
808
|
-
suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
|
809
|
-
else
|
810
|
-
suggestion = installation
|
811
|
-
end
|
812
812
|
|
813
|
-
Bundler.ui.warn
|
813
|
+
Bundler.ui.warn \
|
814
|
+
"The latest bundler is #{latest}, but you are currently running #{current}.\n" \
|
815
|
+
"To update to the most recent version, run `bundle update --bundler`"
|
814
816
|
rescue RuntimeError
|
815
817
|
nil
|
816
818
|
end
|
@@ -76,15 +76,6 @@ module Bundler
|
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
def specific_dependency(name, version, platform)
|
80
|
-
pattern = [version, platform].compact.join("-")
|
81
|
-
return nil if pattern.empty?
|
82
|
-
|
83
|
-
gem_lines = info_path(name).read
|
84
|
-
gem_line = gem_lines[/^#{Regexp.escape(pattern)}\b.*/, 0]
|
85
|
-
gem_line ? parse_gem(gem_line) : nil
|
86
|
-
end
|
87
|
-
|
88
79
|
private
|
89
80
|
|
90
81
|
def lines(path)
|
@@ -76,11 +76,6 @@ module Bundler
|
|
76
76
|
|
77
77
|
update(local_path, remote_path, :retrying)
|
78
78
|
end
|
79
|
-
rescue Errno::EACCES
|
80
|
-
raise Bundler::PermissionError,
|
81
|
-
"Bundler does not have write access to create a temp directory " \
|
82
|
-
"within #{Dir.tmpdir}. Bundler must have write access to your " \
|
83
|
-
"systems temp directory to function properly. "
|
84
79
|
rescue Zlib::GzipFile::Error
|
85
80
|
raise Bundler::HTTPError
|
86
81
|
end
|
@@ -5,7 +5,7 @@ require "set"
|
|
5
5
|
|
6
6
|
module Bundler
|
7
7
|
class CompactIndexClient
|
8
|
-
DEBUG_MUTEX = Mutex.new
|
8
|
+
DEBUG_MUTEX = Thread::Mutex.new
|
9
9
|
def self.debug
|
10
10
|
return unless ENV["DEBUG_COMPACT_INDEX"]
|
11
11
|
DEBUG_MUTEX.synchronize { warn("[#{self}] #{yield}") }
|
@@ -25,7 +25,7 @@ module Bundler
|
|
25
25
|
@endpoints = Set.new
|
26
26
|
@info_checksums_by_name = {}
|
27
27
|
@parsed_checksums = false
|
28
|
-
@mutex = Mutex.new
|
28
|
+
@mutex = Thread::Mutex.new
|
29
29
|
end
|
30
30
|
|
31
31
|
def execution_mode=(block)
|
@@ -73,12 +73,6 @@ module Bundler
|
|
73
73
|
end.flatten(1)
|
74
74
|
end
|
75
75
|
|
76
|
-
def spec(name, version, platform = nil)
|
77
|
-
Bundler::CompactIndexClient.debug { "spec(name = #{name}, version = #{version}, platform = #{platform})" }
|
78
|
-
update_info(name)
|
79
|
-
@cache.specific_dependency(name, version, platform)
|
80
|
-
end
|
81
|
-
|
82
76
|
def update_and_parse_checksums!
|
83
77
|
Bundler::CompactIndexClient.debug { "update_and_parse_checksums!" }
|
84
78
|
return @info_checksums_by_name if @parsed_checksums
|
data/lib/bundler/definition.rb
CHANGED
@@ -6,6 +6,11 @@ module Bundler
|
|
6
6
|
class Definition
|
7
7
|
include GemHelpers
|
8
8
|
|
9
|
+
class << self
|
10
|
+
# Do not create or modify a lockfile (Makes #lock a noop)
|
11
|
+
attr_accessor :no_lock
|
12
|
+
end
|
13
|
+
|
9
14
|
attr_reader(
|
10
15
|
:dependencies,
|
11
16
|
:locked_deps,
|
@@ -73,7 +78,6 @@ module Bundler
|
|
73
78
|
@lockfile_contents = String.new
|
74
79
|
@locked_bundler_version = nil
|
75
80
|
@locked_ruby_version = nil
|
76
|
-
@locked_specs_incomplete_for_platform = false
|
77
81
|
@new_platform = nil
|
78
82
|
|
79
83
|
if lockfile && File.exist?(lockfile)
|
@@ -139,6 +143,8 @@ module Bundler
|
|
139
143
|
@dependency_changes = converge_dependencies
|
140
144
|
@local_changes = converge_locals
|
141
145
|
|
146
|
+
@locked_specs_incomplete_for_platform = !@locked_specs.for(requested_dependencies & expand_dependencies(locked_dependencies), true, true)
|
147
|
+
|
142
148
|
@requires = compute_requires
|
143
149
|
end
|
144
150
|
|
@@ -157,8 +163,10 @@ module Bundler
|
|
157
163
|
end
|
158
164
|
end
|
159
165
|
|
160
|
-
def
|
161
|
-
@
|
166
|
+
def resolve_only_locally!
|
167
|
+
@remote = false
|
168
|
+
sources.local_only!
|
169
|
+
resolve
|
162
170
|
end
|
163
171
|
|
164
172
|
def resolve_with_cache!
|
@@ -222,17 +230,22 @@ module Bundler
|
|
222
230
|
end
|
223
231
|
end
|
224
232
|
|
233
|
+
def locked_dependencies
|
234
|
+
@locked_deps.values
|
235
|
+
end
|
236
|
+
|
225
237
|
def specs_for(groups)
|
226
|
-
|
238
|
+
return specs if groups.empty?
|
227
239
|
deps = dependencies_for(groups)
|
228
|
-
materialize(
|
240
|
+
materialize(deps)
|
229
241
|
end
|
230
242
|
|
231
243
|
def dependencies_for(groups)
|
232
244
|
groups.map!(&:to_sym)
|
233
|
-
current_dependencies.reject do |d|
|
245
|
+
deps = current_dependencies.reject do |d|
|
234
246
|
(d.groups & groups).empty?
|
235
247
|
end
|
248
|
+
expand_dependencies(deps)
|
236
249
|
end
|
237
250
|
|
238
251
|
# Resolve all the dependencies specified in Gemfile. It ensures that
|
@@ -252,7 +265,7 @@ module Bundler
|
|
252
265
|
else
|
253
266
|
# Run a resolve against the locally available gems
|
254
267
|
Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
|
255
|
-
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies,
|
268
|
+
expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
|
256
269
|
Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
|
257
270
|
end
|
258
271
|
end
|
@@ -267,6 +280,8 @@ module Bundler
|
|
267
280
|
end
|
268
281
|
|
269
282
|
def lock(file, preserve_unknown_sections = false)
|
283
|
+
return if Definition.no_lock
|
284
|
+
|
270
285
|
contents = to_lock
|
271
286
|
|
272
287
|
# Convert to \r\n if the existing lock has them
|
@@ -277,10 +292,7 @@ module Bundler
|
|
277
292
|
locked_major = @locked_bundler_version.segments.first
|
278
293
|
current_major = Gem::Version.create(Bundler::VERSION).segments.first
|
279
294
|
|
280
|
-
|
281
|
-
Bundler.ui.warn "Warning: the lockfile is being updated to Bundler #{current_major}, " \
|
282
|
-
"after which you will be unable to return to Bundler #{@locked_bundler_version.segments.first}."
|
283
|
-
end
|
295
|
+
updating_major = locked_major < current_major
|
284
296
|
end
|
285
297
|
|
286
298
|
preserve_unknown_sections ||= !updating_major && (Bundler.frozen_bundle? || !(unlocking? || @unlocking_bundler))
|
@@ -297,14 +309,6 @@ module Bundler
|
|
297
309
|
end
|
298
310
|
end
|
299
311
|
|
300
|
-
def locked_bundler_version
|
301
|
-
if @locked_bundler_version && @locked_bundler_version < Gem::Version.new(Bundler::VERSION)
|
302
|
-
new_version = Bundler::VERSION
|
303
|
-
end
|
304
|
-
|
305
|
-
new_version || @locked_bundler_version || Bundler::VERSION
|
306
|
-
end
|
307
|
-
|
308
312
|
def locked_ruby_version
|
309
313
|
return unless ruby_version
|
310
314
|
if @unlock[:ruby] || !@locked_ruby_version
|
@@ -356,44 +360,31 @@ module Bundler
|
|
356
360
|
added.concat new_platforms.map {|p| "* platform: #{p}" }
|
357
361
|
deleted.concat deleted_platforms.map {|p| "* platform: #{p}" }
|
358
362
|
|
359
|
-
|
363
|
+
new_deps = @dependencies - locked_dependencies
|
364
|
+
deleted_deps = locked_dependencies - @dependencies
|
360
365
|
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
new_deps = @dependencies - @locked_deps.values
|
365
|
-
deleted_deps = @locked_deps.values - @dependencies
|
366
|
+
added.concat new_deps.map {|d| "* #{pretty_dep(d)}" } if new_deps.any?
|
367
|
+
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" } if deleted_deps.any?
|
366
368
|
|
367
|
-
|
368
|
-
|
369
|
-
new_sources.reject! {|source| (source.path? && source.path.exist?) || equivalent_rubygems_remotes?(source) }
|
370
|
-
deleted_sources.reject! {|source| (source.path? && source.path.exist?) || equivalent_rubygems_remotes?(source) }
|
371
|
-
end
|
369
|
+
both_sources = Hash.new {|h, k| h[k] = [] }
|
370
|
+
@dependencies.each {|d| both_sources[d.name][0] = d }
|
372
371
|
|
373
|
-
|
374
|
-
if
|
375
|
-
added.concat new_sources.map {|source| "* source: #{source}" }
|
376
|
-
end
|
372
|
+
locked_dependencies.each do |d|
|
373
|
+
next if !Bundler.feature_flag.bundler_3_mode? && @locked_specs[d.name].empty?
|
377
374
|
|
378
|
-
|
379
|
-
deleted.concat deleted_sources.map {|source| "* source: #{source}" }
|
380
|
-
end
|
375
|
+
both_sources[d.name][1] = d
|
381
376
|
end
|
382
377
|
|
383
|
-
|
384
|
-
|
385
|
-
deleted.concat deleted_deps.map {|d| "* #{pretty_dep(d)}" }
|
386
|
-
end
|
378
|
+
both_sources.each do |name, (dep, lock_dep)|
|
379
|
+
next if dep.nil? || lock_dep.nil?
|
387
380
|
|
388
|
-
|
389
|
-
|
390
|
-
|
381
|
+
gemfile_source = dep.source || sources.default_source
|
382
|
+
lock_source = lock_dep.source || sources.default_source
|
383
|
+
next if lock_source.include?(gemfile_source)
|
391
384
|
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
lockfile_source_name = lock_source
|
396
|
-
changed << "* #{name} from `#{gemfile_source_name}` to `#{lockfile_source_name}`"
|
385
|
+
gemfile_source_name = dep.source ? gemfile_source.identifier : "no specified source"
|
386
|
+
lockfile_source_name = lock_dep.source ? lock_source.identifier : "no specified source"
|
387
|
+
changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`"
|
397
388
|
end
|
398
389
|
|
399
390
|
reason = change_reason
|
@@ -504,6 +495,7 @@ module Bundler
|
|
504
495
|
|
505
496
|
def current_ruby_platform_locked?
|
506
497
|
return false unless generic_local_platform == Gem::Platform::RUBY
|
498
|
+
return false if Bundler.settings[:force_ruby_platform] && !@platforms.include?(Gem::Platform::RUBY)
|
507
499
|
|
508
500
|
current_platform_locked?
|
509
501
|
end
|
@@ -554,7 +546,7 @@ module Bundler
|
|
554
546
|
|
555
547
|
def dependencies_for_source_changed?(source, locked_source = source)
|
556
548
|
deps_for_source = @dependencies.select {|s| s.source == source }
|
557
|
-
locked_deps_for_source =
|
549
|
+
locked_deps_for_source = locked_dependencies.select {|dep| dep.source == locked_source }
|
558
550
|
|
559
551
|
deps_for_source.uniq.sort != locked_deps_for_source.sort
|
560
552
|
end
|
@@ -637,25 +629,14 @@ module Bundler
|
|
637
629
|
end
|
638
630
|
|
639
631
|
def converge_dependencies
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
# after locked_source and sources don't match, we still use locked_source.
|
645
|
-
if frozen && !locked_source.nil? &&
|
646
|
-
locked_source.respond_to?(:source) && locked_source.source.instance_of?(Source::Path) && locked_source.source.path.exist?
|
647
|
-
dep.source = locked_source.source
|
648
|
-
elsif dep.source
|
632
|
+
changes = false
|
633
|
+
|
634
|
+
@dependencies.each do |dep|
|
635
|
+
if dep.source
|
649
636
|
dep.source = sources.get(dep.source)
|
650
637
|
end
|
651
|
-
end
|
652
638
|
|
653
|
-
|
654
|
-
# We want to know if all match, but don't want to check all entries
|
655
|
-
# This means we need to return false if any dependency doesn't match
|
656
|
-
# the lock or doesn't exist in the lock.
|
657
|
-
@dependencies.each do |dependency|
|
658
|
-
unless locked_dep = @locked_deps[dependency.name]
|
639
|
+
unless locked_dep = @locked_deps[dep.name]
|
659
640
|
changes = true
|
660
641
|
next
|
661
642
|
end
|
@@ -666,11 +647,11 @@ module Bundler
|
|
666
647
|
# directive, the lockfile dependencies and resolved dependencies end up
|
667
648
|
# with a mismatch on #type. Work around that by setting the type on the
|
668
649
|
# dep from the lockfile.
|
669
|
-
locked_dep.instance_variable_set(:@type,
|
650
|
+
locked_dep.instance_variable_set(:@type, dep.type)
|
670
651
|
|
671
652
|
# We already know the name matches from the hash lookup
|
672
653
|
# so we only need to check the requirement now
|
673
|
-
changes ||=
|
654
|
+
changes ||= dep.requirement != locked_dep.requirement
|
674
655
|
end
|
675
656
|
|
676
657
|
changes
|
@@ -680,39 +661,36 @@ module Bundler
|
|
680
661
|
# commonly happen if the Gemfile has changed since the lockfile was last
|
681
662
|
# generated
|
682
663
|
def converge_locked_specs
|
683
|
-
|
684
|
-
|
685
|
-
# Build a list of dependencies that are the same in the Gemfile
|
686
|
-
# and Gemfile.lock. If the Gemfile modified a dependency, but
|
687
|
-
# the gem in the Gemfile.lock still satisfies it, this is fine
|
688
|
-
# too.
|
689
|
-
@dependencies.each do |dep|
|
690
|
-
locked_dep = @locked_deps[dep.name]
|
664
|
+
resolve = converge_specs(@locked_specs)
|
691
665
|
|
692
|
-
|
693
|
-
locked_dep = nil unless locked_dep == dep
|
666
|
+
diff = nil
|
694
667
|
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
@locked_specs.each do |s|
|
699
|
-
@unlock[:gems] << s.name if s.source == dep.source
|
700
|
-
end
|
668
|
+
# Now, we unlock any sources that do not have anymore gems pinned to it
|
669
|
+
sources.all_sources.each do |source|
|
670
|
+
next unless source.respond_to?(:unlock!)
|
701
671
|
|
702
|
-
|
703
|
-
|
672
|
+
unless resolve.any? {|s| s.source == source }
|
673
|
+
diff ||= @locked_specs.to_a - resolve.to_a
|
674
|
+
source.unlock! if diff.any? {|s| s.source == source }
|
704
675
|
end
|
705
676
|
end
|
706
677
|
|
678
|
+
resolve
|
679
|
+
end
|
680
|
+
|
681
|
+
def converge_specs(specs)
|
682
|
+
deps = []
|
707
683
|
converged = []
|
708
|
-
|
684
|
+
specs.each do |s|
|
709
685
|
# Replace the locked dependency's source with the equivalent source from the Gemfile
|
710
686
|
dep = @dependencies.find {|d| s.satisfies?(d) }
|
711
|
-
s.source = (dep && dep.source) || sources.get(s.source) unless multisource_allowed?
|
712
687
|
|
713
|
-
|
714
|
-
|
715
|
-
|
688
|
+
if dep && (!dep.source || s.source.include?(dep.source))
|
689
|
+
deps << dep
|
690
|
+
end
|
691
|
+
|
692
|
+
s.source = (dep && dep.source) || sources.get(s.source) || sources.default_source unless Bundler.frozen_bundle?
|
693
|
+
|
716
694
|
next if @unlock[:sources].include?(s.source.name)
|
717
695
|
|
718
696
|
# If the spec is from a path source and it doesn't exist anymore
|
@@ -725,7 +703,7 @@ module Bundler
|
|
725
703
|
rescue PathError, GitError
|
726
704
|
# if we won't need the source (according to the lockfile),
|
727
705
|
# don't error if the path/git source isn't available
|
728
|
-
next if
|
706
|
+
next if specs.
|
729
707
|
for(requested_dependencies, false, true).
|
730
708
|
none? {|locked_spec| locked_spec.source == s.source }
|
731
709
|
|
@@ -741,36 +719,15 @@ module Bundler
|
|
741
719
|
s.dependencies.replace(new_spec.dependencies)
|
742
720
|
end
|
743
721
|
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
@locked_specs_incomplete_for_platform = !resolve.for(expand_dependencies(requested_dependencies & deps), true, true)
|
749
|
-
resolve = SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
|
750
|
-
diff = nil
|
751
|
-
|
752
|
-
# Now, we unlock any sources that do not have anymore gems pinned to it
|
753
|
-
sources.all_sources.each do |source|
|
754
|
-
next unless source.respond_to?(:unlock!)
|
755
|
-
|
756
|
-
unless resolve.any? {|s| s.source == source }
|
757
|
-
diff ||= @locked_specs.to_a - resolve.to_a
|
758
|
-
source.unlock! if diff.any? {|s| s.source == source }
|
722
|
+
if dep.nil? && requested_dependencies.find {|d| s.name == d.name }
|
723
|
+
@unlock[:gems] << s.name
|
724
|
+
else
|
725
|
+
converged << s
|
759
726
|
end
|
760
727
|
end
|
761
728
|
|
762
|
-
resolve
|
763
|
-
|
764
|
-
|
765
|
-
def in_locked_deps?(dep, locked_dep)
|
766
|
-
# Because the lockfile can't link a dep to a specific remote, we need to
|
767
|
-
# treat sources as equivalent anytime the locked dep has all the remotes
|
768
|
-
# that the Gemfile dep does.
|
769
|
-
locked_dep && locked_dep.source && dep.source && locked_dep.source.include?(dep.source)
|
770
|
-
end
|
771
|
-
|
772
|
-
def satisfies_locked_spec?(dep)
|
773
|
-
@locked_specs[dep].any? {|s| s.satisfies?(dep) && (!dep.source || s.source.include?(dep.source)) }
|
729
|
+
resolve = SpecSet.new(converged)
|
730
|
+
SpecSet.new(resolve.for(expand_dependencies(deps, true), false, false).reject{|s| @unlock[:gems].include?(s.name) })
|
774
731
|
end
|
775
732
|
|
776
733
|
def metadata_dependencies
|
@@ -863,22 +820,11 @@ module Bundler
|
|
863
820
|
|
864
821
|
def additional_base_requirements_for_resolve
|
865
822
|
return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
|
866
|
-
|
867
|
-
@locked_gems.specs.reduce({}) do |requirements, locked_spec|
|
823
|
+
converge_specs(@locked_gems.specs).map do |locked_spec|
|
868
824
|
name = locked_spec.name
|
869
|
-
dependency = dependencies_by_name[name]
|
870
|
-
next requirements if @locked_gems.dependencies[name] != dependency
|
871
|
-
next requirements if dependency && dependency.source.is_a?(Source::Path)
|
872
825
|
dep = Gem::Dependency.new(name, ">= #{locked_spec.version}")
|
873
|
-
|
874
|
-
|
875
|
-
end.values
|
876
|
-
end
|
877
|
-
|
878
|
-
def equivalent_rubygems_remotes?(source)
|
879
|
-
return false unless source.is_a?(Source::Rubygems)
|
880
|
-
|
881
|
-
Bundler.settings[:allow_deployment_source_credential_changes] && source.equivalent_remotes?(sources.rubygems_remotes)
|
826
|
+
DepProxy.get_proxy(dep, locked_spec.platform)
|
827
|
+
end
|
882
828
|
end
|
883
829
|
|
884
830
|
def source_map
|
data/lib/bundler/dependency.rb
CHANGED
@@ -7,7 +7,7 @@ require_relative "rubygems_ext"
|
|
7
7
|
module Bundler
|
8
8
|
class Dependency < Gem::Dependency
|
9
9
|
attr_reader :autorequire
|
10
|
-
attr_reader :groups, :platforms, :gemfile, :git, :branch
|
10
|
+
attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref
|
11
11
|
|
12
12
|
PLATFORM_MAP = {
|
13
13
|
:ruby => Gem::Platform::RUBY,
|
@@ -82,7 +82,9 @@ module Bundler
|
|
82
82
|
@groups = Array(options["group"] || :default).map(&:to_sym)
|
83
83
|
@source = options["source"]
|
84
84
|
@git = options["git"]
|
85
|
+
@github = options["github"]
|
85
86
|
@branch = options["branch"]
|
87
|
+
@ref = options["ref"]
|
86
88
|
@platforms = Array(options["platforms"])
|
87
89
|
@env = options["env"]
|
88
90
|
@should_include = options.fetch("should_include", true)
|
@@ -96,15 +98,11 @@ module Bundler
|
|
96
98
|
def gem_platforms(valid_platforms)
|
97
99
|
return valid_platforms if @platforms.empty?
|
98
100
|
|
99
|
-
|
100
|
-
@gem_platforms ||= expanded_platforms.compact.uniq
|
101
|
-
|
102
|
-
filtered_generic_platforms = valid_generic_platforms.values & @gem_platforms
|
103
|
-
valid_generic_platforms.select {|_, v| filtered_generic_platforms.include?(v) }.keys
|
101
|
+
valid_platforms.select {|p| expanded_platforms.include?(GemHelpers.generic(p)) }
|
104
102
|
end
|
105
103
|
|
106
104
|
def expanded_platforms
|
107
|
-
@platforms.map {|pl| PLATFORM_MAP[pl] }
|
105
|
+
@expanded_platforms ||= @platforms.map {|pl| PLATFORM_MAP[pl] }.compact.uniq
|
108
106
|
end
|
109
107
|
|
110
108
|
def should_include?
|