rubygems-update 3.3.3 → 3.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +67 -0
  3. data/CONTRIBUTING.md +9 -6
  4. data/Manifest.txt +0 -1
  5. data/bundler/CHANGELOG.md +50 -0
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/cli/config.rb +10 -1
  8. data/bundler/lib/bundler/cli/doctor.rb +9 -1
  9. data/bundler/lib/bundler/cli/gem.rb +11 -1
  10. data/bundler/lib/bundler/cli/info.rb +10 -1
  11. data/bundler/lib/bundler/cli/install.rb +6 -25
  12. data/bundler/lib/bundler/cli/platform.rb +1 -1
  13. data/bundler/lib/bundler/cli/update.rb +6 -2
  14. data/bundler/lib/bundler/cli.rb +3 -10
  15. data/bundler/lib/bundler/compact_index_client/cache.rb +0 -9
  16. data/bundler/lib/bundler/compact_index_client.rb +0 -6
  17. data/bundler/lib/bundler/definition.rb +2 -9
  18. data/bundler/lib/bundler/endpoint_specification.rb +21 -3
  19. data/bundler/lib/bundler/env.rb +1 -1
  20. data/bundler/lib/bundler/fetcher/compact_index.rb +0 -10
  21. data/bundler/lib/bundler/fetcher/index.rb +0 -26
  22. data/bundler/lib/bundler/fetcher.rb +9 -14
  23. data/bundler/lib/bundler/gem_helper.rb +2 -2
  24. data/bundler/lib/bundler/lazy_specification.rb +2 -2
  25. data/bundler/lib/bundler/lockfile_generator.rb +1 -1
  26. data/bundler/lib/bundler/remote_specification.rb +7 -0
  27. data/bundler/lib/bundler/resolver/spec_group.rb +1 -1
  28. data/bundler/lib/bundler/resolver.rb +7 -12
  29. data/bundler/lib/bundler/ruby_version.rb +1 -1
  30. data/bundler/lib/bundler/rubygems_ext.rb +13 -10
  31. data/bundler/lib/bundler/rubygems_integration.rb +2 -14
  32. data/bundler/lib/bundler/self_manager.rb +106 -14
  33. data/bundler/lib/bundler/settings.rb +1 -1
  34. data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
  35. data/bundler/lib/bundler/templates/newgem/standard.yml.tt +1 -0
  36. data/bundler/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +1 -1
  37. data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +1 -4
  38. data/bundler/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
  39. data/bundler/lib/bundler/version.rb +1 -1
  40. data/bundler/lib/bundler.rb +1 -1
  41. data/lib/rubygems/basic_specification.rb +8 -8
  42. data/lib/rubygems/bundler_version_finder.rb +3 -3
  43. data/lib/rubygems/command.rb +4 -4
  44. data/lib/rubygems/commands/cleanup_command.rb +6 -6
  45. data/lib/rubygems/commands/dependency_command.rb +20 -30
  46. data/lib/rubygems/commands/fetch_command.rb +27 -8
  47. data/lib/rubygems/commands/list_command.rb +1 -1
  48. data/lib/rubygems/commands/pristine_command.rb +12 -12
  49. data/lib/rubygems/commands/push_command.rb +8 -8
  50. data/lib/rubygems/commands/query_command.rb +1 -1
  51. data/lib/rubygems/commands/rdoc_command.rb +6 -6
  52. data/lib/rubygems/commands/search_command.rb +1 -1
  53. data/lib/rubygems/commands/setup_command.rb +8 -8
  54. data/lib/rubygems/commands/specification_command.rb +4 -4
  55. data/lib/rubygems/commands/update_command.rb +11 -8
  56. data/lib/rubygems/config_file.rb +4 -4
  57. data/lib/rubygems/doctor.rb +5 -5
  58. data/lib/rubygems/gem_runner.rb +5 -5
  59. data/lib/rubygems/install_update_options.rb +4 -4
  60. data/lib/rubygems/installer.rb +51 -12
  61. data/lib/rubygems/package/old.rb +1 -1
  62. data/lib/rubygems/package.rb +11 -11
  63. data/lib/rubygems/platform.rb +42 -42
  64. data/lib/rubygems/psych_additions.rb +1 -1
  65. data/lib/rubygems/query_utils.rb +16 -18
  66. data/lib/rubygems/remote_fetcher.rb +4 -4
  67. data/lib/rubygems/request_set/lockfile.rb +4 -4
  68. data/lib/rubygems/resolver/installer_set.rb +9 -9
  69. data/lib/rubygems/safe_yaml.rb +8 -8
  70. data/lib/rubygems/security.rb +1 -1
  71. data/lib/rubygems/source.rb +6 -6
  72. data/lib/rubygems/source_list.rb +7 -7
  73. data/lib/rubygems/spec_fetcher.rb +25 -25
  74. data/lib/rubygems/specification.rb +51 -52
  75. data/lib/rubygems/specification_policy.rb +16 -16
  76. data/lib/rubygems/stub_specification.rb +16 -19
  77. data/lib/rubygems/uninstaller.rb +7 -7
  78. data/lib/rubygems/user_interaction.rb +12 -12
  79. data/lib/rubygems/version.rb +12 -9
  80. data/lib/rubygems.rb +11 -17
  81. data/rubygems-update.gemspec +1 -1
  82. data/test/rubygems/helper.rb +10 -10
  83. data/test/rubygems/test_gem.rb +2 -0
  84. data/test/rubygems/test_gem_command_manager.rb +1 -1
  85. data/test/rubygems/test_gem_commands_fetch_command.rb +97 -0
  86. data/test/rubygems/test_gem_commands_install_command.rb +16 -0
  87. data/test/rubygems/test_gem_commands_update_command.rb +59 -0
  88. data/test/rubygems/test_gem_installer.rb +170 -58
  89. data/test/rubygems/test_gem_package.rb +2 -2
  90. data/test/rubygems/test_gem_stream_ui.rb +1 -1
  91. data/test/rubygems/test_gem_stub_specification.rb +0 -16
  92. data/test/rubygems/test_gem_version.rb +4 -0
  93. data/test/rubygems/test_rubygems.rb +5 -1
  94. data/test/rubygems/utilities.rb +4 -4
  95. metadata +3 -4
  96. data/bundler/lib/bundler/psyched_yaml.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 750773ce8a64c0d956a7a38abc7e14a70a361510081982f6e34dbbf85c5cbf65
4
- data.tar.gz: a6963c67ef4e2300c549c3d95b5d1e67ff54afcff113215b0a35e7f11973bdec
3
+ metadata.gz: b7e96274d90e70cc45d1f6cba5c18a1c898ba6a0e2ddc92e6672728f02d925d1
4
+ data.tar.gz: b500012456304ad00145b45e6bc445c66c862449fa74caac38479a3f95756391
5
5
  SHA512:
6
- metadata.gz: 158cd64df064a030d8d350f0f66f9d9805018fea3dba122349a1ad239db0579e832d021035bb8f33cccb78f7a227fcfd0ceb4b0a4602a944102c12378f6b480e
7
- data.tar.gz: d359d94fd7939b2c21f0830d64eb1d60d7b3dff016cb7e25299ca7391a24d76970cadb1a3287144a0354d72cf9461a1ca98faf22359e18df799a3a360580dd67
6
+ metadata.gz: f0564004157c5774da9938d81600a29cb21a0a0c7c5c55210ad8808b0597d4e7e3b2b38b8042617ffb0e41df2e55aeca7d492b50786ac3f6778113c319e20c75
7
+ data.tar.gz: 4ffe6bdcb96a183a2bb821068dad97838375100d031abf4be839ddafeb3e9351db0adb067eff9e3384b4d0f6b70097a878d5b2785ca3d58261e0368ca4b4f3f4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,70 @@
1
+ # 3.3.7 / 2022-02-09
2
+
3
+ ## Enhancements:
4
+
5
+ * Installs bundler 2.3.7 as a default gem.
6
+
7
+ ## Documentation:
8
+
9
+ * Fix missing rdoc for `Gem::Version`. Pull request #5299 by nevans
10
+
11
+ # 3.3.6 / 2022-01-26
12
+
13
+ ## Enhancements:
14
+
15
+ * Forbid downgrading past the originally shipped version on Ruby 3.1. Pull
16
+ request #5301 by deivid-rodriguez
17
+ * Support `--enable-load-relative` inside binstubs. Pull request #2929 by
18
+ deivid-rodriguez
19
+ * Let `Version#<=>` accept a String. Pull request #5275 by amatsuda
20
+ * Installs bundler 2.3.6 as a default gem.
21
+
22
+ ## Bug fixes:
23
+
24
+ * Avoid `flock` on non Windows systems, since it causing issues on NFS
25
+ file systems. Pull request #5278 by deivid-rodriguez
26
+ * Fix `gem update --system` for already installed version of
27
+ `rubygems-update`. Pull request #5285 by loadkpi
28
+
29
+ # 3.3.5 / 2022-01-12
30
+
31
+ ## Enhancements:
32
+
33
+ * Don't activate `yaml` gem from RubyGems. Pull request #5266 by
34
+ deivid-rodriguez
35
+ * Let `gem fetch` understand `<gem>:<version>` syntax and
36
+ `--[no-]suggestions` flag. Pull request #5242 by ximenasandoval
37
+ * Installs bundler 2.3.5 as a default gem.
38
+
39
+ ## Bug fixes:
40
+
41
+ * Fix `gem install <non-existent-gem> --force` crash. Pull request #5262
42
+ by deivid-rodriguez
43
+ * Fix longstanding `gem install` failure on JRuby. Pull request #5228 by
44
+ deivid-rodriguez
45
+
46
+ ## Documentation:
47
+
48
+ * Markup `Gem::Specification` documentation with RDoc notations. Pull
49
+ request #5268 by nobu
50
+
51
+ # 3.3.4 / 2021-12-29
52
+
53
+ ## Enhancements:
54
+
55
+ * Don't redownload `rubygems-update` package if already there. Pull
56
+ request #5230 by deivid-rodriguez
57
+ * Installs bundler 2.3.4 as a default gem.
58
+
59
+ ## Bug fixes:
60
+
61
+ * Fix `gem update --system` crashing when latest version not supported.
62
+ Pull request #5191 by deivid-rodriguez
63
+
64
+ ## Performance:
65
+
66
+ * Make SpecificationPolicy autoload constant. Pull request #5222 by pocke
67
+
1
68
  # 3.3.3 / 2021-12-24
2
69
 
3
70
  ## Enhancements:
data/CONTRIBUTING.md CHANGED
@@ -61,7 +61,7 @@ Everything needs to be run from the `bundler/` subfolder.
61
61
 
62
62
  To setup bundler tests:
63
63
 
64
- bin/rake spec:parallel_deps
64
+ rake spec:parallel_deps
65
65
 
66
66
  To run the entire bundler test suite in parallel (it takes a while):
67
67
 
@@ -84,11 +84,14 @@ in the rubygems repository.
84
84
  ### Contribution
85
85
 
86
86
  These labels are made to guide contributors to issue/pull requests that they
87
- can help with. That are marked with a light gray `contribution: *`
88
-
89
- * **small** - The issue described here will take a small amount of work to
90
- resolve, and is a good option for a new contributor
91
- * **unclaimed** - The issue has not been claimed for work, and is awaiting
87
+ can help with.
88
+
89
+ * **good first issue** - The issue described here is considered a good option
90
+ for a new contributor. We encourage new contributors though to work on
91
+ whichever issue they find most interesting, the ones labeled here as just
92
+ estimated to have a reasonable level of complexity for someone new to the
93
+ code base.
94
+ * **help wanted** - The issue has not been claimed for work, and is awaiting
92
95
  willing volunteers!
93
96
 
94
97
 
data/Manifest.txt CHANGED
@@ -155,7 +155,6 @@ bundler/lib/bundler/plugin/installer/git.rb
155
155
  bundler/lib/bundler/plugin/installer/rubygems.rb
156
156
  bundler/lib/bundler/plugin/source_list.rb
157
157
  bundler/lib/bundler/process_lock.rb
158
- bundler/lib/bundler/psyched_yaml.rb
159
158
  bundler/lib/bundler/remote_specification.rb
160
159
  bundler/lib/bundler/resolver.rb
161
160
  bundler/lib/bundler/resolver/spec_group.rb
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,53 @@
1
+ # 2.3.7 (February 9, 2022)
2
+
3
+ ## Enhancements:
4
+
5
+ - Don't activate `yaml` gem from Bundler [#5277](https://github.com/rubygems/rubygems/pull/5277)
6
+ - Add Reverse Dependencies section to info command [#3966](https://github.com/rubygems/rubygems/pull/3966)
7
+
8
+ ## Bug fixes:
9
+
10
+ - Don't silently persist `BUNDLE_WITH` and `BUNDLE_WITHOUT` envs locally [#5335](https://github.com/rubygems/rubygems/pull/5335)
11
+ - Fix `bundle config` inside an application saving configuration globally [#4152](https://github.com/rubygems/rubygems/pull/4152)
12
+
13
+ # 2.3.6 (January 26, 2022)
14
+
15
+ ## Enhancements:
16
+
17
+ - Use `Gem::Platform.local` instead of `RUBY_PLATFORM` when displaying local platform [#5306](https://github.com/rubygems/rubygems/pull/5306)
18
+ - Lock standard.yml to the required ruby version [#5284](https://github.com/rubygems/rubygems/pull/5284)
19
+ - Use `Fiddle` in `bundle doctor` to check for dynamic library presence [#5173](https://github.com/rubygems/rubygems/pull/5173)
20
+
21
+ ## Bug fixes:
22
+
23
+ - Fix edge case where gems were incorrectly removed from the lockfile [#5302](https://github.com/rubygems/rubygems/pull/5302)
24
+ - Fix `force_ruby_platform` ignored when lockfile includes current specific platform [#5304](https://github.com/rubygems/rubygems/pull/5304)
25
+ - Create minitest file to underscored path in "bundle gem" command with dashed gem name [#5273](https://github.com/rubygems/rubygems/pull/5273)
26
+ - Fix regression with old marshaled specs having null `required_rubygems_version` [#5291](https://github.com/rubygems/rubygems/pull/5291)
27
+
28
+ # 2.3.5 (January 12, 2022)
29
+
30
+ ## Enhancements:
31
+
32
+ - Make `bundle update --bundler` actually lock to the latest bundler version (even if not yet installed) [#5182](https://github.com/rubygems/rubygems/pull/5182)
33
+ - Use thor-1.2.1 [#5260](https://github.com/rubygems/rubygems/pull/5260)
34
+ - Exclude bin directory for newgem template [#5259](https://github.com/rubygems/rubygems/pull/5259)
35
+
36
+ ## Bug fixes:
37
+
38
+ - Fix metadata requirements being bypassed when custom gem servers are used [#5256](https://github.com/rubygems/rubygems/pull/5256)
39
+ - Fix `rake build:checksum` writing checksum of package path, not package contents [#5250](https://github.com/rubygems/rubygems/pull/5250)
40
+
41
+ # 2.3.4 (December 29, 2021)
42
+
43
+ ## Enhancements:
44
+
45
+ - Improve error message when `BUNDLED WITH` version does not exist [#5205](https://github.com/rubygems/rubygems/pull/5205)
46
+
47
+ ## Bug fixes:
48
+
49
+ - Fix `bundle update --bundler` no longer updating lockfile [#5224](https://github.com/rubygems/rubygems/pull/5224)
50
+
1
51
  # 2.3.3 (December 24, 2021)
2
52
 
3
53
  ## Bug fixes:
@@ -4,8 +4,8 @@ module Bundler
4
4
  # Represents metadata from when the Bundler gem was built.
5
5
  module BuildMetadata
6
6
  # begin ivars
7
- @built_at = "2021-12-24".freeze
8
- @git_commit_sha = "688b71febc".freeze
7
+ @built_at = "2022-02-09".freeze
8
+ @git_commit_sha = "bafe43c593".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -180,7 +180,7 @@ module Bundler
180
180
  scopes = %w[global local].select {|s| options[s] }
181
181
  case scopes.size
182
182
  when 0
183
- @scope = "global"
183
+ @scope = inside_app? ? "local" : "global"
184
184
  @explicit_scope = false
185
185
  when 1
186
186
  @scope = scopes.first
@@ -189,6 +189,15 @@ module Bundler
189
189
  "The options #{scopes.join " and "} were specified. Please only use one of the switches at a time."
190
190
  end
191
191
  end
192
+
193
+ private
194
+
195
+ def inside_app?
196
+ Bundler.root
197
+ true
198
+ rescue GemfileNotFound
199
+ false
200
+ end
192
201
  end
193
202
  end
194
203
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "rbconfig"
4
4
  require "shellwords"
5
+ require "fiddle"
5
6
 
6
7
  module Bundler
7
8
  class CLI::Doctor
@@ -71,7 +72,14 @@ module Bundler
71
72
 
72
73
  definition.specs.each do |spec|
73
74
  bundles_for_gem(spec).each do |bundle|
74
- bad_paths = dylibs(bundle).select {|f| !File.exist?(f) }
75
+ bad_paths = dylibs(bundle).select do |f|
76
+ begin
77
+ Fiddle.dlopen(f)
78
+ false
79
+ rescue Fiddle::DLError
80
+ true
81
+ end
82
+ end
75
83
  if bad_paths.any?
76
84
  broken_links[spec] ||= []
77
85
  broken_links[spec].concat(bad_paths)
@@ -38,6 +38,7 @@ module Bundler
38
38
  namespaced_path = name.tr("-", "/")
39
39
  constant_name = name.gsub(/-[_-]*(?![_-]|$)/) { "::" }.gsub(/([_-]+|(::)|^)(.|$)/) { $2.to_s + $3.upcase }
40
40
  constant_array = constant_name.split("::")
41
+ minitest_constant_name = constant_array.clone.tap {|a| a[-1] = "Test#{a[-1]}" }.join("::") # Foo::Bar => Foo::TestBar
41
42
 
42
43
  use_git = Bundler.git_present? && options[:git]
43
44
 
@@ -69,6 +70,7 @@ module Bundler
69
70
  :git => use_git,
70
71
  :github_username => github_username.empty? ? "[USERNAME]" : github_username,
71
72
  :required_ruby_version => required_ruby_version,
73
+ :minitest_constant_name => minitest_constant_name,
72
74
  }
73
75
  ensure_safe_gem_name(name, constant_array)
74
76
 
@@ -104,9 +106,17 @@ module Bundler
104
106
  )
105
107
  config[:test_task] = :spec
106
108
  when "minitest"
109
+ # Generate path for minitest target file (FileList["test/**/test_*.rb"])
110
+ # foo => test/test_foo.rb
111
+ # foo-bar => test/foo/test_bar.rb
112
+ # foo_bar => test/test_foo_bar.rb
113
+ paths = namespaced_path.rpartition("/")
114
+ paths[2] = "test_#{paths[2]}"
115
+ minitest_namespaced_path = paths.join("")
116
+
107
117
  templates.merge!(
108
118
  "test/minitest/test_helper.rb.tt" => "test/test_helper.rb",
109
- "test/minitest/test_newgem.rb.tt" => "test/test_#{namespaced_path}.rb"
119
+ "test/minitest/test_newgem.rb.tt" => "test/#{minitest_namespaced_path}.rb"
110
120
  )
111
121
  config[:test_task] = :test
112
122
  when "test-unit"
@@ -73,7 +73,8 @@ module Bundler
73
73
  gem_info << "\tBug Tracker: #{metadata["bug_tracker_uri"]}\n" if metadata.key?("bug_tracker_uri")
74
74
  gem_info << "\tMailing List: #{metadata["mailing_list_uri"]}\n" if metadata.key?("mailing_list_uri")
75
75
  gem_info << "\tPath: #{spec.full_gem_path}\n"
76
- gem_info << "\tDefault Gem: yes" if spec.respond_to?(:default_gem?) && spec.default_gem?
76
+ gem_info << "\tDefault Gem: yes\n" if spec.respond_to?(:default_gem?) && spec.default_gem?
77
+ gem_info << "\tReverse Dependencies: \n\t\t#{gem_dependencies.join("\n\t\t")}" if gem_dependencies.any?
77
78
 
78
79
  if name != "bundler" && spec.deleted_gem?
79
80
  return Bundler.ui.warn "The gem #{name} has been deleted. Gemspec information is still available though:\n#{gem_info}"
@@ -81,5 +82,13 @@ module Bundler
81
82
 
82
83
  Bundler.ui.info gem_info
83
84
  end
85
+
86
+ def gem_dependencies
87
+ @gem_dependencies ||= Bundler.definition.specs.map do |spec|
88
+ dependency = spec.dependencies.find {|dep| dep.name == gem_name }
89
+ next unless dependency
90
+ "#{spec.name} (#{spec.version}) depends on #{gem_name} (#{dependency.requirements_list.join(", ")})"
91
+ end.compact.sort
92
+ end
84
93
  end
85
94
  end
@@ -135,32 +135,13 @@ module Bundler
135
135
  end
136
136
 
137
137
  def normalize_groups
138
- options[:with] &&= options[:with].join(":").tr(" ", ":").split(":")
139
- options[:without] &&= options[:without].join(":").tr(" ", ":").split(":")
140
-
141
138
  check_for_group_conflicts_in_cli_options
142
139
 
143
- Bundler.settings.set_command_option :with, nil if options[:with] == []
144
- Bundler.settings.set_command_option :without, nil if options[:without] == []
145
-
146
- with = options.fetch(:with, [])
147
- with |= Bundler.settings[:with].map(&:to_s)
148
- with -= options[:without] if options[:without]
149
-
150
- without = options.fetch(:without, [])
151
- without |= Bundler.settings[:without].map(&:to_s)
152
- without -= options[:with] if options[:with]
153
-
154
- options[:with] = with
155
- options[:without] = without
156
-
157
- unless Bundler.settings[:without] == options[:without] && Bundler.settings[:with] == options[:with]
158
- # need to nil them out first to get around validation for backwards compatibility
159
- Bundler.settings.set_command_option :without, nil
160
- Bundler.settings.set_command_option :with, nil
161
- Bundler.settings.set_command_option :without, options[:without] - options[:with]
162
- Bundler.settings.set_command_option :with, options[:with]
163
- end
140
+ # need to nil them out first to get around validation for backwards compatibility
141
+ Bundler.settings.set_command_option :without, nil
142
+ Bundler.settings.set_command_option :with, nil
143
+ Bundler.settings.set_command_option :without, options[:without]
144
+ Bundler.settings.set_command_option :with, options[:with]
164
145
  end
165
146
 
166
147
  def normalize_settings
@@ -184,7 +165,7 @@ module Bundler
184
165
 
185
166
  Bundler.settings.set_command_option_if_given :clean, options["clean"]
186
167
 
187
- normalize_groups
168
+ normalize_groups if options[:without] || options[:with]
188
169
 
189
170
  options[:force] = options[:redownload]
190
171
  end
@@ -23,7 +23,7 @@ module Bundler
23
23
  output << "No ruby version specified"
24
24
  end
25
25
  else
26
- output << "Your platform is: #{RUBY_PLATFORM}"
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
@@ -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] && !options[:bundler]
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 => options[:bundler])
56
+ :bundler => update_bundler)
53
57
  end
54
58
 
55
59
  Bundler::CLI::Common.configure_gem_version_promoter(Bundler.definition, options)
@@ -809,17 +809,10 @@ module Bundler
809
809
 
810
810
  current = Gem::Version.new(VERSION)
811
811
  return if current >= latest
812
- latest_installed = Bundler.rubygems.find_name("bundler").map(&:version).max
813
812
 
814
- installation = "To install the latest version, run `gem install bundler#{" --pre" if latest.prerelease?}`"
815
- if latest_installed && latest_installed > current
816
- suggestion = "To update to the most recent installed version (#{latest_installed}), run `bundle update --bundler`"
817
- suggestion = "#{installation}\n#{suggestion}" if latest_installed < latest
818
- else
819
- suggestion = installation
820
- end
821
-
822
- Bundler.ui.warn "The latest bundler is #{latest}, but you are currently running #{current}.\n#{suggestion}"
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`"
823
816
  rescue RuntimeError
824
817
  nil
825
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)
@@ -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
@@ -265,7 +265,7 @@ module Bundler
265
265
  else
266
266
  # Run a resolve against the locally available gems
267
267
  Bundler.ui.debug("Found changes from the lockfile, re-resolving dependencies because #{change_reason}")
268
- expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, @remote)
268
+ expanded_dependencies = expand_dependencies(dependencies + metadata_dependencies, true)
269
269
  Resolver.resolve(expanded_dependencies, source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms)
270
270
  end
271
271
  end
@@ -309,14 +309,6 @@ module Bundler
309
309
  end
310
310
  end
311
311
 
312
- def locked_bundler_version
313
- if @locked_bundler_version && @locked_bundler_version < Gem::Version.new(Bundler::VERSION)
314
- new_version = Bundler::VERSION
315
- end
316
-
317
- new_version || @locked_bundler_version || Bundler::VERSION
318
- end
319
-
320
312
  def locked_ruby_version
321
313
  return unless ruby_version
322
314
  if @unlock[:ruby] || !@locked_ruby_version
@@ -503,6 +495,7 @@ module Bundler
503
495
 
504
496
  def current_ruby_platform_locked?
505
497
  return false unless generic_local_platform == Gem::Platform::RUBY
498
+ return false if Bundler.settings[:force_ruby_platform] && !@platforms.include?(Gem::Platform::RUBY)
506
499
 
507
500
  current_platform_locked?
508
501
  end
@@ -5,14 +5,15 @@ module Bundler
5
5
  class EndpointSpecification < Gem::Specification
6
6
  include MatchPlatform
7
7
 
8
- attr_reader :name, :version, :platform, :required_rubygems_version, :required_ruby_version, :checksum
8
+ attr_reader :name, :version, :platform, :checksum
9
9
  attr_accessor :source, :remote, :dependencies
10
10
 
11
- def initialize(name, version, platform, dependencies, metadata = nil)
11
+ def initialize(name, version, platform, spec_fetcher, dependencies, metadata = nil)
12
12
  super()
13
13
  @name = name
14
14
  @version = Gem::Version.create version
15
15
  @platform = platform
16
+ @spec_fetcher = spec_fetcher
16
17
  @dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) }
17
18
 
18
19
  @loaded_from = nil
@@ -21,6 +22,14 @@ module Bundler
21
22
  parse_metadata(metadata)
22
23
  end
23
24
 
25
+ def required_ruby_version
26
+ @required_ruby_version ||= _remote_specification.required_ruby_version
27
+ end
28
+
29
+ def required_rubygems_version
30
+ @required_rubygems_version ||= _remote_specification.required_rubygems_version
31
+ end
32
+
24
33
  def fetch_platform
25
34
  @platform
26
35
  end
@@ -105,12 +114,21 @@ module Bundler
105
114
 
106
115
  private
107
116
 
117
+ def _remote_specification
118
+ @_remote_specification ||= @spec_fetcher.fetch_spec([@name, @version, @platform])
119
+ end
120
+
108
121
  def local_specification_path
109
122
  "#{base_dir}/specifications/#{full_name}.gemspec"
110
123
  end
111
124
 
112
125
  def parse_metadata(data)
113
- return unless data
126
+ unless data
127
+ @required_ruby_version = nil
128
+ @required_rubygems_version = nil
129
+ return
130
+ end
131
+
114
132
  data.each do |k, v|
115
133
  next unless v
116
134
  case k.to_s
@@ -71,7 +71,7 @@ module Bundler
71
71
  def self.ruby_version
72
72
  str = String.new(RUBY_VERSION)
73
73
  str << "p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
74
- str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{RUBY_PLATFORM}]"
74
+ str << " (#{RUBY_RELEASE_DATE} revision #{RUBY_REVISION}) [#{Gem::Platform.local}]"
75
75
  end
76
76
 
77
77
  def self.git_version
@@ -57,16 +57,6 @@ module Bundler
57
57
  gem_info
58
58
  end
59
59
 
60
- def fetch_spec(spec)
61
- spec -= [nil, "ruby", ""]
62
- contents = compact_index_client.spec(*spec)
63
- return nil if contents.nil?
64
- contents.unshift(spec.first)
65
- contents[3].map! {|d| Gem::Dependency.new(*d) }
66
- EndpointSpecification.new(*contents)
67
- end
68
- compact_index_request :fetch_spec
69
-
70
60
  def available?
71
61
  unless SharedHelpers.md5_available?
72
62
  Bundler.ui.debug("FIPS mode is enabled, bundler can't use the CompactIndex API")
@@ -21,32 +21,6 @@ module Bundler
21
21
  raise HTTPError, "Could not fetch specs from #{display_uri} due to underlying error <#{e.message}>"
22
22
  end
23
23
  end
24
-
25
- def fetch_spec(spec)
26
- spec -= [nil, "ruby", ""]
27
- spec_file_name = "#{spec.join "-"}.gemspec"
28
-
29
- uri = Bundler::URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
30
- if uri.scheme == "file"
31
- path = Bundler.rubygems.correct_for_windows_path(uri.path)
32
- Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
33
- elsif cached_spec_path = gemspec_cached_path(spec_file_name)
34
- Bundler.load_gemspec(cached_spec_path)
35
- else
36
- Bundler.load_marshal Bundler.rubygems.inflate(downloader.fetch(uri).body)
37
- end
38
- rescue MarshalError
39
- raise HTTPError, "Gemspec #{spec} contained invalid data.\n" \
40
- "Your network or your gem server is probably having issues right now."
41
- end
42
-
43
- private
44
-
45
- # cached gem specification path, if one exists
46
- def gemspec_cached_path(spec_file_name)
47
- paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
48
- paths.find {|path| File.file? path }
49
- end
50
24
  end
51
25
  end
52
26
  end
@@ -129,17 +129,15 @@ module Bundler
129
129
  specs = fetchers.last.specs(gem_names)
130
130
  else
131
131
  specs = []
132
- fetchers.shift until fetchers.first.available? || fetchers.empty?
133
- fetchers.dup.each do |f|
134
- break unless f.api_fetcher? && !gem_names || !specs = f.specs(gem_names)
135
- fetchers.delete(f)
132
+ @fetchers = fetchers.drop_while do |f|
133
+ !f.available? || (f.api_fetcher? && !gem_names) || !specs = f.specs(gem_names)
136
134
  end
137
135
  @use_api = false if fetchers.none?(&:api_fetcher?)
138
136
  end
139
137
 
140
138
  specs.each do |name, version, platform, dependencies, metadata|
141
139
  spec = if dependencies
142
- EndpointSpecification.new(name, version, platform, dependencies, metadata)
140
+ EndpointSpecification.new(name, version, platform, self, dependencies, metadata)
143
141
  else
144
142
  RemoteSpecification.new(name, version, platform, self)
145
143
  end
@@ -242,7 +240,7 @@ module Bundler
242
240
  raise SSLError if needs_ssl && !defined?(OpenSSL::SSL)
243
241
 
244
242
  con = PersistentHTTP.new :name => "bundler", :proxy => :ENV
245
- if gem_proxy = Bundler.rubygems.configuration[:http_proxy]
243
+ if gem_proxy = Gem.configuration[:http_proxy]
246
244
  con.proxy = Bundler::URI.parse(gem_proxy) if gem_proxy != :no_proxy
247
245
  end
248
246
 
@@ -253,8 +251,8 @@ module Bundler
253
251
  end
254
252
 
255
253
  ssl_client_cert = Bundler.settings[:ssl_client_cert] ||
256
- (Bundler.rubygems.configuration.ssl_client_cert if
257
- Bundler.rubygems.configuration.respond_to?(:ssl_client_cert))
254
+ (Gem.configuration.ssl_client_cert if
255
+ Gem.configuration.respond_to?(:ssl_client_cert))
258
256
  if ssl_client_cert
259
257
  pem = File.read(ssl_client_cert)
260
258
  con.cert = OpenSSL::X509::Certificate.new(pem)
@@ -272,8 +270,7 @@ module Bundler
272
270
  # cached gem specification path, if one exists
273
271
  def gemspec_cached_path(spec_file_name)
274
272
  paths = Bundler.rubygems.spec_cache_dirs.map {|dir| File.join(dir, spec_file_name) }
275
- paths = paths.select {|path| File.file? path }
276
- paths.first
273
+ paths.find {|path| File.file? path }
277
274
  end
278
275
 
279
276
  HTTP_ERRORS = [
@@ -286,8 +283,8 @@ module Bundler
286
283
  def bundler_cert_store
287
284
  store = OpenSSL::X509::Store.new
288
285
  ssl_ca_cert = Bundler.settings[:ssl_ca_cert] ||
289
- (Bundler.rubygems.configuration.ssl_ca_cert if
290
- Bundler.rubygems.configuration.respond_to?(:ssl_ca_cert))
286
+ (Gem.configuration.ssl_ca_cert if
287
+ Gem.configuration.respond_to?(:ssl_ca_cert))
291
288
  if ssl_ca_cert
292
289
  if File.directory? ssl_ca_cert
293
290
  store.add_path ssl_ca_cert
@@ -301,8 +298,6 @@ module Bundler
301
298
  store
302
299
  end
303
300
 
304
- private
305
-
306
301
  def remote_uri
307
302
  @remote.uri
308
303
  end