rubygems-update 3.4.2 → 3.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -4
  3. data/CONTRIBUTING.md +6 -6
  4. data/bundler/CHANGELOG.md +30 -1
  5. data/bundler/UPGRADING.md +1 -1
  6. data/bundler/lib/bundler/build_metadata.rb +2 -2
  7. data/bundler/lib/bundler/cli/open.rb +6 -4
  8. data/bundler/lib/bundler/cli.rb +1 -0
  9. data/bundler/lib/bundler/definition.rb +42 -36
  10. data/bundler/lib/bundler/dsl.rb +2 -2
  11. data/bundler/lib/bundler/installer.rb +3 -7
  12. data/bundler/lib/bundler/lazy_specification.rb +33 -33
  13. data/bundler/lib/bundler/man/bundle-open.1 +21 -1
  14. data/bundler/lib/bundler/man/bundle-open.1.ronn +9 -1
  15. data/bundler/lib/bundler/resolver/base.rb +31 -7
  16. data/bundler/lib/bundler/resolver/candidate.rb +14 -12
  17. data/bundler/lib/bundler/resolver/package.rb +11 -2
  18. data/bundler/lib/bundler/resolver.rb +67 -39
  19. data/bundler/lib/bundler/shared_helpers.rb +1 -1
  20. data/bundler/lib/bundler/templates/newgem/Cargo.toml.tt +1 -1
  21. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +1 -1
  22. data/bundler/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +1 -1
  23. data/bundler/lib/bundler/version.rb +1 -1
  24. data/lib/rubygems/commands/owner_command.rb +1 -1
  25. data/lib/rubygems/core_ext/kernel_gem.rb +0 -5
  26. data/lib/rubygems/core_ext/kernel_require.rb +11 -12
  27. data/lib/rubygems/core_ext/kernel_warn.rb +33 -36
  28. data/lib/rubygems/ext/cargo_builder.rb +1 -1
  29. data/lib/rubygems/platform.rb +1 -1
  30. data/lib/rubygems.rb +12 -7
  31. data/rubygems-update.gemspec +1 -1
  32. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +4 -4
  33. data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
  34. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +4 -4
  35. data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
  36. data/test/rubygems/test_gem_request_set_lockfile_parser.rb +4 -4
  37. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 315bca7b295e6cfebcf797ed7c5a990d67ad9c5cc34bf31be185ce9619225c52
4
- data.tar.gz: 0dc3d94e2489d5baba85309a61ce9701de37c0f164b8601892b69b3af287f7c1
3
+ metadata.gz: 27d4df133281ea634bb43172b1fb833ad023a55e89e3cf571e368b3c5e604108
4
+ data.tar.gz: ccc599c30b5061eab73168c9cfeb2cc754700bbc7bca69c0c5458419db9594a3
5
5
  SHA512:
6
- metadata.gz: b8ac8e366afdd66d7ffe5813bfd43c3f3e7502cc0ece3c6a848c7eae2614fedac9e8f9a82a232ef5f37bdeb3a3010785febf4286a5de2d46fd2fdd0eba897dae
7
- data.tar.gz: ddb4c87e1c284243814bab308356a00ddc42e0818078c5abd467d18cd183d3bbc89414e7b1053184427a832d59ef67b70512e845870cc4bd4a19178a624f46c4
6
+ metadata.gz: 51e05cea34842a5a92669a88ff4612e94a7bcc1c582451765d789b77276c6029c9b2c1455446e1a97e907cb45bd3e99521923306481b57c15d108f2eabb435ef
7
+ data.tar.gz: 7dbc9e40f4ea6a1ad27f4180fda0b52d5480d10690d5076d87f45bb3ee08e2bd65f136ce2765d7fe86d899c8c0be863c664ee80300ebc8d159e6ce92b6a8fb0f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ # 3.4.4 / 2023-01-16
2
+
3
+ ## Enhancements:
4
+
5
+ * Installs bundler 2.4.4 as a default gem.
6
+
7
+ ## Documentation:
8
+
9
+ * Improve documentation about `Kernel` monkeypatches. Pull request #6217
10
+ by nobu
11
+
12
+ # 3.4.3 / 2023-01-06
13
+
14
+ ## Enhancements:
15
+
16
+ * Installs bundler 2.4.3 as a default gem.
17
+
18
+ ## Documentation:
19
+
20
+ * Fix several typos. Pull request #6224 by jdufresne
21
+
1
22
  # 3.4.2 / 2023-01-01
2
23
 
3
24
  ## Enhancements:
@@ -637,7 +658,7 @@
637
658
 
638
659
  ## Security fixes:
639
660
 
640
- * Verify plaform before installing to avoid potential remote code
661
+ * Verify platform before installing to avoid potential remote code
641
662
  execution. Pull request #4667 by sonalkr132
642
663
 
643
664
  ## Enhancements:
@@ -4269,7 +4290,7 @@ work focused on moving functionality out of Gem::SourceIndex and
4269
4290
  Gem::GemPathSearcher into Gem::Specification where it belongs.
4270
4291
 
4271
4292
  After installing RubyGems 1.8.0 you will see deprecations when loading your
4272
- exsting gems. Run `gem pristine --all --no-extensions` to regenerate your
4293
+ existing gems. Run `gem pristine --all --no-extensions` to regenerate your
4273
4294
  gem specifications safely.
4274
4295
 
4275
4296
  Currently RubyGems does not save the build arguments used to build gems with
@@ -4796,8 +4817,8 @@ http://gems.rubyforge.org will continue to work for the foreseeable future.
4796
4817
  Steve Purcell.
4797
4818
  * `gem generate_index`
4798
4819
  * Can now generate an RSS feed.
4799
- * Modern indicies can now be updated incrementally.
4800
- * Legacy indicies can be updated separately from modern.
4820
+ * Modern indices can now be updated incrementally.
4821
+ * Legacy indices can be updated separately from modern.
4801
4822
 
4802
4823
  ## Bug fixes:
4803
4824
 
data/CONTRIBUTING.md CHANGED
@@ -56,15 +56,15 @@ To run commands like `bundle install` from the repo:
56
56
 
57
57
  ### Running Tests
58
58
 
59
- To run the entire test suite you can use:
59
+ To run the entire test suite you can use:
60
60
 
61
61
  rake test
62
62
 
63
- To run an individual test file located for example in `test/rubygems/test_deprecate.rb` you can use:
63
+ To run an individual test file located for example in `test/rubygems/test_deprecate.rb` you can use:
64
64
 
65
65
  ruby -Ilib:test:bundler/lib test/rubygems/test_deprecate.rb
66
-
67
- And to run an individual test method named `test_default` within a test file, you can use:
66
+
67
+ And to run an individual test method named `test_default` within a test file, you can use:
68
68
 
69
69
  ruby -Ilib:test:bundler/lib test/rubygems/test_deprecate.rb -n /test_default/
70
70
 
@@ -80,9 +80,9 @@ To run the entire bundler test suite in parallel (it takes a while):
80
80
 
81
81
  bin/parallel_rspec
82
82
 
83
- To run the entire bundler test suite sequentially (get a coffee because it's very slow):
83
+ There are some realworld higher level specs run in CI, but not run by `bin/parallel_rspec`. You can run those with:
84
84
 
85
- bin/rspec
85
+ bin/rake spec:realworld
86
86
 
87
87
  To run an individual test file location for example in `spec/install/gems/standalone_spec.rb` you can use:
88
88
 
data/bundler/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # 2.4.4 (January 16, 2023)
2
+
3
+ ## Bug fixes:
4
+
5
+ - Fix platform specific gems removed from the lockfile [#6266](https://github.com/rubygems/rubygems/pull/6266)
6
+ - Properly handle incompatibilities on platform specific gems [#6270](https://github.com/rubygems/rubygems/pull/6270)
7
+ - Optimistically exclude prereleases from initial resolution [#6246](https://github.com/rubygems/rubygems/pull/6246)
8
+ - Fix another case of not properly falling back to ruby variant when materializing [#6261](https://github.com/rubygems/rubygems/pull/6261)
9
+ - Skip setting `BUNDLER_SETUP` on Ruby 2.6 [#6252](https://github.com/rubygems/rubygems/pull/6252)
10
+ - Let resolver deal with legacy gems with equivalent version and different dependencies [#6219](https://github.com/rubygems/rubygems/pull/6219)
11
+
12
+ # 2.4.3 (January 6, 2023)
13
+
14
+ ## Enhancements:
15
+
16
+ - Enhance `bundle open` command to allow opening subdir/file of gem [#6146](https://github.com/rubygems/rubygems/pull/6146)
17
+
18
+ ## Bug fixes:
19
+
20
+ - Fix pointing GitHub sources to PRs [#6241](https://github.com/rubygems/rubygems/pull/6241)
21
+ - Fix version ranges incorrectly handling platforms [#6240](https://github.com/rubygems/rubygems/pull/6240)
22
+ - Cleanup unnecessary gems when removing lockfile platforms [#6234](https://github.com/rubygems/rubygems/pull/6234)
23
+ - When auto-removing RUBY platform don't add specific platform if not needed [#6233](https://github.com/rubygems/rubygems/pull/6233)
24
+ - Fallback to selecting installable candidates if possible when materializing specs [#6225](https://github.com/rubygems/rubygems/pull/6225)
25
+
26
+ ## Documentation:
27
+
28
+ - Fix several typos [#6224](https://github.com/rubygems/rubygems/pull/6224)
29
+
1
30
  # 2.4.2 (January 1, 2023)
2
31
 
3
32
  ## Performance:
@@ -1518,7 +1547,7 @@ Changes
1518
1547
 
1519
1548
  - avoid new RubyGems warning about unsafe YAML loading (to keep output consistent) (@segiddins)
1520
1549
  - load digest subclasses in a thread-safe manner (@segiddins, @colby-swandale)
1521
- - avoid unusued variable warnings under ruby 2.5 (@amatsuda)
1550
+ - avoid unused variable warnings under ruby 2.5 (@amatsuda)
1522
1551
  - fix printing the same message twice in verbose mode ([#6028](https://github.com/rubygems/bundler/issues/6028), @akhramov)
1523
1552
  - allow `SignalException`s to bubble up to the interpreter during `bundle exec` ([#6090](https://github.com/rubygems/bundler/issues/6090), @dekellum)
1524
1553
  - avoid activating stdlib digest under Ruby 2.5 (@segiddins)
data/bundler/UPGRADING.md CHANGED
@@ -103,7 +103,7 @@ in the upcoming 3 version.
103
103
 
104
104
  #### Cancelled CLI deprecations
105
105
 
106
- These deprecations have been initally announced before, but the deprecations
106
+ These deprecations have been initially announced before, but the deprecations
107
107
  were cancelled before the release of Bundler 2.1.0 in [rubygems/bundler#7475](https://github.com/rubygems/bundler/pull/7475).
108
108
 
109
109
  * ~The `bundle update` command will no longer update all gems, you'll need to pass `--all` to it.~ (postponed)
@@ -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 = "2023-01-01".freeze
8
- @git_commit_sha = "2cd3ed45bf".freeze
7
+ @built_at = "2023-01-16".freeze
8
+ @git_commit_sha = "e1c0b50e84".freeze
9
9
  @release = true
10
10
  # end ivars
11
11
 
@@ -2,23 +2,25 @@
2
2
 
3
3
  module Bundler
4
4
  class CLI::Open
5
- attr_reader :options, :name
5
+ attr_reader :options, :name, :path
6
6
  def initialize(options, name)
7
7
  @options = options
8
8
  @name = name
9
+ @path = options[:path] unless options[:path].nil?
9
10
  end
10
11
 
11
12
  def run
13
+ raise InvalidOption, "Cannot specify `--path` option without a value" if !@path.nil? && @path.empty?
12
14
  editor = [ENV["BUNDLER_EDITOR"], ENV["VISUAL"], ENV["EDITOR"]].find {|e| !e.nil? && !e.empty? }
13
15
  return Bundler.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR") unless editor
14
16
  return unless spec = Bundler::CLI::Common.select_spec(name, :regex_match)
15
17
  if spec.default_gem?
16
18
  Bundler.ui.info "Unable to open #{name} because it's a default gem, so the directory it would normally be installed to does not exist."
17
19
  else
18
- path = spec.full_gem_path
19
- Dir.chdir(path) do
20
+ root_path = spec.full_gem_path
21
+ Dir.chdir(root_path) do
20
22
  require "shellwords"
21
- command = Shellwords.split(editor) + [path]
23
+ command = Shellwords.split(editor) << File.join([root_path, path].compact)
22
24
  Bundler.with_original_env do
23
25
  system(*command)
24
26
  end || Bundler.ui.info("Could not run '#{command.join(" ")}'")
@@ -509,6 +509,7 @@ module Bundler
509
509
  subcommand "config", Config
510
510
 
511
511
  desc "open GEM", "Opens the source directory of the given bundled gem"
512
+ method_option "path", :type => :string, :lazy_default => "", :banner => "Open relative path of the gem source."
512
513
  def open(name)
513
514
  require_relative "cli/open"
514
515
  Open.new(options, name).run
@@ -79,6 +79,7 @@ module Bundler
79
79
  @locked_bundler_version = nil
80
80
  @locked_ruby_version = nil
81
81
  @new_platform = nil
82
+ @removed_platform = nil
82
83
 
83
84
  if lockfile && File.exist?(lockfile)
84
85
  @lockfile_contents = Bundler.read_file(lockfile)
@@ -129,7 +130,7 @@ module Bundler
129
130
  end
130
131
  @unlocking ||= @unlock[:ruby] ||= (!@locked_ruby_version ^ !@ruby_version)
131
132
 
132
- add_current_platform unless current_ruby_platform_locked? || Bundler.frozen_bundle?
133
+ add_current_platform unless Bundler.frozen_bundle?
133
134
 
134
135
  converge_path_sources_to_gemspec_sources
135
136
  @path_changes = converge_paths
@@ -158,13 +159,6 @@ module Bundler
158
159
  resolve
159
160
  end
160
161
 
161
- def resolve_prefering_local!
162
- @prefer_local = true
163
- @remote = true
164
- sources.remote!
165
- resolve
166
- end
167
-
168
162
  def resolve_with_cache!
169
163
  sources.cached!
170
164
  resolve
@@ -176,6 +170,23 @@ module Bundler
176
170
  resolve
177
171
  end
178
172
 
173
+ def resolution_mode=(options)
174
+ if options["local"]
175
+ @remote = false
176
+ else
177
+ @remote = true
178
+ @prefer_local = options["prefer-local"]
179
+ end
180
+ end
181
+
182
+ def setup_sources_for_resolve
183
+ if @remote == false
184
+ sources.cached!
185
+ else
186
+ sources.remote!
187
+ end
188
+ end
189
+
179
190
  # For given dependency list returns a SpecSet with Gemspec of all the required
180
191
  # dependencies.
181
192
  # 1. The method first resolves the dependencies specified in Gemfile
@@ -267,7 +278,7 @@ module Bundler
267
278
  SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
268
279
  else
269
280
  Bundler.ui.debug "Found no changes, using resolution from the lockfile"
270
- if @locked_gems.may_include_redundant_platform_specific_gems?
281
+ if @removed_platform || @locked_gems.may_include_redundant_platform_specific_gems?
271
282
  SpecSet.new(filter_specs(@locked_specs, @dependencies))
272
283
  else
273
284
  @locked_specs
@@ -446,7 +457,9 @@ module Bundler
446
457
  end
447
458
 
448
459
  def remove_platform(platform)
449
- return if @platforms.delete(Gem::Platform.new(platform))
460
+ removed_platform = @platforms.delete(Gem::Platform.new(platform))
461
+ @removed_platform ||= removed_platform
462
+ return if removed_platform
450
463
  raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
451
464
  end
452
465
 
@@ -470,11 +483,7 @@ module Bundler
470
483
  private
471
484
 
472
485
  def resolver
473
- @resolver ||= begin
474
- last_resolve = converge_locked_specs
475
- remove_ruby_from_platforms_if_necessary!(current_dependencies)
476
- Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve(last_resolve))
477
- end
486
+ @resolver ||= Resolver.new(resolution_packages, gem_version_promoter)
478
487
  end
479
488
 
480
489
  def expanded_dependencies
@@ -483,18 +492,10 @@ module Bundler
483
492
 
484
493
  def resolution_packages
485
494
  @resolution_packages ||= begin
486
- packages = Hash.new do |h, k|
487
- h[k] = Resolver::Package.new(k, @platforms, @originally_locked_specs, @unlock[:gems])
488
- end
489
-
490
- expanded_dependencies.each do |dep|
491
- name = dep.name
492
- platforms = dep.gem_platforms(@platforms)
493
-
494
- packages[name] = Resolver::Package.new(name, platforms, @originally_locked_specs, @unlock[:gems], :dependency => dep)
495
- end
496
-
497
- packages
495
+ last_resolve = converge_locked_specs
496
+ remove_ruby_from_platforms_if_necessary!(current_dependencies)
497
+ packages = Resolver::Base.new(source_requirements, expanded_dependencies, last_resolve, @platforms, :locked_specs => @originally_locked_specs, :unlock => @unlock[:gems], :prerelease => gem_version_promoter.pre?)
498
+ additional_base_requirements_for_resolve(packages, last_resolve)
498
499
  end
499
500
  end
500
501
 
@@ -528,13 +529,15 @@ module Bundler
528
529
  break if incomplete_specs.empty?
529
530
 
530
531
  Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
531
- @resolve = start_resolution(:exclude_specs => incomplete_specs)
532
+ setup_sources_for_resolve
533
+ resolution_packages.delete(incomplete_specs)
534
+ @resolve = start_resolution
532
535
  specs = resolve.materialize(dependencies)
533
536
 
534
537
  still_incomplete_specs = specs.incomplete_specs
535
538
 
536
539
  if still_incomplete_specs == incomplete_specs
537
- package = resolution_packages[incomplete_specs.first.name]
540
+ package = resolution_packages.get_package(incomplete_specs.first.name)
538
541
  resolver.raise_not_found! package
539
542
  end
540
543
 
@@ -547,8 +550,8 @@ module Bundler
547
550
  specs
548
551
  end
549
552
 
550
- def start_resolution(exclude_specs: [])
551
- result = resolver.start(expanded_dependencies, resolution_packages, :exclude_specs => exclude_specs)
553
+ def start_resolution
554
+ result = resolver.start(expanded_dependencies)
552
555
 
553
556
  SpecSet.new(SpecSet.new(result).for(dependencies, false, @platforms))
554
557
  end
@@ -584,6 +587,8 @@ module Bundler
584
587
  end
585
588
 
586
589
  def add_current_platform
590
+ return if current_ruby_platform_locked?
591
+
587
592
  add_platform(local_platform)
588
593
  end
589
594
 
@@ -880,11 +885,12 @@ module Bundler
880
885
  current == proposed
881
886
  end
882
887
 
883
- def additional_base_requirements_for_resolve(last_resolve)
884
- return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
885
- converge_specs(@originally_locked_specs - last_resolve).map do |locked_spec|
886
- Dependency.new(locked_spec.name, ">= #{locked_spec.version}")
887
- end.uniq
888
+ def additional_base_requirements_for_resolve(resolution_packages, last_resolve)
889
+ return resolution_packages unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
890
+ converge_specs(@originally_locked_specs - last_resolve).each do |locked_spec|
891
+ resolution_packages.base_requirements[locked_spec.name] = Gem::Requirement.new(">= #{locked_spec.version}")
892
+ end
893
+ resolution_packages
888
894
  end
889
895
 
890
896
  def remove_ruby_from_platforms_if_necessary!(dependencies)
@@ -277,8 +277,8 @@ module Bundler
277
277
  if repo_name =~ GITHUB_PULL_REQUEST_URL
278
278
  {
279
279
  "git" => "https://github.com/#{$1}.git",
280
- "branch" => "refs/pull/#{$2}/head",
281
- "ref" => nil,
280
+ "branch" => nil,
281
+ "ref" => "refs/pull/#{$2}/head",
282
282
  "tag" => nil,
283
283
  }
284
284
  else
@@ -249,17 +249,13 @@ module Bundler
249
249
 
250
250
  # returns whether or not a re-resolve was needed
251
251
  def resolve_if_needed(options)
252
+ @definition.resolution_mode = options
253
+
252
254
  if !@definition.unlocking? && !options["force"] && !Bundler.settings[:inline] && Bundler.default_lockfile.file?
253
255
  return false if @definition.nothing_changed? && !@definition.missing_specs?
254
256
  end
255
257
 
256
- if options["local"]
257
- @definition.resolve_with_cache!
258
- elsif options["prefer-local"]
259
- @definition.resolve_prefering_local!
260
- else
261
- @definition.resolve_remotely!
262
- end
258
+ @definition.setup_sources_for_resolve
263
259
 
264
260
  true
265
261
  end
@@ -16,7 +16,6 @@ module Bundler
16
16
  @dependencies = []
17
17
  @platform = platform || Gem::Platform::RUBY
18
18
  @source = source
19
- @specification = nil
20
19
  @force_ruby_platform = default_force_ruby_platform
21
20
  end
22
21
 
@@ -80,37 +79,46 @@ module Bundler
80
79
  def materialize_for_installation
81
80
  source.local!
82
81
 
83
- candidates = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
84
- target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform
82
+ matching_specs = source.specs.search(use_exact_resolved_specifications? ? self : [name, version])
83
+ return self if matching_specs.empty?
85
84
 
86
- GemHelpers.select_best_platform_match(source.specs.search([name, version]), target_platform)
85
+ candidates = if use_exact_resolved_specifications?
86
+ matching_specs
87
87
  else
88
- source.specs.search(self)
89
- end
88
+ target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform
90
89
 
91
- return self if candidates.empty?
90
+ installable_candidates = GemHelpers.select_best_platform_match(matching_specs, target_platform)
92
91
 
93
- __materialize__(candidates)
94
- end
92
+ specification = __materialize__(installable_candidates, :fallback_to_non_installable => false)
93
+ return specification unless specification.nil?
95
94
 
96
- def __materialize__(candidates)
97
- @specification = begin
98
- search = candidates.reverse.find do |spec|
99
- spec.is_a?(StubSpecification) ||
100
- (spec.matches_current_ruby? &&
101
- spec.matches_current_rubygems?)
102
- end
103
- if search.nil? && Bundler.frozen_bundle?
104
- search = candidates.last
105
- else
106
- search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
95
+ if target_platform != platform
96
+ installable_candidates = GemHelpers.select_best_platform_match(matching_specs, platform)
107
97
  end
108
- search
98
+
99
+ installable_candidates
109
100
  end
101
+
102
+ __materialize__(candidates)
110
103
  end
111
104
 
112
- def respond_to?(*args)
113
- super || @specification ? @specification.respond_to?(*args) : nil
105
+ # If in frozen mode, we fallback to a non-installable candidate because by
106
+ # doing this we avoid re-resolving and potentially end up changing the
107
+ # lock file, which is not allowed. In that case, we will give a proper error
108
+ # about the mismatch higher up the stack, right before trying to install the
109
+ # bad gem.
110
+ def __materialize__(candidates, fallback_to_non_installable: Bundler.frozen_bundle?)
111
+ search = candidates.reverse.find do |spec|
112
+ spec.is_a?(StubSpecification) ||
113
+ (spec.matches_current_ruby? &&
114
+ spec.matches_current_rubygems?)
115
+ end
116
+ if search.nil? && fallback_to_non_installable
117
+ search = candidates.last
118
+ else
119
+ search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
120
+ end
121
+ search
114
122
  end
115
123
 
116
124
  def to_s
@@ -132,16 +140,8 @@ module Bundler
132
140
 
133
141
  private
134
142
 
135
- def to_ary
136
- nil
137
- end
138
-
139
- def method_missing(method, *args, &blk)
140
- raise "LazySpecification has not been materialized yet (calling :#{method} #{args.inspect})" unless @specification
141
-
142
- return super unless respond_to?(method)
143
-
144
- @specification.send(method, *args, &blk)
143
+ def use_exact_resolved_specifications?
144
+ @use_exact_resolved_specifications ||= !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
145
145
  end
146
146
 
147
147
  #
@@ -7,7 +7,7 @@
7
7
  \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
8
8
  .
9
9
  .SH "SYNOPSIS"
10
- \fBbundle open\fR [GEM]
10
+ \fBbundle open\fR [GEM] [\-\-path=PATH]
11
11
  .
12
12
  .SH "DESCRIPTION"
13
13
  Opens the source directory of the provided GEM in your editor\.
@@ -30,3 +30,23 @@ bundle open \'rack\'
30
30
  .
31
31
  .P
32
32
  Will open the source directory for the \'rack\' gem in your bundle\.
33
+ .
34
+ .IP "" 4
35
+ .
36
+ .nf
37
+
38
+ bundle open \'rack\' \-\-path \'README\.md\'
39
+ .
40
+ .fi
41
+ .
42
+ .IP "" 0
43
+ .
44
+ .P
45
+ Will open the README\.md file of the \'rack\' gem source in your bundle\.
46
+ .
47
+ .SH "OPTIONS"
48
+ .
49
+ .TP
50
+ \fB\-\-path\fR
51
+ Specify GEM source relative path to open\.
52
+
@@ -3,7 +3,7 @@ bundle-open(1) -- Opens the source directory for a gem in your bundle
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `bundle open` [GEM]
6
+ `bundle open` [GEM] [--path=PATH]
7
7
 
8
8
  ## DESCRIPTION
9
9
 
@@ -17,3 +17,11 @@ Example:
17
17
  bundle open 'rack'
18
18
 
19
19
  Will open the source directory for the 'rack' gem in your bundle.
20
+
21
+ bundle open 'rack' --path 'README.md'
22
+
23
+ Will open the README.md file of the 'rack' gem source in your bundle.
24
+
25
+ ## OPTIONS
26
+ * `--path`:
27
+ Specify GEM source relative path to open.
@@ -1,19 +1,40 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "package"
4
+
3
5
  module Bundler
4
6
  class Resolver
5
7
  class Base
6
- def initialize(base, additional_base_requirements)
8
+ attr_reader :packages, :source_requirements
9
+
10
+ def initialize(source_requirements, dependencies, base, platforms, options)
11
+ @source_requirements = source_requirements
12
+
7
13
  @base = base
8
- @additional_base_requirements = additional_base_requirements
14
+
15
+ @packages = Hash.new do |hash, name|
16
+ hash[name] = Package.new(name, platforms, **options)
17
+ end
18
+
19
+ dependencies.each do |dep|
20
+ name = dep.name
21
+
22
+ @packages[name] = Package.new(name, dep.gem_platforms(platforms), **options.merge(:dependency => dep))
23
+ end
9
24
  end
10
25
 
11
26
  def [](name)
12
27
  @base[name]
13
28
  end
14
29
 
15
- def delete(spec)
16
- @base.delete(spec)
30
+ def delete(specs)
31
+ specs.each do |spec|
32
+ @base.delete(spec)
33
+ end
34
+ end
35
+
36
+ def get_package(name)
37
+ @packages[name]
17
38
  end
18
39
 
19
40
  def base_requirements
@@ -24,10 +45,14 @@ module Bundler
24
45
  names.each do |name|
25
46
  @base.delete_by_name(name)
26
47
 
27
- @additional_base_requirements.reject! {|dep| dep.name == name }
48
+ @base_requirements.delete(name)
28
49
  end
50
+ end
29
51
 
30
- @base_requirements = nil
52
+ def include_prereleases(names)
53
+ names.each do |name|
54
+ get_package(name).consider_prereleases!
55
+ end
31
56
  end
32
57
 
33
58
  private
@@ -38,7 +63,6 @@ module Bundler
38
63
  req = Gem::Requirement.new(ls.version)
39
64
  base_requirements[ls.name] = req
40
65
  end
41
- @additional_base_requirements.each {|d| base_requirements[d.name] = d.requirement }
42
66
  base_requirements
43
67
  end
44
68
  end