dependabot-cargo 0.95.24 → 0.95.25

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: 284d3c23fa7370955edb67caeaf44097c7d9e95b701aa953ab47367ad9b7d175
4
- data.tar.gz: cd9bd6478a851cb0902797346b82884743a600aeae9f6278f3079c7b017a3d1e
3
+ metadata.gz: 71564e7f24065290df8ff2e611a00a3f90e3a1819f8c870b967f656a6177bc2a
4
+ data.tar.gz: 68835f974282c72b6d6b9edf823bcd150eaaf69e2d42d6852890cd8594acf6d2
5
5
  SHA512:
6
- metadata.gz: 11539b7e2bd219222fffba881088196382d703d994ed6c9c7f7e8dfa78a0ae791891448ed399237a502ca4732c9269d8adf6a7f5b783364999447268ec61865a
7
- data.tar.gz: 1b9744a3f7f3b2e489e79cb9172ef9b073095953d240cc8c26115b55cc650ec42fa40fb91eaae79713e3dd327edc4267c8f94769713bbaeaeed26ae71335c034
6
+ metadata.gz: a660f29be2e7e9bc0cca5ee2f1c4720b902385f334a20643cc97be2b3fdbdd8283aad3c87d84d2915c29460097ca47c21b4e1d8be4394d32f6ff5cd74f1c25dc
7
+ data.tar.gz: 5d12ce85366666f40f2effd45547a567a95d452abce058504f96505c8d70596ca5048735bc560ffac10ed41b702c4628bbfcc3066516e8162ce410c13cde59be
@@ -134,7 +134,7 @@ module Dependabot
134
134
  def run_shell_command(command)
135
135
  start = Time.now
136
136
  stdout, process = Open3.capture2e(command)
137
- time_taken = start - Time.now
137
+ time_taken = Time.now - start
138
138
 
139
139
  # Raise an error with the output from the shell session if Cargo
140
140
  # returns a non-zero status
@@ -4,9 +4,11 @@ require "toml-rb"
4
4
  require "open3"
5
5
  require "dependabot/shared_helpers"
6
6
  require "dependabot/cargo/update_checker"
7
+ require "dependabot/cargo/file_parser"
7
8
  require "dependabot/cargo/version"
8
9
  require "dependabot/errors"
9
10
 
11
+ # rubocop:disable Metrics/ClassLength
10
12
  module Dependabot
11
13
  module Cargo
12
14
  class UpdateChecker
@@ -132,7 +134,7 @@ module Dependabot
132
134
  def run_cargo_command(command)
133
135
  start = Time.now
134
136
  stdout, process = Open3.capture2e(command)
135
- time_taken = start - Time.now
137
+ time_taken = Time.now - start
136
138
 
137
139
  # Raise an error with the output from the shell session if Cargo
138
140
  # returns a non-zero status
@@ -180,10 +182,11 @@ module Dependabot
180
182
  end
181
183
 
182
184
  if error.message.include?("authenticate when downloading repository")
183
- dependency_url =
184
- error.message.match(/Unable to update (?<url>.*)$/).
185
- named_captures.fetch("url").strip
186
- raise Dependabot::GitDependenciesNotReachable, dependency_url
185
+ raise if unreachable_git_urls.none?
186
+
187
+ # Check all dependencies for reachability (so that we raise a
188
+ # consistent error)
189
+ raise Dependabot::GitDependenciesNotReachable, unreachable_git_urls
187
190
  end
188
191
 
189
192
  if error.message.match?(BRANCH_NOT_FOUND_REGEX)
@@ -208,6 +211,33 @@ module Dependabot
208
211
  end
209
212
  # rubocop:enable Metrics/AbcSize
210
213
 
214
+ def unreachable_git_urls
215
+ @unreachable_git_urls ||=
216
+ begin
217
+ parser = FileParser.new(
218
+ dependency_files: original_dependency_files,
219
+ source: nil
220
+ )
221
+
222
+ unreachable_git_dependencies =
223
+ parser.parse.
224
+ select do |dep|
225
+ checker = GitCommitChecker.new(
226
+ dependency: dep,
227
+ credentials: credentials
228
+ )
229
+
230
+ checker.git_dependency? && !checker.git_repo_reachable?
231
+ end
232
+
233
+ unreachable_git_dependencies.map do |dep|
234
+ dep.requirements.
235
+ find { |r| r.dig(:source, :type) == "git" }.
236
+ fetch(:source).fetch(:url)
237
+ end
238
+ end
239
+ end
240
+
211
241
  def resolvability_error?(message)
212
242
  return true if message.include?("failed to parse lock")
213
243
  return true if message.include?("believes it's in a workspace")
@@ -326,3 +356,4 @@ module Dependabot
326
356
  end
327
357
  end
328
358
  end
359
+ # rubocop:enable Metrics/ClassLength
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.95.24
4
+ version: 0.95.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.95.24
19
+ version: 0.95.25
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.95.24
26
+ version: 0.95.25
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement