bundler 2.2.13 → 2.2.17

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.

Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +69 -5
  3. data/lib/bundler/build_metadata.rb +2 -2
  4. data/lib/bundler/cli/common.rb +15 -2
  5. data/lib/bundler/cli/gem.rb +9 -1
  6. data/lib/bundler/cli/outdated.rb +1 -1
  7. data/lib/bundler/cli.rb +3 -2
  8. data/lib/bundler/compact_index_client/updater.rb +10 -6
  9. data/lib/bundler/current_ruby.rb +1 -0
  10. data/lib/bundler/definition.rb +26 -12
  11. data/lib/bundler/dsl.rb +3 -6
  12. data/lib/bundler/feature_flag.rb +0 -1
  13. data/lib/bundler/fetcher/downloader.rb +8 -4
  14. data/lib/bundler/fetcher.rb +2 -1
  15. data/lib/bundler/gem_helper.rb +16 -0
  16. data/lib/bundler/injector.rb +2 -2
  17. data/lib/bundler/inline.rb +1 -1
  18. data/lib/bundler/installer/parallel_installer.rb +36 -15
  19. data/lib/bundler/lazy_specification.rb +6 -1
  20. data/lib/bundler/lockfile_parser.rb +2 -16
  21. data/lib/bundler/man/bundle-add.1 +1 -1
  22. data/lib/bundler/man/bundle-binstubs.1 +1 -1
  23. data/lib/bundler/man/bundle-cache.1 +1 -1
  24. data/lib/bundler/man/bundle-check.1 +1 -1
  25. data/lib/bundler/man/bundle-clean.1 +1 -1
  26. data/lib/bundler/man/bundle-config.1 +21 -4
  27. data/lib/bundler/man/bundle-config.1.ronn +21 -3
  28. data/lib/bundler/man/bundle-doctor.1 +1 -1
  29. data/lib/bundler/man/bundle-exec.1 +1 -1
  30. data/lib/bundler/man/bundle-gem.1 +1 -1
  31. data/lib/bundler/man/bundle-info.1 +1 -1
  32. data/lib/bundler/man/bundle-init.1 +1 -1
  33. data/lib/bundler/man/bundle-inject.1 +1 -1
  34. data/lib/bundler/man/bundle-install.1 +1 -1
  35. data/lib/bundler/man/bundle-list.1 +1 -1
  36. data/lib/bundler/man/bundle-lock.1 +1 -1
  37. data/lib/bundler/man/bundle-open.1 +1 -1
  38. data/lib/bundler/man/bundle-outdated.1 +1 -1
  39. data/lib/bundler/man/bundle-platform.1 +1 -1
  40. data/lib/bundler/man/bundle-pristine.1 +1 -1
  41. data/lib/bundler/man/bundle-remove.1 +1 -1
  42. data/lib/bundler/man/bundle-show.1 +1 -1
  43. data/lib/bundler/man/bundle-update.1 +1 -1
  44. data/lib/bundler/man/bundle-viz.1 +1 -1
  45. data/lib/bundler/man/bundle.1 +1 -1
  46. data/lib/bundler/man/gemfile.5 +1 -1
  47. data/lib/bundler/plugin/api/source.rb +7 -0
  48. data/lib/bundler/plugin.rb +2 -2
  49. data/lib/bundler/retry.rb +1 -1
  50. data/lib/bundler/settings.rb +60 -10
  51. data/lib/bundler/source/metadata.rb +0 -4
  52. data/lib/bundler/source/path/installer.rb +1 -1
  53. data/lib/bundler/source/path.rb +3 -1
  54. data/lib/bundler/source/rubygems.rb +22 -6
  55. data/lib/bundler/source.rb +6 -0
  56. data/lib/bundler/source_list.rb +15 -5
  57. data/lib/bundler/spec_set.rb +18 -5
  58. data/lib/bundler/templates/Gemfile +1 -1
  59. data/lib/bundler/templates/gems.rb +1 -1
  60. data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -4
  61. data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +1 -1
  62. data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +1 -1
  63. data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +1 -1
  64. data/lib/bundler/version.rb +1 -1
  65. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4227db15ba56c781814845c3e7c2811def8bba66c074098d04496cf3f7ce3ed
4
- data.tar.gz: '0295d490ed0dcf0989468a1a25b3b233c618006882757cbbf5a99e179b009568'
3
+ metadata.gz: 2c654f563fcfd784d65d2441b1cf8b5384f9e90ff8d7107de070e33dba2ee729
4
+ data.tar.gz: 4554510c934d22551680c26ff77f0b1a1073f7d35c0b21030d103fd40ade6baf
5
5
  SHA512:
6
- metadata.gz: fa78e4e46d7b7fe666950c26fd47df524d7af57612c4e584e088a7a10aa140db5eb243b0688f993dc3586a7b5c4cb2357488a237715b618891747b328d94d01a
7
- data.tar.gz: f1baab0b6a8b0c9ccf1c9bdafb7e6068252ba8fac05f96f50540320f47d4da8fa42ecae264e7b082fc1c50d4c0ff7cb456a928b2ffb07d0ca79e84d6272d1b54
6
+ metadata.gz: c4c62c6eb0c7fc78acc3317de4dbaed2d26de9859bffd8930a08e7368829a4acb9f1bea24ad290a57124983bab8ac372da21573b742f50f4d36fa6a054406189
7
+ data.tar.gz: 1862e00690b660a6d872324c6e2819c29a48ee9e9d7d97bd0cf35a92f0ea7d008fd4f7921c3f917564a3fc3279ead82bf24a360f80ad63205b37e50975b232c9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,67 @@
1
+ # 2.2.17 (May 5, 2021)
2
+
3
+ ## Enhancements:
4
+
5
+ - Improve authentication required error message to include an alternative using `ENV` [#4565](https://github.com/rubygems/rubygems/pull/4565)
6
+ - Discard partial range responses without etag [#4563](https://github.com/rubygems/rubygems/pull/4563)
7
+ - Fix configuring ENV for a gem server with a name including dashes [#4571](https://github.com/rubygems/rubygems/pull/4571)
8
+ - Redact credentials from `bundle env` and `bundle config` [#4566](https://github.com/rubygems/rubygems/pull/4566)
9
+ - Redact all sources in verbose mode [#4564](https://github.com/rubygems/rubygems/pull/4564)
10
+ - Improve `bundle pristine` error if `BUNDLE_GEMFILE` does not exist [#4536](https://github.com/rubygems/rubygems/pull/4536)
11
+ - [CurrentRuby] Add 3.0 as a known minor [#4535](https://github.com/rubygems/rubygems/pull/4535)
12
+ - Prefer File.read instead of IO.read [#4530](https://github.com/rubygems/rubygems/pull/4530)
13
+ - Add space after open curly bracket in Gemfile and gems.rb template [#4518](https://github.com/rubygems/rubygems/pull/4518)
14
+
15
+ ## Bug fixes:
16
+
17
+ - Make sure specs are fetched from the right source when materializing [#4562](https://github.com/rubygems/rubygems/pull/4562)
18
+ - Fix `bundle cache` with an up-to-date lockfile and specs not already installed [#4554](https://github.com/rubygems/rubygems/pull/4554)
19
+ - Ignore `deployment` setting in inline mode [#4523](https://github.com/rubygems/rubygems/pull/4523)
20
+
21
+ ## Performance:
22
+
23
+ - Don't materialize resolutions when not necessary [#4556](https://github.com/rubygems/rubygems/pull/4556)
24
+
25
+ # 2.2.16 (April 8, 2021)
26
+
27
+ ## Enhancements:
28
+
29
+ - Add `--github-username` option and config to `bundle gem` [#3687](https://github.com/rubygems/rubygems/pull/3687)
30
+ - Bump vendored `tmpdir` library copy [#4506](https://github.com/rubygems/rubygems/pull/4506)
31
+ - Add `rake build:checksum` task to build checksums for a gem package [#4156](https://github.com/rubygems/rubygems/pull/4156)
32
+ - Enable bundler-cache for GitHub Actions template [#4498](https://github.com/rubygems/rubygems/pull/4498)
33
+ - Improve `bundle info` error when gem is on a "disabled" group [#4492](https://github.com/rubygems/rubygems/pull/4492)
34
+ - Small tweak to yank message [#4494](https://github.com/rubygems/rubygems/pull/4494)
35
+ - Don't show duplicate entries in `bundle outdated` output [#4474](https://github.com/rubygems/rubygems/pull/4474)
36
+ - Never downgrade top level gems when running `bundle update` [#4473](https://github.com/rubygems/rubygems/pull/4473)
37
+
38
+ ## Bug fixes:
39
+
40
+ - Fix incorrect logic for filtering metadata matching candidates [#4497](https://github.com/rubygems/rubygems/pull/4497)
41
+
42
+ # 2.2.15 (March 19, 2021)
43
+
44
+ ## Enhancements:
45
+
46
+ - Add a hint about bundler installing executables for path gems [#4461](https://github.com/rubygems/rubygems/pull/4461)
47
+ - Warn lockfiles with incorrect resolutions [#4459](https://github.com/rubygems/rubygems/pull/4459)
48
+ - Don't generate duplicate redundant sources in the lockfile [#4456](https://github.com/rubygems/rubygems/pull/4456)
49
+
50
+ ## Bug fixes:
51
+
52
+ - Respect running ruby when resolving platforms [#4449](https://github.com/rubygems/rubygems/pull/4449)
53
+
54
+ # 2.2.14 (March 8, 2021)
55
+
56
+ ## Security fixes:
57
+
58
+ - Lock GEM sources separately and fix locally installed specs confusing bundler [#4381](https://github.com/rubygems/rubygems/pull/4381)
59
+
60
+ ## Bug fixes:
61
+
62
+ - Make `rake` available to other gems' installers right after it's installed [#4428](https://github.com/rubygems/rubygems/pull/4428)
63
+ - Fix encoding issue on compact index updater [#4362](https://github.com/rubygems/rubygems/pull/4362)
64
+
1
65
  # 2.2.13 (March 3, 2021)
2
66
 
3
67
  ## Enhancements:
@@ -432,7 +496,7 @@
432
496
  - Ignore `frozen` setting in inline mode ([#7125](https://github.com/rubygems/bundler/pull/7125))
433
497
  - Fix incorrect "bundler attempted to update GEM but version stayed the same" message when updating git sourced gems ([#6325](https://github.com/rubygems/bundler/pull/6325))
434
498
  - Don't check for existence of a writable home directory if `BUNDLE_USER_HOME` is set ([#6885](https://github.com/rubygems/bundler/pull/6885))
435
- - Fix error message when server would respond to a bad username/password requiest with a 401 ([#6928](https://github.com/rubygems/bundler/pull/6928))
499
+ - Fix error message when server would respond to a bad username/password request with a 401 ([#6928](https://github.com/rubygems/bundler/pull/6928))
436
500
  - Fix `bundle outdated` pluralization when multiple groups are requested ([#7063](https://github.com/rubygems/bundler/pull/7063))
437
501
  - Fix `bundle install` not updating conservatively when gemspec is changed ([#7143](https://github.com/rubygems/bundler/pull/7143))
438
502
  - Fix `bundle exec` not respecting custom process titles inside scripts ([#7140](https://github.com/rubygems/bundler/pull/7140))
@@ -2077,7 +2141,7 @@ Changes
2077
2141
  - fix Bundler.which for directories ([#2697](https://github.com/rubygems/bundler/issues/2697), @rhysd)
2078
2142
  - properly require `Capistrano::Version` ([#2690](https://github.com/rubygems/bundler/issues/2690), @steveklabnik)
2079
2143
  - search for git.exe and git
2080
- - fix the bug that downloads every spec when API fetcher encouters an error
2144
+ - fix the bug that downloads every spec when API fetcher encounters an error
2081
2145
  - only retry network requests
2082
2146
 
2083
2147
  # 1.4.0.rc.1 (September 29, 2013)
@@ -2701,7 +2765,7 @@ Changes
2701
2765
 
2702
2766
  - Implement `to_ary` to avoid calls to method_missing (@tenderlove, [#1274](https://github.com/rubygems/bundler/issues/1274))
2703
2767
  - bundle clean removes old .gem files (@cldwalker, [#1293](https://github.com/rubygems/bundler/issues/1293))
2704
- - Correcly identify missing child dependency in error message
2768
+ - Correctly identify missing child dependency in error message
2705
2769
  - Run pre-install, post-build, and post-install gem hooks for git gems (@warhammerkid, [#1120](https://github.com/rubygems/bundler/issues/1120))
2706
2770
  - create Gemfile.lock for empty Gemfile ([#1218](https://github.com/rubygems/bundler/issues/1218))
2707
2771
 
@@ -2852,7 +2916,7 @@ Changes
2852
2916
 
2853
2917
  - Performance fix for MRI 1.9 (@efficientcloud, [#1288](https://github.com/rubygems/bundler/issues/1288))
2854
2918
  - Shortcuts (like `bundle i`) for all commands (@amatsuda)
2855
- - Correcly identify missing child dependency in error message
2919
+ - Correctly identify missing child dependency in error message
2856
2920
 
2857
2921
  ## Bug fixes:
2858
2922
 
@@ -3088,7 +3152,7 @@ Changes
3088
3152
 
3089
3153
  - Various bugfixes to the built-in rake helpers
3090
3154
  - Fix a bug where shortrefs weren't unique enough and were
3091
- therfore colliding
3155
+ therefore colliding
3092
3156
  - Fix a small bug involving checking whether a local git
3093
3157
  clone is up to date
3094
3158
  - Correctly handle explicit '=' dependencies with gems
@@ -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-03-03".freeze
8
- @git_commit_sha = "9b15ab18c4".freeze
7
+ @built_at = "2021-05-05".freeze
8
+ @git_commit_sha = "69cbd6e10e".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -36,10 +36,15 @@ module Bundler
36
36
  def self.without_groups_message(command)
37
37
  command_in_past_tense = command == :install ? "installed" : "updated"
38
38
  groups = Bundler.settings[:without]
39
+ "Gems in the #{verbalize_groups(groups)} were not #{command_in_past_tense}."
40
+ end
41
+
42
+ def self.verbalize_groups(groups)
43
+ groups.map!{|g| "'#{g}'" }
39
44
  group_list = [groups[0...-1].join(", "), groups[-1..-1]].
40
45
  reject {|s| s.to_s.empty? }.join(" and ")
41
46
  group_str = groups.size == 1 ? "group" : "groups"
42
- "Gems in the #{group_str} #{group_list} were not #{command_in_past_tense}."
47
+ "#{group_str} #{group_list}"
43
48
  end
44
49
 
45
50
  def self.select_spec(name, regex_match = nil)
@@ -53,7 +58,13 @@ module Bundler
53
58
 
54
59
  case specs.count
55
60
  when 0
56
- raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
61
+ dep_in_other_group = Bundler.definition.current_dependencies.find {|dep|dep.name == name }
62
+
63
+ if dep_in_other_group
64
+ raise GemNotFound, "Could not find gem '#{name}', because it's in the #{verbalize_groups(dep_in_other_group.groups)}, configured to be ignored."
65
+ else
66
+ raise GemNotFound, gem_not_found_message(name, Bundler.definition.dependencies)
67
+ end
57
68
  when 1
58
69
  specs.first
59
70
  else
@@ -83,6 +94,8 @@ module Bundler
83
94
  end
84
95
 
85
96
  def self.ensure_all_gems_in_lockfile!(names, locked_gems = Bundler.locked_gems)
97
+ return unless locked_gems
98
+
86
99
  locked_names = locked_gems.specs.map(&:name).uniq
87
100
  names.-(locked_names).each do |g|
88
101
  raise GemNotFound, gem_not_found_message(g, locked_names)
@@ -42,9 +42,17 @@ module Bundler
42
42
  use_git = Bundler.git_present? && options[:git]
43
43
 
44
44
  git_author_name = use_git ? `git config user.name`.chomp : ""
45
- github_username = use_git ? `git config github.user`.chomp : ""
45
+ git_username = use_git ? `git config github.user`.chomp : ""
46
46
  git_user_email = use_git ? `git config user.email`.chomp : ""
47
47
 
48
+ github_username = if options[:github_username].nil?
49
+ git_username
50
+ elsif options[:github_username] == false
51
+ ""
52
+ else
53
+ options[:github_username]
54
+ end
55
+
48
56
  config = {
49
57
  :name => name,
50
58
  :underscored_name => underscored_name,
@@ -72,7 +72,7 @@ module Bundler
72
72
  gemfile_specs + dependency_specs
73
73
  end
74
74
 
75
- specs.sort_by(&:name).each do |current_spec|
75
+ specs.sort_by(&:name).uniq(&:name).each do |current_spec|
76
76
  next unless gems.empty? || gems.include?(current_spec.name)
77
77
 
78
78
  active_spec = retrieve_active_spec(definition, current_spec)
data/lib/bundler/cli.rb CHANGED
@@ -504,8 +504,8 @@ module Bundler
504
504
  By default, setting a configuration value sets it for all projects
505
505
  on the machine.
506
506
 
507
- If a global setting is superceded by local configuration, this command
508
- will show the current value, as well as any superceded values and
507
+ If a global setting is superseded by local configuration, this command
508
+ will show the current value, as well as any superseded values and
509
509
  where they were specified.
510
510
  D
511
511
  require_relative "cli/config"
@@ -591,6 +591,7 @@ module Bundler
591
591
  :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)`."
592
592
  method_option :ci, :type => :string, :lazy_default => Bundler.settings["gem.ci"] || "",
593
593
  :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)`"
594
+ 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>`."
594
595
 
595
596
  def gem(name)
596
597
  end
@@ -50,16 +50,20 @@ module Bundler
50
50
 
51
51
  content = response.body
52
52
 
53
- SharedHelpers.filesystem_access(local_temp_path) do
53
+ etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
54
+ correct_response = SharedHelpers.filesystem_access(local_temp_path) do
54
55
  if response.is_a?(Net::HTTPPartialContent) && local_temp_path.size.nonzero?
55
56
  local_temp_path.open("a") {|f| f << slice_body(content, 1..-1) }
57
+
58
+ etag_for(local_temp_path) == etag
56
59
  else
57
- local_temp_path.open("w") {|f| f << content }
60
+ local_temp_path.open("wb") {|f| f << content }
61
+
62
+ etag.length.zero? || etag_for(local_temp_path) == etag
58
63
  end
59
64
  end
60
65
 
61
- etag = (response["ETag"] || "").gsub(%r{\AW/}, "")
62
- if etag.length.zero? || etag_for(local_temp_path) == etag
66
+ if correct_response
63
67
  SharedHelpers.filesystem_access(local_path) do
64
68
  FileUtils.mv(local_temp_path, local_path)
65
69
  end
@@ -92,11 +96,11 @@ module Bundler
92
96
 
93
97
  def checksum_for_file(path)
94
98
  return nil unless path.file?
95
- # This must use IO.read instead of Digest.file().hexdigest
99
+ # This must use File.read instead of Digest.file().hexdigest
96
100
  # because we need to preserve \n line endings on windows when calculating
97
101
  # the checksum
98
102
  SharedHelpers.filesystem_access(path, :read) do
99
- SharedHelpers.digest(:MD5).hexdigest(IO.read(path))
103
+ SharedHelpers.digest(:MD5).hexdigest(File.read(path))
100
104
  end
101
105
  end
102
106
  end
@@ -20,6 +20,7 @@ module Bundler
20
20
  2.5
21
21
  2.6
22
22
  2.7
23
+ 3.0
23
24
  ].freeze
24
25
 
25
26
  KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
@@ -106,6 +106,17 @@ module Bundler
106
106
  @locked_platforms = []
107
107
  end
108
108
 
109
+ @locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
110
+ @disable_multisource = @locked_gem_sources.all?(&:disable_multisource?)
111
+
112
+ unless @disable_multisource
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."
114
+
115
+ Bundler::SharedHelpers.major_deprecation 2, msg
116
+
117
+ @sources.merged_gem_lockfile_sections!
118
+ end
119
+
109
120
  @unlock[:gems] ||= []
110
121
  @unlock[:sources] ||= []
111
122
  @unlock[:ruby] ||= if @ruby_version && locked_ruby_version_object
@@ -145,17 +156,19 @@ module Bundler
145
156
  end
146
157
  end
147
158
 
159
+ def disable_multisource?
160
+ @disable_multisource
161
+ end
162
+
148
163
  def resolve_with_cache!
149
- raise "Specs already loaded" if @specs
150
164
  sources.cached!
151
- specs
165
+ resolve
152
166
  end
153
167
 
154
168
  def resolve_remotely!
155
- return if @specs
156
169
  @remote = true
157
170
  sources.remote!
158
- specs
171
+ resolve
159
172
  end
160
173
 
161
174
  # For given dependency list returns a SpecSet with Gemspec of all the required
@@ -172,10 +185,10 @@ module Bundler
172
185
  gem_name, gem_version = extract_gem_info(e)
173
186
  locked_gem = @locked_specs[gem_name].last
174
187
  raise if locked_gem.nil? || locked_gem.version.to_s != gem_version || !@remote
175
- raise GemNotFound, "Your bundle is locked to #{locked_gem}, but that version could not " \
176
- "be found in any of the sources listed in your Gemfile. If you haven't changed sources, " \
177
- "that means the author of #{locked_gem} has removed it. You'll need to update your bundle " \
178
- "to a version other than #{locked_gem} that hasn't been removed in order to install."
188
+ raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
189
+ "no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
190
+ "You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
191
+ "removed in order to install."
179
192
  end
180
193
  unless specs["bundler"].any?
181
194
  bundler = sources.metadata_source.specs.search(Gem::Dependency.new("bundler", VERSION)).last
@@ -530,6 +543,9 @@ module Bundler
530
543
  attr_reader :sources
531
544
  private :sources
532
545
 
546
+ attr_reader :locked_gem_sources
547
+ private :locked_gem_sources
548
+
533
549
  def nothing_changed?
534
550
  !@source_changes && !@dependency_changes && !@new_platform && !@path_changes && !@local_changes && !@locked_specs_incomplete_for_platform
535
551
  end
@@ -654,10 +670,8 @@ module Bundler
654
670
  end
655
671
 
656
672
  def converge_rubygems_sources
657
- return false if Bundler.feature_flag.disable_multisource?
673
+ return false if disable_multisource?
658
674
 
659
- # Get the RubyGems sources from the Gemfile.lock
660
- locked_gem_sources = @locked_sources.select {|s| s.is_a?(Source::Rubygems) }
661
675
  return false if locked_gem_sources.empty?
662
676
 
663
677
  # Get the RubyGems remotes from the Gemfile
@@ -943,7 +957,7 @@ module Bundler
943
957
  end
944
958
 
945
959
  def additional_base_requirements_for_resolve
946
- return [] unless @locked_gems && Bundler.feature_flag.only_update_to_newer_versions?
960
+ return [] unless @locked_gems
947
961
  dependencies_by_name = dependencies.inject({}) {|memo, dep| memo.update(dep.name => dep) }
948
962
  @locked_gems.specs.reduce({}) do |requirements, locked_spec|
949
963
  name = locked_spec.name
data/lib/bundler/dsl.rb CHANGED
@@ -460,19 +460,16 @@ repo_name ||= user_name
460
460
  @sources.add_rubygems_remote(source)
461
461
  end
462
462
 
463
- if Bundler.feature_flag.disable_multisource?
463
+ if Bundler.feature_flag.bundler_3_mode?
464
464
  msg = "This Gemfile contains multiple primary sources. " \
465
465
  "Each source after the first must include a block to indicate which gems " \
466
- "should come from that source. To downgrade this error to a warning, run " \
467
- "`bundle config unset disable_multisource`"
466
+ "should come from that source"
468
467
  raise GemfileEvalError, msg
469
468
  else
470
469
  Bundler::SharedHelpers.major_deprecation 2, "Your Gemfile contains multiple primary sources. " \
471
470
  "Using `source` more than once without a block is a security risk, and " \
472
471
  "may result in installing unexpected gems. To resolve this warning, use " \
473
- "a block to indicate which gems should come from the secondary source. " \
474
- "To upgrade this warning to an error, run `bundle config set --local " \
475
- "disable_multisource true`."
472
+ "a block to indicate which gems should come from the secondary source."
476
473
  end
477
474
  end
478
475
 
@@ -35,7 +35,6 @@ module Bundler
35
35
  settings_flag(:disable_multisource) { bundler_3_mode? }
36
36
  settings_flag(:forget_cli_options) { bundler_3_mode? }
37
37
  settings_flag(:global_gem_cache) { bundler_3_mode? }
38
- settings_flag(:only_update_to_newer_versions) { bundler_3_mode? }
39
38
  settings_flag(:path_relative_to_cwd) { bundler_3_mode? }
40
39
  settings_flag(:plugins) { @bundler_version >= Gem::Version.new("1.14") }
41
40
  settings_flag(:print_only_version_number) { bundler_3_mode? }
@@ -14,8 +14,10 @@ module Bundler
14
14
  def fetch(uri, headers = {}, counter = 0)
15
15
  raise HTTPError, "Too many redirects" if counter >= redirect_limit
16
16
 
17
+ filtered_uri = URICredentialsFilter.credential_filtered_uri(uri)
18
+
17
19
  response = request(uri, headers)
18
- Bundler.ui.debug("HTTP #{response.code} #{response.message} #{uri}")
20
+ Bundler.ui.debug("HTTP #{response.code} #{response.message} #{filtered_uri}")
19
21
 
20
22
  case response
21
23
  when Net::HTTPSuccess, Net::HTTPNotModified
@@ -40,7 +42,7 @@ module Bundler
40
42
  raise BadAuthenticationError, uri.host if uri.userinfo
41
43
  raise AuthenticationRequiredError, uri.host
42
44
  when Net::HTTPNotFound
43
- raise FallbackError, "Net::HTTPNotFound: #{URICredentialsFilter.credential_filtered_uri(uri)}"
45
+ raise FallbackError, "Net::HTTPNotFound: #{filtered_uri}"
44
46
  else
45
47
  raise HTTPError, "#{response.class}#{": #{response.body}" unless response.body.empty?}"
46
48
  end
@@ -49,7 +51,9 @@ module Bundler
49
51
  def request(uri, headers)
50
52
  validate_uri_scheme!(uri)
51
53
 
52
- Bundler.ui.debug "HTTP GET #{uri}"
54
+ filtered_uri = URICredentialsFilter.credential_filtered_uri(uri)
55
+
56
+ Bundler.ui.debug "HTTP GET #{filtered_uri}"
53
57
  req = Net::HTTP::Get.new uri.request_uri, headers
54
58
  if uri.user
55
59
  user = CGI.unescape(uri.user)
@@ -69,7 +73,7 @@ module Bundler
69
73
  raise NetworkDownError, "Could not reach host #{uri.host}. Check your network " \
70
74
  "connection and try again."
71
75
  else
72
- raise HTTPError, "Network error while fetching #{URICredentialsFilter.credential_filtered_uri(uri)}" \
76
+ raise HTTPError, "Network error while fetching #{filtered_uri}" \
73
77
  " (#{e})"
74
78
  end
75
79
  end
@@ -47,7 +47,8 @@ module Bundler
47
47
  remote_uri = filter_uri(remote_uri)
48
48
  super "Authentication is required for #{remote_uri}.\n" \
49
49
  "Please supply credentials for this source. You can do this by running:\n" \
50
- " bundle config set --global #{remote_uri} username:password"
50
+ "`bundle config set --global #{remote_uri} username:password`\n" \
51
+ "or by storing the credentials in the `#{Settings.key_for(remote_uri)}` environment variable"
51
52
  end
52
53
  end
53
54
  # This error is raised if HTTP authentication is provided, but incorrect.
@@ -47,6 +47,11 @@ module Bundler
47
47
  built_gem_path = build_gem
48
48
  end
49
49
 
50
+ desc "Generate SHA512 checksum if #{name}-#{version}.gem into the checksums directory."
51
+ task "build:checksum" => "build" do
52
+ build_checksum(built_gem_path)
53
+ end
54
+
50
55
  desc "Build and install #{name}-#{version}.gem into system gems."
51
56
  task "install" => "build" do
52
57
  install_gem(built_gem_path)
@@ -100,6 +105,17 @@ module Bundler
100
105
  Bundler.ui.confirm "#{name} (#{version}) installed."
101
106
  end
102
107
 
108
+ def build_checksum(built_gem_path = nil)
109
+ built_gem_path ||= build_gem
110
+ SharedHelpers.filesystem_access(File.join(base, "checksums")) {|p| FileUtils.mkdir_p(p) }
111
+ file_name = "#{File.basename(built_gem_path)}.sha512"
112
+ require "digest/sha2"
113
+ checksum = Digest::SHA512.new.hexdigest(built_gem_path.to_s)
114
+ target = File.join(base, "checksums", file_name)
115
+ File.write(target, checksum)
116
+ Bundler.ui.confirm "#{name} #{version} checksum written to checksums/#{file_name}."
117
+ end
118
+
103
119
  protected
104
120
 
105
121
  def rubygem_push(path)