dependabot-common 0.121.0 → 0.121.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 +4 -4
- data/lib/dependabot/file_updaters/vendor_updater.rb +86 -0
- data/lib/dependabot/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25ecba430a3c4e0437ca444e4ac4ea59341370f1fcc9bf5732aa404ed2c76435
|
4
|
+
data.tar.gz: a5d4c9744bf13f271136c1a307cf04207a7ccc6273d0b52025361d57eb32482f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd41873f07384bf578d3431471deb14ef57601e48e6a326a68a2d1bcc02cd7de504c02f26e94218591bc8e1536fb0aba030ccb15777bb9e66afb59a0f43a2cb4
|
7
|
+
data.tar.gz: 200b360a032a55d421b903bc62f6285f11650b82a9bcaf366c2842821eaff2c31337ea93cc6a6ca52569065aa1dc0b5ec9bc6309378a1c10ecb619f517c4b808
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "dependabot/dependency_file"
|
4
|
+
|
5
|
+
module Dependabot
|
6
|
+
module FileUpdaters
|
7
|
+
class VendorUpdater
|
8
|
+
# notable filenames without a reliable extension:
|
9
|
+
TEXT_FILE_NAMES = [
|
10
|
+
"README",
|
11
|
+
"LICENSE",
|
12
|
+
"Gemfile",
|
13
|
+
"Gemfile.lock",
|
14
|
+
".bundlecache",
|
15
|
+
".gitignore"
|
16
|
+
].freeze
|
17
|
+
|
18
|
+
TEXT_FILE_EXTS = [
|
19
|
+
# code
|
20
|
+
".rb",
|
21
|
+
".erb",
|
22
|
+
".gemspec",
|
23
|
+
".js",
|
24
|
+
".html",
|
25
|
+
# config
|
26
|
+
".json",
|
27
|
+
".xml",
|
28
|
+
".toml",
|
29
|
+
".yaml",
|
30
|
+
".yml",
|
31
|
+
# docs
|
32
|
+
".md",
|
33
|
+
".txt",
|
34
|
+
".go"
|
35
|
+
].freeze
|
36
|
+
|
37
|
+
def initialize(repo_contents_path:, vendor_dir:)
|
38
|
+
@repo_contents_path = repo_contents_path
|
39
|
+
@vendor_dir = vendor_dir
|
40
|
+
end
|
41
|
+
|
42
|
+
# Returns changed files in the vendor/cache folder
|
43
|
+
#
|
44
|
+
# @param base_directory [String] Update config base directory
|
45
|
+
# @return [Array<Dependabot::DependencyFile>]
|
46
|
+
def updated_vendor_cache_files(base_directory:)
|
47
|
+
return [] unless repo_contents_path && vendor_dir
|
48
|
+
|
49
|
+
Dir.chdir(repo_contents_path) do
|
50
|
+
relative_dir = vendor_dir.sub("#{repo_contents_path}/", "")
|
51
|
+
status = SharedHelpers.run_shell_command(
|
52
|
+
"git status --untracked-files=all --porcelain=v1 #{relative_dir}"
|
53
|
+
)
|
54
|
+
changed_paths = status.split("\n").map { |l| l.split(" ") }
|
55
|
+
changed_paths.map do |type, path|
|
56
|
+
deleted = type == "D"
|
57
|
+
encoding = ""
|
58
|
+
encoded_content = File.read(path) unless deleted
|
59
|
+
if binary_file?(path)
|
60
|
+
encoding = Dependabot::DependencyFile::ContentEncoding::BASE64
|
61
|
+
encoded_content = Base64.encode64(encoded_content) unless deleted
|
62
|
+
end
|
63
|
+
Dependabot::DependencyFile.new(
|
64
|
+
name: path,
|
65
|
+
content: encoded_content,
|
66
|
+
directory: base_directory,
|
67
|
+
deleted: deleted,
|
68
|
+
content_encoding: encoding
|
69
|
+
)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
attr_reader :repo_contents_path, :vendor_dir
|
77
|
+
|
78
|
+
def binary_file?(path)
|
79
|
+
return false if TEXT_FILE_NAMES.include?(File.basename(path))
|
80
|
+
return false if TEXT_FILE_EXTS.include?(File.extname(path))
|
81
|
+
|
82
|
+
true
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/lib/dependabot/version.rb
CHANGED
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.121.
|
4
|
+
version: 0.121.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-
|
11
|
+
date: 2020-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-codecommit
|
@@ -356,6 +356,7 @@ files:
|
|
356
356
|
- lib/dependabot/file_updaters.rb
|
357
357
|
- lib/dependabot/file_updaters/README.md
|
358
358
|
- lib/dependabot/file_updaters/base.rb
|
359
|
+
- lib/dependabot/file_updaters/vendor_updater.rb
|
359
360
|
- lib/dependabot/git_commit_checker.rb
|
360
361
|
- lib/dependabot/git_metadata_fetcher.rb
|
361
362
|
- lib/dependabot/metadata_finders.rb
|