dependabot-bundler 0.242.1 → 0.244.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 532614afc8f646f86818c19fa58de7ba20bcad77ec67081a27b3fd2efc7b77a1
4
- data.tar.gz: b670a8e2a88a31d112d502a19d776791390d6fa04cf3d0c24bae3a6ef3a6a67b
3
+ metadata.gz: dc9561c2cec6477046f92d8c3539d69cfecdeeaff241a8c24a1bc6f76078741c
4
+ data.tar.gz: 401f077235d49135e00694bb549a9163222c54415541d954606b912389909c59
5
5
  SHA512:
6
- metadata.gz: c3ef8a6a4b41ba070d2e0c1ae9467dc15c0ccbc36ea20d959ff81a74bc776db203a46ddecd2259bd3933e6fc07d07edd8c8e101b62bd22cc4d13262b260cdfb4
7
- data.tar.gz: 4924dbab7941aedd49d25152ff681fd009e9612e696c4641236b624cb0f2330ea99c38d7fa88ee8bd1af5bea0e9fd6b787366166d1866d4dd07dc49778373389
6
+ metadata.gz: d2803abd9773bac2f56677927245d8552aa60be2c06203f94685cf765d8e563f0774ae9f3bc7ddac99b4d038ee3f096c21d9a69ba128926b6c316e952042b485
7
+ data.tar.gz: 2617cd80e87d7fa73143fa2fc6d569019e0757e69a68bcda25cbd7290d8cad9edaef5d61fb012ffcb244de71eddd50724ae4d70afd875905b35eb2535a8179a2
@@ -4,6 +4,21 @@
4
4
  require "bundler/definition"
5
5
 
6
6
  module BundlerDefinitionRubyVersionPatch
7
+ def ruby_version
8
+ super || begin
9
+ file_content = Bundler.read_file(".ruby-version")
10
+ ruby_version =
11
+ if /^ruby(-|\s+)([^\s#]+)/ =~ file_content
12
+ ::Regexp.last_match(2)
13
+ else
14
+ file_content.strip
15
+ end
16
+ Bundler::RubyVersion.new(ruby_version, nil, nil, nil) if ruby_version
17
+ rescue SystemCallError
18
+ # .ruby-version doesn't exist, fallback to the Ruby Dependabot runs
19
+ end
20
+ end
21
+
7
22
  def source_requirements
8
23
  if ruby_version
9
24
  requested_version = ruby_version.gem_version
@@ -0,0 +1,40 @@
1
+ # typed: false
2
+ # frozen_string_literal: true
3
+
4
+ require "native_spec_helper"
5
+ require "shared_contexts"
6
+
7
+ RSpec.describe BundlerDefinitionRubyVersionPatch do
8
+ include_context "in a temporary bundler directory"
9
+ include_context "stub rubygems compact index"
10
+
11
+ let(:project_name) { "ruby_version_implied" }
12
+ before do
13
+ @ui = Bundler.ui
14
+ Bundler.ui = Bundler::UI::Silent.new
15
+ end
16
+ after { Bundler.ui = @ui }
17
+
18
+ it "updates to the most recent version" do
19
+ in_tmp_folder do
20
+ File.delete(".ruby-version")
21
+ definition = Bundler::Definition.build("Gemfile", "Gemfile.lock", gems: ["statesman"])
22
+ definition.resolve_remotely!
23
+ specs = definition.resolve["statesman"]
24
+ expect(specs.size).to eq(1)
25
+ spec = specs.first
26
+ expect(spec.version).to eq("7.2.0")
27
+ end
28
+ end
29
+
30
+ it "doesn't update to a version that is not compatible with the Ruby version implied by .ruby-version" do
31
+ in_tmp_folder do
32
+ definition = Bundler::Definition.build("Gemfile", "Gemfile.lock", gems: ["statesman"])
33
+ definition.resolve_remotely!
34
+ specs = definition.resolve["statesman"]
35
+ expect(specs.size).to eq(1)
36
+ spec = specs.first
37
+ expect(spec.version).to eq("2.0.1")
38
+ end
39
+ end
40
+ end
@@ -1,4 +1,4 @@
1
- # typed: false
1
+ # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "sorbet-runtime"
@@ -98,7 +98,6 @@ module Dependabot
98
98
 
99
99
  def ruby_version_file
100
100
  return unless gemfile
101
- return unless gemfile.content.include?(".ruby-version")
102
101
 
103
102
  @ruby_version_file ||=
104
103
  fetch_file_if_present(".ruby-version")
@@ -106,7 +105,7 @@ module Dependabot
106
105
  end
107
106
 
108
107
  def path_gemspecs
109
- gemspec_files = []
108
+ gemspec_files = T.let([], T::Array[Dependabot::DependencyFile])
110
109
  unfetchable_gems = []
111
110
 
112
111
  path_gemspec_paths.each do |path|
@@ -153,6 +152,7 @@ module Dependabot
153
152
  .tap { |req_files| req_files.each { |f| f.support_file = true } }
154
153
  end
155
154
 
155
+ sig { params(dir_path: T.any(String, Pathname)).returns(T::Array[DependencyFile]) }
156
156
  def fetch_gemspecs_from_directory(dir_path)
157
157
  repo_contents(dir: dir_path, fetch_submodules: true)
158
158
  .select { |f| f.name.end_with?(".gemspec", ".specification") }
@@ -201,7 +201,7 @@ module Dependabot
201
201
  return @base_url if defined?(@base_url)
202
202
 
203
203
  credential = credentials.find do |cred|
204
- cred["type"] == "rubygems_server" && cred["replaces-base"] == true
204
+ cred["type"] == "rubygems_server" && cred.replaces_base?
205
205
  end
206
206
  host = credential ? credential["host"] : "rubygems.org"
207
207
  @base_url = "https://#{host}" + ("/" unless host.end_with?("/"))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.242.1
4
+ version: 0.244.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-23 00:00:00.000000000 Z
11
+ date: 2024-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.242.1
19
+ version: 0.244.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.242.1
26
+ version: 0.244.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -272,6 +272,7 @@ files:
272
272
  - helpers/v2/spec/functions/version_resolver_spec.rb
273
273
  - helpers/v2/spec/functions_spec.rb
274
274
  - helpers/v2/spec/native_spec_helper.rb
275
+ - helpers/v2/spec/ruby_version_spec.rb
275
276
  - helpers/v2/spec/shared_contexts.rb
276
277
  - lib/dependabot/bundler.rb
277
278
  - lib/dependabot/bundler/file_fetcher.rb
@@ -312,7 +313,7 @@ licenses:
312
313
  - Nonstandard
313
314
  metadata:
314
315
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
315
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.242.1
316
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.244.0
316
317
  post_install_message:
317
318
  rdoc_options: []
318
319
  require_paths: