dependabot-cargo 0.384.0 → 0.386.0

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.
@@ -207,17 +207,19 @@ module Dependabot
207
207
  )
208
208
  end
209
209
 
210
- sig { params(prepared: T::Boolean).returns(T.nilable(Integer)) }
210
+ sig { params(prepared: T::Boolean).void }
211
211
  def write_temporary_dependency_files(prepared: true)
212
212
  write_manifest_files(prepared: prepared)
213
213
 
214
214
  File.write(T.must(lockfile).name, T.must(lockfile).content) if lockfile
215
215
  File.write(T.must(toolchain).name, T.must(toolchain).content) if toolchain
216
- config_file = config
217
- return unless config_file
218
-
219
- FileUtils.mkdir_p(File.dirname(config_file.name))
220
- File.write(config_file.name, Helpers.sanitize_cargo_config(T.must(config_file.content)))
216
+ config_files.each do |config_file|
217
+ FileUtils.mkdir_p(File.dirname(config_file.name))
218
+ File.write(
219
+ config_file.name,
220
+ Helpers.sanitize_cargo_config(T.must(config_file.content), file_name: config_file.name)
221
+ )
222
+ end
221
223
  end
222
224
 
223
225
  sig { void }
@@ -554,13 +556,18 @@ module Dependabot
554
556
  )
555
557
  end
556
558
 
557
- sig { returns(T.nilable(DependencyFile)) }
558
- def config
559
- @config ||= T.let(
560
- original_dependency_files.find do |f|
561
- f.name == ".cargo/config.toml"
559
+ # Cargo merges `.cargo/config.toml` hierarchically (package directory plus
560
+ # every ancestor up to the repo root), so we materialise all of them and
561
+ # let Cargo perform the merge with its own precedence rules. Ancestor
562
+ # configs carry relative `../` names and are written to the matching
563
+ # location within the temporary tree.
564
+ sig { returns(T::Array[Dependabot::DependencyFile]) }
565
+ def config_files
566
+ @config_files ||= T.let(
567
+ original_dependency_files.select do |f|
568
+ f.name.end_with?(".cargo/config.toml")
562
569
  end,
563
- T.nilable(Dependabot::DependencyFile)
570
+ T.nilable(T::Array[Dependabot::DependencyFile])
564
571
  )
565
572
  end
566
573
 
@@ -178,7 +178,7 @@ module Dependabot
178
178
  # we want to update that tag. The latest version will then be the SHA
179
179
  # of the latest tag that looks like a version.
180
180
  if git_commit_checker.pinned_ref_looks_like_version?
181
- latest_tag = git_commit_checker.local_tag_for_latest_version
181
+ latest_tag = git_commit_checker.local_tag_for_latest_version(update_cooldown)
182
182
  return latest_tag&.fetch(:commit_sha) || dependency.version
183
183
  end
184
184
 
@@ -198,7 +198,7 @@ module Dependabot
198
198
  # of the latest tag that looks like a version.
199
199
  if git_commit_checker.pinned_ref_looks_like_version? &&
200
200
  latest_git_tag_is_resolvable?
201
- new_tag = git_commit_checker.local_tag_for_latest_version
201
+ new_tag = git_commit_checker.local_tag_for_latest_version(update_cooldown)
202
202
  return T.must(new_tag).fetch(:commit_sha)
203
203
  end
204
204
 
@@ -220,9 +220,9 @@ module Dependabot
220
220
 
221
221
  @latest_git_tag_is_resolvable_checked = true
222
222
 
223
- return false if git_commit_checker.local_tag_for_latest_version.nil?
223
+ return false if git_commit_checker.local_tag_for_latest_version(update_cooldown).nil?
224
224
 
225
- replacement_tag = T.must(git_commit_checker.local_tag_for_latest_version)
225
+ replacement_tag = T.must(git_commit_checker.local_tag_for_latest_version(update_cooldown))
226
226
 
227
227
  prepared_files = FilePreparer.new(
228
228
  dependency_files: dependency_files,
@@ -311,7 +311,7 @@ module Dependabot
311
311
  latest_resolvable_version
312
312
  end
313
313
 
314
- sig { returns(T.nilable(T::Hash[T.any(String, Symbol), T.untyped])) }
314
+ sig { returns(T.nilable(T::Hash[T.any(String, Symbol), T.anything])) }
315
315
  def updated_source
316
316
  # Never need to update source, unless a git_dependency
317
317
  return dependency_source_details unless git_dependency?
@@ -319,7 +319,7 @@ module Dependabot
319
319
  # Update the git tag if updating a pinned version
320
320
  if git_commit_checker.pinned_ref_looks_like_version? &&
321
321
  latest_git_tag_is_resolvable?
322
- new_tag = T.must(git_commit_checker.local_tag_for_latest_version)
322
+ new_tag = T.must(git_commit_checker.local_tag_for_latest_version(update_cooldown))
323
323
  return T.must(dependency_source_details).merge(ref: new_tag.fetch(:tag))
324
324
  end
325
325
 
@@ -327,7 +327,7 @@ module Dependabot
327
327
  dependency_source_details
328
328
  end
329
329
 
330
- sig { returns(T.nilable(T::Hash[T.any(String, Symbol), T.untyped])) }
330
+ sig { returns(T.nilable(T::Hash[T.any(String, Symbol), T.anything])) }
331
331
  def dependency_source_details
332
332
  dependency.source_details
333
333
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-cargo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.384.0
4
+ version: 0.386.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.384.0
18
+ version: 0.386.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.384.0
25
+ version: 0.386.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: debug
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -266,7 +266,7 @@ licenses:
266
266
  - MIT
267
267
  metadata:
268
268
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
269
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.384.0
269
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.386.0
270
270
  rdoc_options: []
271
271
  require_paths:
272
272
  - lib