bundler 2.4.2 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c50aec0246059478bdcdda64f7415e38e121d9da86c2699aaa783b4285582ad5
4
- data.tar.gz: e2d1a40547e08d932b46e0888d84cef117397403cd4ce880290551cdf7b071db
3
+ metadata.gz: 4598d8531bbdd46221e7238ee2aa828683a3e1854e47bf901857f791a01eb969
4
+ data.tar.gz: ead0de0789d8d5682c8d58e60da80a245d5710f8358669e544bb915546f3b82c
5
5
  SHA512:
6
- metadata.gz: 393eb0a68ebe556e755fabbd606702eb1515f7538fbf90b319867c994ba3e460f719bede31dd877176eb9b72f213af2cd429af580ec6a4b54dfca7e83e988080
7
- data.tar.gz: a8988d4ace205c0ea09f59775ed87e73ae16f91c2f41580b0e6eb0a98040caad70899bb4892413abd66b02d7f36c967b6c47e775fd354d8460ccea1ad0e1f756
6
+ metadata.gz: 8078880e8f03117e011bedb3150aba2dfc91c271dfd289ed99f0850e5cb8c62c50af5d7c834c2fc224e17ff925f59e237b33141c1b7d9dec3efdaf35b9f353c1
7
+ data.tar.gz: 278df46d98c43489e941b788aca7b3cc46358a3ea099987f83c8cdb3b618ed3b0373d7bea590a80620332316d0b12a0bf98f0d02349c55d769174960f5169a45
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ # 2.4.3 (January 6, 2023)
2
+
3
+ ## Enhancements:
4
+
5
+ - Enhance `bundle open` command to allow opening subdir/file of gem [#6146](https://github.com/rubygems/rubygems/pull/6146)
6
+
7
+ ## Bug fixes:
8
+
9
+ - Fix pointing GitHub sources to PRs [#6241](https://github.com/rubygems/rubygems/pull/6241)
10
+ - Fix version ranges incorrectly handling platforms [#6240](https://github.com/rubygems/rubygems/pull/6240)
11
+ - Cleanup unnecessary gems when removing lockfile platforms [#6234](https://github.com/rubygems/rubygems/pull/6234)
12
+ - When auto-removing RUBY platform don't add specific platform if not needed [#6233](https://github.com/rubygems/rubygems/pull/6233)
13
+ - Fallback to selecting installable candidates if possible when materializing specs [#6225](https://github.com/rubygems/rubygems/pull/6225)
14
+
15
+ ## Documentation:
16
+
17
+ - Fix several typos [#6224](https://github.com/rubygems/rubygems/pull/6224)
18
+
1
19
  # 2.4.2 (January 1, 2023)
2
20
 
3
21
  ## Performance:
@@ -1518,7 +1536,7 @@ Changes
1518
1536
 
1519
1537
  - avoid new RubyGems warning about unsafe YAML loading (to keep output consistent) (@segiddins)
1520
1538
  - load digest subclasses in a thread-safe manner (@segiddins, @colby-swandale)
1521
- - avoid unusued variable warnings under ruby 2.5 (@amatsuda)
1539
+ - avoid unused variable warnings under ruby 2.5 (@amatsuda)
1522
1540
  - fix printing the same message twice in verbose mode ([#6028](https://github.com/rubygems/bundler/issues/6028), @akhramov)
1523
1541
  - allow `SignalException`s to bubble up to the interpreter during `bundle exec` ([#6090](https://github.com/rubygems/bundler/issues/6090), @dekellum)
1524
1542
  - avoid activating stdlib digest under Ruby 2.5 (@segiddins)
@@ -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-06".freeze
8
+ @git_commit_sha = "ed1f27f75c".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(" ")}'")
data/lib/bundler/cli.rb CHANGED
@@ -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
@@ -267,7 +268,7 @@ module Bundler
267
268
  SpecSet.new(filter_specs(@locked_specs, @dependencies - deleted_deps))
268
269
  else
269
270
  Bundler.ui.debug "Found no changes, using resolution from the lockfile"
270
- if @locked_gems.may_include_redundant_platform_specific_gems?
271
+ if @removed_platform || @locked_gems.may_include_redundant_platform_specific_gems?
271
272
  SpecSet.new(filter_specs(@locked_specs, @dependencies))
272
273
  else
273
274
  @locked_specs
@@ -446,7 +447,9 @@ module Bundler
446
447
  end
447
448
 
448
449
  def remove_platform(platform)
449
- return if @platforms.delete(Gem::Platform.new(platform))
450
+ removed_platform = @platforms.delete(Gem::Platform.new(platform))
451
+ @removed_platform ||= removed_platform
452
+ return if removed_platform
450
453
  raise InvalidOption, "Unable to remove the platform `#{platform}` since the only platforms are #{@platforms.join ", "}"
451
454
  end
452
455
 
@@ -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
 
data/lib/bundler/dsl.rb CHANGED
@@ -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
@@ -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,41 @@ 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)
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
+ def __materialize__(candidates)
106
+ search = candidates.reverse.find do |spec|
107
+ spec.is_a?(StubSpecification) ||
108
+ (spec.matches_current_ruby? &&
109
+ spec.matches_current_rubygems?)
110
+ end
111
+ if search.nil? && Bundler.frozen_bundle?
112
+ search = candidates.last
113
+ else
114
+ search.dependencies = dependencies if search && search.full_name == full_name && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
115
+ end
116
+ search
114
117
  end
115
118
 
116
119
  def to_s
@@ -132,16 +135,8 @@ module Bundler
132
135
 
133
136
  private
134
137
 
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)
138
+ def use_exact_resolved_specifications?
139
+ @use_exact_resolved_specifications ||= !source.is_a?(Source::Path) && ruby_platform_materializes_to_ruby_platform?
145
140
  end
146
141
 
147
142
  #
@@ -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.
@@ -41,6 +41,18 @@ module Bundler
41
41
  @spec_group.to_specs(package.force_ruby_platform?)
42
42
  end
43
43
 
44
+ def generic!
45
+ @ruby_only = true
46
+
47
+ self
48
+ end
49
+
50
+ def platform_specific!
51
+ @ruby_only = false
52
+
53
+ self
54
+ end
55
+
44
56
  def prerelease?
45
57
  @version.prerelease?
46
58
  end
@@ -53,27 +65,20 @@ module Bundler
53
65
  [@version, @ruby_only ? -1 : 1]
54
66
  end
55
67
 
56
- def canonical?
57
- !@spec_group.empty?
58
- end
59
-
60
68
  def <=>(other)
61
69
  return unless other.is_a?(self.class)
62
- return @version <=> other.version unless canonical? && other.canonical?
63
70
 
64
71
  sort_obj <=> other.sort_obj
65
72
  end
66
73
 
67
74
  def ==(other)
68
75
  return unless other.is_a?(self.class)
69
- return @version == other.version unless canonical? && other.canonical?
70
76
 
71
77
  sort_obj == other.sort_obj
72
78
  end
73
79
 
74
80
  def eql?(other)
75
81
  return unless other.is_a?(self.class)
76
- return @version.eql?(other.version) unless canonical? || other.canonical?
77
82
 
78
83
  sort_obj.eql?(other.sort_obj)
79
84
  end
@@ -337,7 +337,8 @@ module Bundler
337
337
 
338
338
  def requirement_to_range(requirement)
339
339
  ranges = requirement.requirements.map do |(op, version)|
340
- ver = Resolver::Candidate.new(version)
340
+ ver = Resolver::Candidate.new(version).generic!
341
+ platform_ver = Resolver::Candidate.new(version).platform_specific!
341
342
 
342
343
  case op
343
344
  when "~>"
@@ -345,17 +346,17 @@ module Bundler
345
346
  bump = Resolver::Candidate.new(version.bump.to_s + ".A")
346
347
  PubGrub::VersionRange.new(:name => name, :min => ver, :max => bump, :include_min => true)
347
348
  when ">"
348
- PubGrub::VersionRange.new(:min => ver)
349
+ PubGrub::VersionRange.new(:min => platform_ver)
349
350
  when ">="
350
351
  PubGrub::VersionRange.new(:min => ver, :include_min => true)
351
352
  when "<"
352
353
  PubGrub::VersionRange.new(:max => ver)
353
354
  when "<="
354
- PubGrub::VersionRange.new(:max => ver, :include_max => true)
355
+ PubGrub::VersionRange.new(:max => platform_ver, :include_max => true)
355
356
  when "="
356
- PubGrub::VersionRange.new(:min => ver, :max => ver, :include_min => true, :include_max => true)
357
+ PubGrub::VersionRange.new(:min => ver, :max => platform_ver, :include_min => true, :include_max => true)
357
358
  when "!="
358
- PubGrub::VersionRange.new(:min => ver, :max => ver, :include_min => true, :include_max => true).invert
359
+ PubGrub::VersionRange.new(:min => ver, :max => platform_ver, :include_min => true, :include_max => true).invert
359
360
  else
360
361
  raise "bad version specifier: #{op}"
361
362
  end
@@ -1,5 +1,5 @@
1
1
  # This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
2
- # a Rust project. Your extensions depedencies should be added to the Cargo.toml
2
+ # a Rust project. Your extensions dependencies should be added to the Cargo.toml
3
3
  # in the ext/ directory.
4
4
 
5
5
  [workspace]
@@ -397,7 +397,7 @@ module Bundler::PubGrub
397
397
 
398
398
  def constraints
399
399
  return ["any"] if any?
400
- return ["= #{min}"] if min == max
400
+ return ["= #{min}"] if min.to_s == max.to_s
401
401
 
402
402
  c = []
403
403
  c << "#{include_min ? ">=" : ">"} #{min}" if min
@@ -148,7 +148,7 @@ module Bundler::PubGrub
148
148
  while !ranges.empty?
149
149
  ne = []
150
150
  range = ranges.shift
151
- while !ranges.empty? && ranges[0].min == range.max
151
+ while !ranges.empty? && ranges[0].min.to_s == range.max.to_s
152
152
  ne << range.max
153
153
  range = range.span(ranges.shift)
154
154
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Bundler
4
- VERSION = "2.4.2".freeze
4
+ VERSION = "2.4.3".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.4.2
4
+ version: 2.4.3
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: 2023-01-01 00:00:00.000000000 Z
25
+ date: 2023-01-06 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
@@ -380,7 +380,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
380
380
  - !ruby/object:Gem::Version
381
381
  version: 3.0.1
382
382
  requirements: []
383
- rubygems_version: 3.4.2
383
+ rubygems_version: 3.4.3
384
384
  signing_key:
385
385
  specification_version: 4
386
386
  summary: The best way to manage your application's dependencies