dependabot-common 0.120.4 → 0.122.1

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.

Potentially problematic release.


This version of dependabot-common might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71c52ab937193ccc6c472643fe327544840ce8b99d27454d9f06f77435b52f88
4
- data.tar.gz: 5fd0a5e3350466bbf47ea7658caa77c656469f1de10aafb8a8308a3bdd848d71
3
+ metadata.gz: 86a9ccf63224238e2e7f39527f062c1f24f393d321adef7fb79a6723f943baa2
4
+ data.tar.gz: fac6a851e46d4be8107ca182e24beaea98849a59ab8bd3881e4149646e9f7e13
5
5
  SHA512:
6
- metadata.gz: 4d28541943c3f27dfee7688002d4c3bd692597f5870d9db512a4dd07510d0f48db033603172c044c9b713493549878e202130bd77b1a7272c7d51d246b86bf17
7
- data.tar.gz: 22a0c6246d7d2494614498736f94295986b29d1adfe31c8442361559d4d957ba7b0a1f419355b079247391cc2be75ad3383c580da2fb4f7de8181f8476014b91
6
+ metadata.gz: 7cbc55bfba0ad3fe380e192fa93fa1b789ca03a997357656a226b671b80425d5a84d4e769a2df9b7571659e8a218427573e7a139fc8a01956cb940a4e5028769
7
+ data.tar.gz: dbf7ee136e1f93f7fa27a5495c70e6dcc6c0107728000f386c1605e621ab3a287a62d00fd60fd4debe1967e611b4e64aa7e25a7451fe55520eea5107841bec14
@@ -4,18 +4,19 @@ module Dependabot
4
4
  module FileUpdaters
5
5
  class Base
6
6
  attr_reader :dependencies, :dependency_files, :repo_contents_path,
7
- :credentials
7
+ :credentials, :options
8
8
 
9
9
  def self.updated_files_regex
10
10
  raise NotImplementedError
11
11
  end
12
12
 
13
13
  def initialize(dependencies:, dependency_files:, repo_contents_path: nil,
14
- credentials:)
14
+ credentials:, options: {})
15
15
  @dependencies = dependencies
16
16
  @dependency_files = dependency_files
17
17
  @repo_contents_path = repo_contents_path
18
18
  @credentials = credentials
19
+ @options = options
19
20
 
20
21
  check_required_files
21
22
  end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dependabot/dependency_file"
4
+
5
+ module Dependabot
6
+ module FileUpdaters
7
+ class VendorUpdater
8
+ def initialize(repo_contents_path:, vendor_dir:)
9
+ @repo_contents_path = repo_contents_path
10
+ @vendor_dir = vendor_dir
11
+ end
12
+
13
+ # Returns changed files in the vendor/cache folder
14
+ #
15
+ # @param base_directory [String] Update config base directory
16
+ # @return [Array<Dependabot::DependencyFile>]
17
+ def updated_vendor_cache_files(base_directory:)
18
+ return [] unless repo_contents_path && vendor_dir
19
+
20
+ Dir.chdir(repo_contents_path) do
21
+ relative_dir = vendor_dir.sub("#{repo_contents_path}/", "")
22
+ status = SharedHelpers.run_shell_command(
23
+ "git status --untracked-files=all --porcelain=v1 #{relative_dir}"
24
+ )
25
+ changed_paths = status.split("\n").map { |l| l.split(" ") }
26
+ changed_paths.map do |type, path|
27
+ deleted = type == "D"
28
+ encoding = ""
29
+ encoded_content = File.read(path) unless deleted
30
+ if binary_file?(path)
31
+ encoding = Dependabot::DependencyFile::ContentEncoding::BASE64
32
+ encoded_content = Base64.encode64(encoded_content) unless deleted
33
+ end
34
+ Dependabot::DependencyFile.new(
35
+ name: path,
36
+ content: encoded_content,
37
+ directory: base_directory,
38
+ deleted: deleted,
39
+ content_encoding: encoding
40
+ )
41
+ end
42
+ end
43
+ end
44
+
45
+ private
46
+
47
+ BINARY_ENCODINGS = %w(application/x-tarbinary binary).freeze
48
+
49
+ attr_reader :repo_contents_path, :vendor_dir
50
+
51
+ def binary_file?(path)
52
+ return false unless File.exist?(path)
53
+
54
+ encoding = `file -b --mime-encoding #{path}`.strip
55
+
56
+ BINARY_ENCODINGS.include?(encoding)
57
+ end
58
+ end
59
+ end
60
+ end
@@ -173,6 +173,9 @@ module Dependabot
173
173
  end
174
174
 
175
175
  def self.configure_git_to_use_https_with_credentials(credentials)
176
+ File.open(GIT_CONFIG_GLOBAL_PATH, "w") do |file|
177
+ file << "# Generated by dependabot/dependabot-core"
178
+ end
176
179
  configure_git_to_use_https
177
180
  configure_git_credentials(credentials)
178
181
  end
@@ -258,7 +261,10 @@ module Dependabot
258
261
  end
259
262
 
260
263
  def self.reset_global_git_config(backup_path)
261
- return if backup_path.nil?
264
+ if backup_path.nil?
265
+ FileUtils.rm(GIT_CONFIG_GLOBAL_PATH)
266
+ return
267
+ end
262
268
  return unless File.exist?(backup_path)
263
269
 
264
270
  FileUtils.mv(backup_path, GIT_CONFIG_GLOBAL_PATH)
@@ -29,5 +29,15 @@ module Dependabot
29
29
  def self.register_requirement_class(package_manager, requirement_class)
30
30
  @requirement_classes[package_manager] = requirement_class
31
31
  end
32
+
33
+ @cloning_package_managers = Set[]
34
+
35
+ def self.always_clone_for_package_manager?(package_manager)
36
+ @cloning_package_managers.include?(package_manager)
37
+ end
38
+
39
+ def self.register_always_clone(package_manager)
40
+ @cloning_package_managers << package_manager
41
+ end
32
42
  end
33
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.120.4"
4
+ VERSION = "0.122.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.120.4
4
+ version: 0.122.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-01 00:00:00.000000000 Z
11
+ date: 2020-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit
@@ -292,14 +292,42 @@ dependencies:
292
292
  requirements:
293
293
  - - "~>"
294
294
  - !ruby/object:Gem::Version
295
- version: 0.91.0
295
+ version: 0.93.0
296
296
  type: :development
297
297
  prerelease: false
298
298
  version_requirements: !ruby/object:Gem::Requirement
299
299
  requirements:
300
300
  - - "~>"
301
301
  - !ruby/object:Gem::Version
302
- version: 0.91.0
302
+ version: 0.93.0
303
+ - !ruby/object:Gem::Dependency
304
+ name: simplecov
305
+ requirement: !ruby/object:Gem::Requirement
306
+ requirements:
307
+ - - "~>"
308
+ - !ruby/object:Gem::Version
309
+ version: 0.19.0
310
+ type: :development
311
+ prerelease: false
312
+ version_requirements: !ruby/object:Gem::Requirement
313
+ requirements:
314
+ - - "~>"
315
+ - !ruby/object:Gem::Version
316
+ version: 0.19.0
317
+ - !ruby/object:Gem::Dependency
318
+ name: simplecov-console
319
+ requirement: !ruby/object:Gem::Requirement
320
+ requirements:
321
+ - - "~>"
322
+ - !ruby/object:Gem::Version
323
+ version: 0.7.2
324
+ type: :development
325
+ prerelease: false
326
+ version_requirements: !ruby/object:Gem::Requirement
327
+ requirements:
328
+ - - "~>"
329
+ - !ruby/object:Gem::Version
330
+ version: 0.7.2
303
331
  - !ruby/object:Gem::Dependency
304
332
  name: vcr
305
333
  requirement: !ruby/object:Gem::Requirement
@@ -356,6 +384,7 @@ files:
356
384
  - lib/dependabot/file_updaters.rb
357
385
  - lib/dependabot/file_updaters/README.md
358
386
  - lib/dependabot/file_updaters/base.rb
387
+ - lib/dependabot/file_updaters/vendor_updater.rb
359
388
  - lib/dependabot/git_commit_checker.rb
360
389
  - lib/dependabot/git_metadata_fetcher.rb
361
390
  - lib/dependabot/metadata_finders.rb