bundler 2.2.10 → 2.2.15

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb87c09a270f3caca4d4719878b6c807b173016a786dbf5b067b44cf3e61b37d
4
- data.tar.gz: 9c31e5c7673789aedd7515d6f54479095da5ecdc0e6fba3b4c2a6f636c21b30f
3
+ metadata.gz: 7969bf6c1c6e781cd3d6f06c9d832cc7604c9304ed19da98e52744f1ea22dac9
4
+ data.tar.gz: c4d0c758c8d71ad5de08b2ac6bfec61306e276dda94505a2942dc68657769571
5
5
  SHA512:
6
- metadata.gz: 218d6753e8980cfd447332d0c19c1ef0d07ba25b9ee0260cf6290d493063c24ea377d9241d52a145737ee8ac6ee4cd127351b4356076d114778f3a8c8fb5987b
7
- data.tar.gz: 858d23190b365f75b923b4f5608bea65206e9aadc842cfaa04190d6d9d452212da5f857f0474f35a474448de246ef3d34a70de8d6d476ad095457148ceeb3bd2
6
+ metadata.gz: ed31592d981989e540c694657fdf663e4a53a8c635e797d5f85b1240f80dcefa30433e926459235d5614c42da2081c6a45304eeacb0f1bec963e4ab64702e19e
7
+ data.tar.gz: 6381ced4711505050ef620d25d9a6d693a98c70f2fd667d6e7ac506ade25ddbc9909d16e0715cbfeacb7cc07e1cd2a1655d48c91844d214bfd66a502f68b0072
data/CHANGELOG.md CHANGED
@@ -1,3 +1,49 @@
1
+ # 2.2.15 (March 18, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Add a hint about bundler installing executables for path gems [#4461](https://github.com/rubygems/rubygems/pull/4461)
6
+ - Warn lockfiles with incorrect resolutions [#4459](https://github.com/rubygems/rubygems/pull/4459)
7
+ - Don't generate duplicate redundant sources in the lockfile [#4456](https://github.com/rubygems/rubygems/pull/4456)
8
+
9
+ ## Bug fixes:
10
+
11
+ - Respect running ruby when resolving platforms [#4449](https://github.com/rubygems/rubygems/pull/4449)
12
+
13
+ # 2.2.14 (March 8, 2021)
14
+
15
+ ## Security fixes:
16
+
17
+ - Lock GEM sources separately and fix locally installed specs confusing bundler [#4381](https://github.com/rubygems/rubygems/pull/4381)
18
+
19
+ ## Bug fixes:
20
+
21
+ - Make `rake` available to other gems' installers right after it's installed [#4428](https://github.com/rubygems/rubygems/pull/4428)
22
+ - Fix encoding issue on compact index updater [#4362](https://github.com/rubygems/rubygems/pull/4362)
23
+
24
+ # 2.2.13 (March 3, 2021)
25
+
26
+ ## Enhancements:
27
+
28
+ - Respect user configured default branch in README links in new generated gems [#4303](https://github.com/rubygems/rubygems/pull/4303)
29
+
30
+ ## Bug fixes:
31
+
32
+ - Fix gems sometimes being pulled from irrelevant sources [#4418](https://github.com/rubygems/rubygems/pull/4418)
33
+
34
+ # 2.2.12 (March 1, 2021)
35
+
36
+ ## Bug fixes:
37
+
38
+ - Fix sporadic warnings about `nil` gemspec on install/update and make those faster [#4409](https://github.com/rubygems/rubygems/pull/4409)
39
+ - Fix deployment install with duplicate path gems added to Gemfile [#4410](https://github.com/rubygems/rubygems/pull/4410)
40
+
41
+ # 2.2.11 (February 17, 2021)
42
+
43
+ ## Bug fixes:
44
+
45
+ - Revert disable_multisource changes [#4385](https://github.com/rubygems/rubygems/pull/4385)
46
+
1
47
  # 2.2.10 (February 15, 2021)
2
48
 
3
49
  ## Security 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-02-15".freeze
8
- @git_commit_sha = "cc7c333721".freeze
7
+ @built_at = "2021-03-19".freeze
8
+ @git_commit_sha = "3dbcc68293".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -39,11 +39,11 @@ module Bundler
39
39
  constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
40
40
  constant_array = constant_name.split("::")
41
41
 
42
- git_installed = Bundler.git_present?
42
+ use_git = Bundler.git_present? && options[:git]
43
43
 
44
- git_author_name = git_installed ? `git config user.name`.chomp : ""
45
- github_username = git_installed ? `git config github.user`.chomp : ""
46
- git_user_email = git_installed ? `git config user.email`.chomp : ""
44
+ git_author_name = use_git ? `git config user.name`.chomp : ""
45
+ github_username = use_git ? `git config github.user`.chomp : ""
46
+ git_user_email = use_git ? `git config user.email`.chomp : ""
47
47
 
48
48
  config = {
49
49
  :name => name,
@@ -58,6 +58,7 @@ module Bundler
58
58
  :ext => options[:ext],
59
59
  :exe => options[:exe],
60
60
  :bundler_version => bundler_dependency_version,
61
+ :git => use_git,
61
62
  :github_username => github_username.empty? ? "[USERNAME]" : github_username,
62
63
  :required_ruby_version => Gem.ruby_version < Gem::Version.new("2.4.a") ? "2.3.0" : "2.4.0",
63
64
  }
@@ -79,7 +80,7 @@ module Bundler
79
80
  bin/setup
80
81
  ]
81
82
 
82
- templates.merge!("gitignore.tt" => ".gitignore") if Bundler.git_present?
83
+ templates.merge!("gitignore.tt" => ".gitignore") if use_git
83
84
 
84
85
  if test_framework = ask_and_set_test_framework
85
86
  config[:test] = test_framework
@@ -175,24 +176,31 @@ module Bundler
175
176
  )
176
177
  end
177
178
 
179
+ if File.exist?(target) && !File.directory?(target)
180
+ Bundler.ui.error "Couldn't create a new gem named `#{gem_name}` because there's an existing file named `#{gem_name}`."
181
+ exit Bundler::BundlerError.all_errors[Bundler::GenericSystemCallError]
182
+ end
183
+
184
+ if use_git
185
+ Bundler.ui.info "Initializing git repo in #{target}"
186
+ `git init #{target}`
187
+
188
+ config[:git_default_branch] = File.read("#{target}/.git/HEAD").split("/").last.chomp
189
+ end
190
+
178
191
  templates.each do |src, dst|
179
192
  destination = target.join(dst)
180
- SharedHelpers.filesystem_access(destination) do
181
- thor.template("newgem/#{src}", destination, config)
182
- end
193
+ thor.template("newgem/#{src}", destination, config)
183
194
  end
184
195
 
185
196
  executables.each do |file|
186
- SharedHelpers.filesystem_access(target.join(file)) do |path|
187
- executable = (path.stat.mode | 0o111)
188
- path.chmod(executable)
189
- end
197
+ path = target.join(file)
198
+ executable = (path.stat.mode | 0o111)
199
+ path.chmod(executable)
190
200
  end
191
201
 
192
- if Bundler.git_present? && options[:git]
193
- Bundler.ui.info "Initializing git repo in #{target}"
202
+ if use_git
194
203
  Dir.chdir(target) do
195
- `git init`
196
204
  `git add .`
197
205
  end
198
206
  end
@@ -202,8 +210,6 @@ module Bundler
202
210
 
203
211
  Bundler.ui.info "Gem '#{name}' was successfully created. " \
204
212
  "For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html"
205
- rescue Errno::EEXIST => e
206
- raise GenericSystemCallError.new(e, "There was a conflict while creating the new gem.")
207
213
  end
208
214
 
209
215
  private
@@ -54,7 +54,7 @@ module Bundler
54
54
  if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
55
55
  local_temp_path.open("a") {|f| f << slice_body(content, 1..-1) }
56
56
  else
57
- local_temp_path.open("w") {|f| f << content }
57
+ local_temp_path.open("wb") {|f| f << content }
58
58
  end
59
59
  end
60
60
 
@@ -107,16 +107,14 @@ module Bundler
107
107
  end
108
108
 
109
109
  @locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
110
- @disable_multisource = !Bundler.frozen_bundle? || @locked_gem_sources.none? {|s| s.remotes.size > 1 }
110
+ @disable_multisource = @locked_gem_sources.all?(&:disable_multisource?)
111
111
 
112
112
  unless @disable_multisource
113
- msg = "Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. " \
114
- "You should regenerate your lockfile in a non frozen environment."
113
+ msg = "Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. You should run `bundle update` or generate your lockfile from scratch."
115
114
 
116
115
  Bundler::SharedHelpers.major_deprecation 2, msg
117
116
 
118
- @sources.allow_multisource!
119
- @locked_gem_sources.each(&:allow_multisource!)
117
+ @sources.merged_gem_lockfile_sections!
120
118
  end
121
119
 
122
120
  @unlock[:gems] ||= []
@@ -162,10 +160,6 @@ module Bundler
162
160
  @disable_multisource
163
161
  end
164
162
 
165
- def allow_multisource!
166
- @disable_multisource = false
167
- end
168
-
169
163
  def resolve_with_cache!
170
164
  raise "Specs already loaded" if @specs
171
165
  sources.cached!
@@ -618,7 +612,7 @@ module Bundler
618
612
  deps_for_source = @dependencies.select {|s| s.source == source }
619
613
  locked_deps_for_source = @locked_deps.values.select {|dep| dep.source == locked_source }
620
614
 
621
- deps_for_source.sort != locked_deps_for_source.sort
615
+ deps_for_source.uniq.sort != locked_deps_for_source.sort
622
616
  end
623
617
 
624
618
  def specs_for_source_changed?(source)
@@ -920,7 +914,7 @@ module Bundler
920
914
  metadata_dependencies.each do |dep|
921
915
  source_requirements[dep.name] = sources.metadata_source
922
916
  end
923
- source_requirements[:global] = index unless disable_multisource?
917
+ source_requirements[:global] = index unless Bundler.feature_flag.disable_multisource?
924
918
  source_requirements[:default_bundler] = source_requirements["bundler"] || source_requirements[:default]
925
919
  source_requirements["bundler"] = sources.metadata_source # needs to come last to override
926
920
  source_requirements
@@ -988,10 +982,9 @@ module Bundler
988
982
  def dependency_source_requirements
989
983
  @dependency_source_requirements ||= begin
990
984
  source_requirements = {}
991
- default = disable_multisource? && sources.default_source
985
+ default = sources.default_source
992
986
  dependencies.each do |dep|
993
987
  dep_source = dep.source || default
994
- next unless dep_source
995
988
  source_requirements[dep.name] = dep_source
996
989
  end
997
990
  source_requirements
data/lib/bundler/dsl.rb CHANGED
@@ -453,10 +453,8 @@ repo_name ||= user_name
453
453
  end
454
454
 
455
455
  def check_rubygems_source_safety
456
- if @global_rubygems_sources.size <= 1
457
- @sources.global_rubygems_source = @global_rubygems_sources.first
458
- return
459
- end
456
+ @sources.global_rubygems_source = @global_rubygems_sources.shift
457
+ return if @global_rubygems_sources.empty?
460
458
 
461
459
  @global_rubygems_sources.each do |source|
462
460
  @sources.add_rubygems_remote(source)
@@ -32,6 +32,7 @@ module Bundler
32
32
  settings_flag(:cache_all) { bundler_3_mode? }
33
33
  settings_flag(:default_install_uses_path) { bundler_3_mode? }
34
34
  settings_flag(:deployment_means_frozen) { bundler_3_mode? }
35
+ settings_flag(:disable_multisource) { bundler_3_mode? }
35
36
  settings_flag(:forget_cli_options) { bundler_3_mode? }
36
37
  settings_flag(:global_gem_cache) { bundler_3_mode? }
37
38
  settings_flag(:only_update_to_newer_versions) { bundler_3_mode? }
@@ -89,6 +89,8 @@ module Bundler
89
89
  end
90
90
  install(options)
91
91
 
92
+ Gem::Specification.reset # invalidate gem specification cache so that installed gems are immediately available
93
+
92
94
  lock unless Bundler.frozen_bundle?
93
95
  Standalone.new(options[:standalone], @definition).generate if options[:standalone]
94
96
  end
@@ -6,10 +6,11 @@ require_relative "gem_installer"
6
6
  module Bundler
7
7
  class ParallelInstaller
8
8
  class SpecInstallation
9
- attr_accessor :spec, :name, :post_install_message, :state, :error
9
+ attr_accessor :spec, :name, :full_name, :post_install_message, :state, :error
10
10
  def initialize(spec)
11
11
  @spec = spec
12
12
  @name = spec.name
13
+ @full_name = spec.full_name
13
14
  @state = :none
14
15
  @post_install_message = ""
15
16
  @error = nil
@@ -27,13 +28,8 @@ module Bundler
27
28
  state == :failed
28
29
  end
29
30
 
30
- def installation_attempted?
31
- installed? || failed?
32
- end
33
-
34
- # Only true when spec in neither installed nor already enqueued
35
31
  def ready_to_enqueue?
36
- !enqueued? && !installation_attempted?
32
+ state == :none
37
33
  end
38
34
 
39
35
  def has_post_install_message?
@@ -54,14 +50,11 @@ module Bundler
54
50
  # Represents only the non-development dependencies, the ones that are
55
51
  # itself and are in the total list.
56
52
  def dependencies
57
- @dependencies ||= begin
58
- all_dependencies.reject {|dep| ignorable_dependency? dep }
59
- end
53
+ @dependencies ||= all_dependencies.reject {|dep| ignorable_dependency? dep }
60
54
  end
61
55
 
62
56
  def missing_lockfile_dependencies(all_spec_names)
63
- deps = all_dependencies.reject {|dep| ignorable_dependency? dep }
64
- deps.reject {|dep| all_spec_names.include? dep.name }
57
+ dependencies.reject {|dep| all_spec_names.include? dep.name }
65
58
  end
66
59
 
67
60
  # Represents all dependencies
@@ -70,7 +63,7 @@ module Bundler
70
63
  end
71
64
 
72
65
  def to_s
73
- "#<#{self.class} #{@spec.full_name} (#{state})>"
66
+ "#<#{self.class} #{full_name} (#{state})>"
74
67
  end
75
68
  end
76
69
 
@@ -93,18 +86,48 @@ module Bundler
93
86
  def call
94
87
  check_for_corrupt_lockfile
95
88
 
89
+ if @rake
90
+ do_install(@rake, 0)
91
+ Gem::Specification.reset
92
+ end
93
+
96
94
  if @size > 1
97
95
  install_with_worker
98
96
  else
99
97
  install_serially
100
98
  end
101
99
 
100
+ check_for_unmet_dependencies
101
+
102
102
  handle_error if failed_specs.any?
103
103
  @specs
104
104
  ensure
105
105
  worker_pool && worker_pool.stop
106
106
  end
107
107
 
108
+ def check_for_unmet_dependencies
109
+ unmet_dependencies = @specs.map do |s|
110
+ [
111
+ s,
112
+ s.dependencies.reject {|dep| @specs.any? {|spec| dep.matches_spec?(spec.spec) } },
113
+ ]
114
+ end.reject {|a| a.last.empty? }
115
+ return if unmet_dependencies.empty?
116
+
117
+ warning = []
118
+ warning << "Your lockfile doesn't include a valid resolution."
119
+ warning << "You can fix this by regenerating your lockfile or trying to manually editing the bad locked gems to a version that satisfies all dependencies."
120
+ warning << "The unmet dependencies are:"
121
+
122
+ unmet_dependencies.each do |spec, unmet_spec_dependencies|
123
+ unmet_spec_dependencies.each do |unmet_spec_dependency|
124
+ warning << "* #{unmet_spec_dependency}, depended upon #{spec.full_name}, unsatisfied by #{@specs.find {|s| s.name == unmet_spec_dependency.name && !unmet_spec_dependency.matches_spec?(s.spec) }.full_name}"
125
+ end
126
+ end
127
+
128
+ Bundler.ui.warn(warning.join("\n"))
129
+ end
130
+
108
131
  def check_for_corrupt_lockfile
109
132
  missing_dependencies = @specs.map do |s|
110
133
  [
@@ -217,8 +240,6 @@ module Bundler
217
240
  # are installed.
218
241
  def enqueue_specs
219
242
  @specs.select(&:ready_to_enqueue?).each do |spec|
220
- next if @rake && !@rake.installed? && spec.name != @rake.name
221
-
222
243
  if spec.dependencies_installed? @specs
223
244
  spec.state = :enqueued
224
245
  worker_pool.enq spec
@@ -73,7 +73,12 @@ module Bundler
73
73
  same_platform_candidates = candidates.select do |spec|
74
74
  MatchPlatform.platforms_match?(spec.platform, platform_object)
75
75
  end
76
- search = same_platform_candidates.last || candidates.last
76
+ installable_candidates = same_platform_candidates.select do |spec|
77
+ !spec.is_a?(RemoteSpecification) &&
78
+ spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
79
+ spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version)
80
+ end
81
+ search = installable_candidates.last || same_platform_candidates.last
77
82
  search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
78
83
  search
79
84
  end
@@ -131,18 +131,8 @@ module Bundler
131
131
  @sources << @current_source
132
132
  end
133
133
  when GEM
134
- source_remotes = Array(@opts["remote"])
135
-
136
- if source_remotes.size == 1
137
- @opts["remotes"] = @opts.delete("remote")
138
- @current_source = TYPES[@type].from_lock(@opts)
139
- else
140
- source_remotes.each do |url|
141
- rubygems_aggregate.add_remote(url)
142
- end
143
- @current_source = rubygems_aggregate
144
- end
145
-
134
+ @opts["remotes"] = Array(@opts.delete("remote")).reverse
135
+ @current_source = TYPES[@type].from_lock(@opts)
146
136
  @sources << @current_source
147
137
  when PLUGIN
148
138
  @current_source = Plugin.source_from_lock(@opts)
@@ -245,9 +235,5 @@ module Bundler
245
235
  def parse_ruby(line)
246
236
  @ruby_version = line.strip
247
237
  end
248
-
249
- def rubygems_aggregate
250
- @rubygems_aggregate ||= Source::Rubygems.new
251
- end
252
238
  end
253
239
  end
@@ -56,6 +56,9 @@ Executing \fBbundle config unset \-\-local <name> <value>\fR will delete the con
56
56
  .P
57
57
  Executing bundle with the \fBBUNDLE_IGNORE_CONFIG\fR environment variable set will cause it to ignore all configuration\.
58
58
  .
59
+ .P
60
+ Executing \fBbundle config set \-\-local disable_multisource true\fR upgrades the warning about the Gemfile containing multiple primary sources to an error\. Executing \fBbundle config unset disable_multisource\fR downgrades this error to a warning\.
61
+ .
59
62
  .SH "REMEMBERING OPTIONS"
60
63
  Flags passed to \fBbundle install\fR or the Bundler runtime, such as \fB\-\-path foo\fR or \fB\-\-without production\fR, are remembered between commands and saved to your local application\'s configuration (normally, \fB\./\.bundle/config\fR)\.
61
64
  .
@@ -181,6 +184,9 @@ The following is a list of all configuration keys and their purpose\. You can le
181
184
  \fBdisable_local_revision_check\fR (\fBBUNDLE_DISABLE_LOCAL_REVISION_CHECK\fR): Allow Bundler to use a local git override without checking if the revision present in the lockfile is present in the repository\.
182
185
  .
183
186
  .IP "\(bu" 4
187
+ \fBdisable_multisource\fR (\fBBUNDLE_DISABLE_MULTISOURCE\fR): When set, Gemfiles containing multiple sources will produce errors instead of warnings\. Use \fBbundle config unset disable_multisource\fR to unset\.
188
+ .
189
+ .IP "\(bu" 4
184
190
  \fBdisable_shared_gems\fR (\fBBUNDLE_DISABLE_SHARED_GEMS\fR): Stop Bundler from accessing gems installed to RubyGems\' normal location\.
185
191
  .
186
192
  .IP "\(bu" 4
@@ -47,6 +47,10 @@ configuration only from the local application.
47
47
  Executing bundle with the `BUNDLE_IGNORE_CONFIG` environment variable set will
48
48
  cause it to ignore all configuration.
49
49
 
50
+ Executing `bundle config set --local disable_multisource true` upgrades the warning about
51
+ the Gemfile containing multiple primary sources to an error. Executing `bundle
52
+ config unset disable_multisource` downgrades this error to a warning.
53
+
50
54
  ## REMEMBERING OPTIONS
51
55
 
52
56
  Flags passed to `bundle install` or the Bundler runtime, such as `--path foo` or
@@ -174,6 +178,10 @@ learn more about their operation in [bundle install(1)](bundle-install.1.html).
174
178
  * `disable_local_revision_check` (`BUNDLE_DISABLE_LOCAL_REVISION_CHECK`):
175
179
  Allow Bundler to use a local git override without checking if the revision
176
180
  present in the lockfile is present in the repository.
181
+ * `disable_multisource` (`BUNDLE_DISABLE_MULTISOURCE`):
182
+ When set, Gemfiles containing multiple sources will produce errors
183
+ instead of warnings.
184
+ Use `bundle config unset disable_multisource` to unset.
177
185
  * `disable_shared_gems` (`BUNDLE_DISABLE_SHARED_GEMS`):
178
186
  Stop Bundler from accessing gems installed to RubyGems' normal location.
179
187
  * `disable_version_check` (`BUNDLE_DISABLE_VERSION_CHECK`):
@@ -140,6 +140,13 @@ module Bundler
140
140
  end
141
141
  end
142
142
 
143
+ # Set internal representation to fetch the gems/specs locally.
144
+ #
145
+ # When this is called, the source should try to fetch the specs and
146
+ # install from the local system.
147
+ def local!
148
+ end
149
+
143
150
  # Set internal representation to fetch the gems/specs from remote.
144
151
  #
145
152
  # When this is called, the source should try to fetch the specs and
@@ -77,12 +77,11 @@ module Bundler
77
77
  source_list = SourceList.new
78
78
 
79
79
  source_list.add_git_source(git_source_options) if git_source_options
80
- source_list.add_rubygems_source("remotes" => rubygems_source) if rubygems_source
80
+ source_list.global_rubygems_source = rubygems_source if rubygems_source
81
81
 
82
82
  deps = names.map {|name| Dependency.new name, version }
83
83
 
84
84
  definition = Definition.new(nil, deps, source_list, true)
85
- definition.allow_multisource!
86
85
  install_definition(definition)
87
86
  end
88
87
 
@@ -17,6 +17,10 @@ module Bundler
17
17
  path_sources + git_sources + rubygems_sources + [metadata_source]
18
18
  end
19
19
 
20
+ def default_source
21
+ git_sources.first || global_rubygems_source
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def rubygems_aggregate_class
@@ -26,6 +26,12 @@ module Bundler
26
26
 
27
27
  def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
28
28
  @source_requirements = source_requirements
29
+
30
+ @index_requirements = source_requirements.each_with_object({}) do |source_requirement, index_requirements|
31
+ name, source = source_requirement
32
+ index_requirements[name] = name == :global ? source : source.specs
33
+ end
34
+
29
35
  @base = base
30
36
  @resolver = Molinillo::Resolver.new(self, self)
31
37
  @search_for = {}
@@ -193,24 +199,21 @@ module Bundler
193
199
  search_result
194
200
  end
195
201
 
196
- def index_for(dependency, base)
197
- source = @source_requirements[dependency.name]
202
+ def index_for(dependency)
203
+ source = @index_requirements[dependency.name]
198
204
  if source
199
- source.specs
205
+ source
200
206
  elsif @no_aggregate_global_source
201
- dependency.all_sources.find(-> { Index.new }) do |s|
202
- idx = s.specs
203
- results = idx.search(dependency, base)
204
- next if results.empty? || results == base
205
- return idx
207
+ Index.build do |idx|
208
+ dependency.all_sources.each {|s| idx.add_source(s.specs) }
206
209
  end
207
210
  else
208
- @source_requirements[:global]
211
+ @index_requirements[:global]
209
212
  end
210
213
  end
211
214
 
212
215
  def results_for(dependency, base)
213
- index_for(dependency, base).search(dependency, base)
216
+ index_for(dependency).search(dependency, base)
214
217
  end
215
218
 
216
219
  def name_for(dependency)
@@ -239,7 +242,7 @@ module Bundler
239
242
 
240
243
  def relevant_sources_for_vertex(vertex)
241
244
  if vertex.root?
242
- [@source_requirements[vertex.name]].compact
245
+ [@source_requirements[vertex.name]]
243
246
  elsif @no_aggregate_global_source
244
247
  vertex.recursive_predecessors.map do |v|
245
248
  @source_requirements[v.name]
@@ -251,9 +254,9 @@ module Bundler
251
254
 
252
255
  def sort_dependencies(dependencies, activated, conflicts)
253
256
  dependencies.sort_by do |dependency|
254
- dependency.all_sources = relevant_sources_for_vertex(activated.vertex_named(dependency.name))
255
257
  name = name_for(dependency)
256
258
  vertex = activated.vertex_named(name)
259
+ dependency.all_sources = relevant_sources_for_vertex(vertex)
257
260
  [
258
261
  @base_dg.vertex_named(name) ? 0 : 1,
259
262
  vertex.payload ? 0 : 1,
@@ -286,7 +289,7 @@ module Bundler
286
289
  if (base = @base[dependency.name]) && !base.empty?
287
290
  dependency.requirement.satisfied_by?(base.first.version) ? 0 : 1
288
291
  else
289
- all = index_for(dependency, base).search(dependency.name).size
292
+ all = index_for(dependency).search(dependency.name).size
290
293
 
291
294
  if all <= 1
292
295
  all - 1_000_000
@@ -320,7 +323,7 @@ module Bundler
320
323
  "If you are updating multiple gems in your Gemfile at once,\n" \
321
324
  "try passing them all to `bundle update`"
322
325
  elsif source = @source_requirements[name]
323
- specs = source.specs[name]
326
+ specs = source.specs.search(name)
324
327
  versions_with_platforms = specs.map {|s| [s.version, s.platform] }
325
328
  message = String.new("Could not find gem '#{SharedHelpers.pretty_dependency(requirement)}' in #{source}#{cache_message}.\n")
326
329
  message << if versions_with_platforms.any?
@@ -395,7 +398,7 @@ module Bundler
395
398
  if other_bundler_required
396
399
  o << "\n\n"
397
400
 
398
- candidate_specs = @source_requirements[:default_bundler].specs.search(conflict_dependency)
401
+ candidate_specs = @index_requirements[:default_bundler].search(conflict_dependency)
399
402
  if candidate_specs.any?
400
403
  target_version = candidate_specs.last.version
401
404
  new_command = [File.basename($PROGRAM_NAME), "_#{target_version}_", *ARGV].join(" ")
@@ -454,11 +457,10 @@ module Bundler
454
457
  name = v.name
455
458
  sources = relevant_sources_for_vertex(v)
456
459
  next unless sources.any?
457
- sources.compact!
458
460
  if default_index = sources.index(@source_requirements[:default])
459
461
  sources.delete_at(default_index)
460
462
  end
461
- sources.reject! {|s| s.specs[name].empty? }
463
+ sources.reject! {|s| s.specs.search(name).empty? }
462
464
  sources.uniq!
463
465
  next if sources.size <= 1
464
466
 
@@ -8,6 +8,53 @@ module Bundler
8
8
  # Bundler needs to install gems regardless of binstub overwriting
9
9
  end
10
10
 
11
+ def install
12
+ pre_install_checks
13
+
14
+ run_pre_install_hooks
15
+
16
+ spec.loaded_from = spec_file
17
+
18
+ # Completely remove any previous gem files
19
+ FileUtils.rm_rf gem_dir
20
+ FileUtils.rm_rf spec.extension_dir
21
+
22
+ FileUtils.mkdir_p gem_dir, :mode => 0o755
23
+
24
+ extract_files
25
+
26
+ build_extensions
27
+ write_build_info_file
28
+ run_post_build_hooks
29
+
30
+ generate_bin
31
+ generate_plugins
32
+
33
+ write_spec
34
+ write_cache_file
35
+
36
+ say spec.post_install_message unless spec.post_install_message.nil?
37
+
38
+ run_post_install_hooks
39
+
40
+ spec
41
+ end
42
+
43
+ def generate_plugins
44
+ return unless Gem::Installer.instance_methods(false).include?(:generate_plugins)
45
+
46
+ latest = Gem::Specification.stubs_for(spec.name).first
47
+ return if latest && latest.version > spec.version
48
+
49
+ ensure_writable_dir @plugins_dir
50
+
51
+ if spec.plugins.empty?
52
+ remove_plugins_for(spec, @plugins_dir)
53
+ else
54
+ regenerate_plugins_for(spec, @plugins_dir)
55
+ end
56
+ end
57
+
11
58
  def pre_install_checks
12
59
  super && validate_bundler_checksum(options[:bundler_expected_checksum])
13
60
  end
@@ -20,6 +20,7 @@ module Bundler
20
20
  disable_exec_load
21
21
  disable_local_branch_check
22
22
  disable_local_revision_check
23
+ disable_multisource
23
24
  disable_shared_gems
24
25
  disable_version_check
25
26
  force_ruby_platform
@@ -33,6 +33,12 @@ module Bundler
33
33
  spec.source == self
34
34
  end
35
35
 
36
+ def local!; end
37
+
38
+ def cached!; end
39
+
40
+ def remote!; end
41
+
36
42
  # it's possible that gems from one source depend on gems from some
37
43
  # other source, so now we download gemspecs and iterate over those
38
44
  # dependencies, looking for gems we don't have info on yet.
@@ -33,10 +33,6 @@ module Bundler
33
33
  end
34
34
  end
35
35
 
36
- def cached!; end
37
-
38
- def remote!; end
39
-
40
36
  def options
41
37
  {}
42
38
  end
@@ -82,7 +82,9 @@ module Bundler
82
82
  end
83
83
 
84
84
  def install(spec, options = {})
85
- print_using_message "Using #{version_message(spec)} from #{self}"
85
+ using_message = "Using #{version_message(spec)} from #{self}"
86
+ using_message += " and installing its executables" unless spec.executables.empty?
87
+ print_using_message using_message
86
88
  generate_bin(spec, :disable_extensions => true)
87
89
  nil # no post-install message
88
90
  end
@@ -35,7 +35,7 @@ module Bundler
35
35
  run_hooks(:post_build)
36
36
  end
37
37
 
38
- generate_bin unless spec.executables.nil? || spec.executables.empty?
38
+ generate_bin unless spec.executables.empty?
39
39
 
40
40
  run_hooks(:post_install)
41
41
  ensure
@@ -20,18 +20,29 @@ module Bundler
20
20
  @dependency_names = []
21
21
  @allow_remote = false
22
22
  @allow_cached = false
23
+ @allow_local = options["allow_local"] || false
23
24
  @caches = [cache_path, *Bundler.rubygems.gem_cache]
24
- @disable_multisource = true
25
25
 
26
- Array(options["remotes"] || []).reverse_each {|r| add_remote(r) }
26
+ Array(options["remotes"]).reverse_each {|r| add_remote(r) }
27
+ end
28
+
29
+ def local!
30
+ return if @allow_local
31
+
32
+ @specs = nil
33
+ @allow_local = true
27
34
  end
28
35
 
29
36
  def remote!
37
+ return if @allow_remote
38
+
30
39
  @specs = nil
31
40
  @allow_remote = true
32
41
  end
33
42
 
34
43
  def cached!
44
+ return if @allow_cached
45
+
35
46
  @specs = nil
36
47
  @allow_cached = true
37
48
  end
@@ -51,11 +62,7 @@ module Bundler
51
62
  end
52
63
 
53
64
  def disable_multisource?
54
- @disable_multisource
55
- end
56
-
57
- def allow_multisource!
58
- @disable_multisource = false
65
+ @remotes.size <= 1
59
66
  end
60
67
 
61
68
  def can_lock?(spec)
@@ -96,7 +103,7 @@ module Bundler
96
103
  # small_idx.use large_idx.
97
104
  idx = @allow_remote ? remote_specs.dup : Index.new
98
105
  idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
99
- idx.use(installed_specs, :override_dupes)
106
+ idx.use(installed_specs, :override_dupes) if @allow_local
100
107
  idx
101
108
  end
102
109
  end
@@ -374,7 +381,7 @@ module Bundler
374
381
 
375
382
  def cached_specs
376
383
  @cached_specs ||= begin
377
- idx = installed_specs.dup
384
+ idx = @allow_local ? installed_specs.dup : Index.new
378
385
 
379
386
  Dir["#{cache_path}/*.gem"].each do |gemfile|
380
387
  next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
@@ -6,11 +6,10 @@ module Bundler
6
6
  :git_sources,
7
7
  :plugin_sources,
8
8
  :global_path_source,
9
- :metadata_source,
10
- :disable_multisource
9
+ :metadata_source
11
10
 
12
11
  def global_rubygems_source
13
- @global_rubygems_source ||= rubygems_aggregate_class.new
12
+ @global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
14
13
  end
15
14
 
16
15
  def initialize
@@ -21,15 +20,15 @@ module Bundler
21
20
  @global_path_source = nil
22
21
  @rubygems_sources = []
23
22
  @metadata_source = Source::Metadata.new
24
- @disable_multisource = true
23
+
24
+ @disable_multisource = true
25
25
  end
26
26
 
27
27
  def disable_multisource?
28
28
  @disable_multisource
29
29
  end
30
30
 
31
- def allow_multisource!
32
- rubygems_sources.map(&:allow_multisource!)
31
+ def merged_gem_lockfile_sections!
33
32
  @disable_multisource = false
34
33
  end
35
34
 
@@ -58,7 +57,7 @@ module Bundler
58
57
  end
59
58
 
60
59
  def global_rubygems_source=(uri)
61
- @global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
60
+ @global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri, "allow_local" => true)
62
61
  end
63
62
 
64
63
  def add_rubygems_remote(uri)
@@ -89,7 +88,7 @@ module Bundler
89
88
  def lock_sources
90
89
  lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
91
90
  if disable_multisource?
92
- lock_sources + rubygems_sources.sort_by(&:to_s)
91
+ lock_sources + rubygems_sources.sort_by(&:to_s).uniq
93
92
  else
94
93
  lock_sources << combine_rubygems_sources
95
94
  end
@@ -110,7 +109,6 @@ module Bundler
110
109
  @global_rubygems_source = replacement_rubygems if replacement_rubygems
111
110
 
112
111
  return true if !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
113
- return true if replacement_rubygems && rubygems_remotes.sort_by(&:to_s) != replacement_rubygems.remotes.sort_by(&:to_s)
114
112
 
115
113
  false
116
114
  end
@@ -145,9 +143,7 @@ module Bundler
145
143
  end
146
144
 
147
145
  def combine_rubygems_sources
148
- aggregate_source = Source::Rubygems.new("remotes" => rubygems_remotes)
149
- aggregate_source.allow_multisource! unless disable_multisource?
150
- aggregate_source
146
+ Source::Rubygems.new("remotes" => rubygems_remotes)
151
147
  end
152
148
 
153
149
  def warn_on_git_protocol(source)
@@ -82,6 +82,7 @@ module Bundler
82
82
  materialized.map! do |s|
83
83
  next s unless s.is_a?(LazySpecification)
84
84
  s.source.dependency_names = deps if s.source.respond_to?(:dependency_names=)
85
+ s.source.local!
85
86
  spec = s.__materialize__
86
87
  unless spec
87
88
  unless missing_specs
@@ -102,6 +103,7 @@ module Bundler
102
103
  @specs.map do |s|
103
104
  next s unless s.is_a?(LazySpecification)
104
105
  s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
106
+ s.source.local!
105
107
  s.source.remote!
106
108
  spec = s.__materialize__
107
109
  raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
@@ -26,11 +26,19 @@ module Bundler
26
26
 
27
27
  # @!group Stub Delegates
28
28
 
29
+ def manually_installed?
30
+ # This is for manually installed gems which are gems that were fixed in place after a
31
+ # failed installation. Once the issue was resolved, the user then manually created
32
+ # the gem specification using the instructions provided by `gem help install`
33
+ installed_by_version == Gem::Version.new(0)
34
+ end
35
+
29
36
  # This is defined directly to avoid having to loading the full spec
30
37
  def missing_extensions?
31
38
  return false if default_gem?
32
39
  return false if extensions.empty?
33
40
  return false if File.exist? gem_build_complete_path
41
+ return false if manually_installed?
34
42
 
35
43
  true
36
44
  end
@@ -29,19 +29,21 @@ TODO: Write usage instructions here
29
29
  After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
30
30
 
31
31
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+ <% if config[:git] -%>
32
33
 
33
34
  ## Contributing
34
35
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).<% end %>
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).<% end %>
37
+ <% end -%>
36
38
  <% if config[:mit] -%>
37
39
 
38
40
  ## License
39
41
 
40
42
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
41
43
  <% end -%>
42
- <% if config[:coc] -%>
44
+ <% if config[:git] && config[:coc] -%>
43
45
 
44
46
  ## Code of Conduct
45
47
 
46
- Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/master/CODE_OF_CONDUCT.md).
48
+ Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).
47
49
  <% end -%>
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.2.10".freeze
4
+ VERSION = "2.2.15".freeze
5
5
 
6
6
  def self.bundler_major_version
7
7
  @bundler_major_version ||= VERSION.split(".").first.to_i
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.10
4
+ version: 2.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Arko
@@ -22,7 +22,7 @@ authors:
22
22
  autorequire:
23
23
  bindir: exe
24
24
  cert_chain: []
25
- date: 2021-02-15 00:00:00.000000000 Z
25
+ date: 2021-03-19 00:00:00.000000000 Z
26
26
  dependencies: []
27
27
  description: Bundler manages an application's dependencies through its entire life,
28
28
  across many machines, systematically and repeatably
@@ -352,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
352
352
  - !ruby/object:Gem::Version
353
353
  version: 2.5.2
354
354
  requirements: []
355
- rubygems_version: 3.2.10
355
+ rubygems_version: 3.2.15
356
356
  signing_key:
357
357
  specification_version: 4
358
358
  summary: The best way to manage your application's dependencies