dependabot-common 0.164.0 → 0.164.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/shared_helpers.rb +6 -2
- data/lib/dependabot/source.rb +37 -1
- data/lib/dependabot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b3537e1c2ef5a4a5120217558ff023781a1bc2530da65e7a37e8f80c75ac710
|
4
|
+
data.tar.gz: 9c11fca086d103b58ff9a532dd342bba154dcd72918c8c3100a662f2bd98dfa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff69bb062697827ad9ba6f583dbc6735419ccb1c9f9298dd523e11dcbdfcb134e8129998cb6f7b246356047b04b0ece0ff75c51234f39d9754c52c40139ad5ef
|
7
|
+
data.tar.gz: 83d50bf3ed74365bb964a237de1fa1a8620864890f703bc2619a1e5f0cbee80c039f475a8674cfc333a811c0a9b55b5cd758b8dd04f56d276f758bafc4577489
|
@@ -40,10 +40,14 @@ module Dependabot
|
|
40
40
|
|
41
41
|
def self.in_a_temporary_directory(directory = "/")
|
42
42
|
Dir.mkdir(Utils::BUMP_TMP_DIR_PATH) unless Dir.exist?(Utils::BUMP_TMP_DIR_PATH)
|
43
|
-
Dir.mktmpdir(Utils::BUMP_TMP_FILE_PREFIX, Utils::BUMP_TMP_DIR_PATH)
|
44
|
-
|
43
|
+
tmp_dir = Dir.mktmpdir(Utils::BUMP_TMP_FILE_PREFIX, Utils::BUMP_TMP_DIR_PATH)
|
44
|
+
|
45
|
+
begin
|
46
|
+
path = Pathname.new(File.join(tmp_dir, directory)).expand_path
|
45
47
|
FileUtils.mkpath(path)
|
46
48
|
Dir.chdir(path) { yield(path) }
|
49
|
+
ensure
|
50
|
+
FileUtils.rm_rf(tmp_dir)
|
47
51
|
end
|
48
52
|
end
|
49
53
|
|
data/lib/dependabot/source.rb
CHANGED
@@ -9,6 +9,15 @@ module Dependabot
|
|
9
9
|
(?:(?:/tree|/blob)/(?<branch>[^/]+)/(?<directory>.*)[\#|/])?
|
10
10
|
}x.freeze
|
11
11
|
|
12
|
+
GITHUB_ENTERPRISE_SOURCE = %r{
|
13
|
+
(?<protocol>(http://|https://|git://|ssh://))*
|
14
|
+
(?<username>[^@]+@)*
|
15
|
+
(?<host>[^/]+)
|
16
|
+
[/:]
|
17
|
+
(?<repo>[\w.-]+/(?:(?!\.git|\.\s)[\w.-])+)
|
18
|
+
(?:(?:/tree|/blob)/(?<branch>[^/]+)/(?<directory>.*)[\#|/])?
|
19
|
+
}x.freeze
|
20
|
+
|
12
21
|
GITLAB_SOURCE = %r{
|
13
22
|
(?<provider>gitlab)
|
14
23
|
(?:\.com)[/:]
|
@@ -40,7 +49,7 @@ module Dependabot
|
|
40
49
|
:hostname, :api_endpoint
|
41
50
|
|
42
51
|
def self.from_url(url_string)
|
43
|
-
return unless url_string&.match?(SOURCE_REGEX)
|
52
|
+
return github_enterprise_from_url(url_string) unless url_string&.match?(SOURCE_REGEX)
|
44
53
|
|
45
54
|
captures = url_string.match(SOURCE_REGEX).named_captures
|
46
55
|
|
@@ -52,6 +61,33 @@ module Dependabot
|
|
52
61
|
)
|
53
62
|
end
|
54
63
|
|
64
|
+
def self.github_enterprise_from_url(url_string)
|
65
|
+
captures = url_string&.match(GITHUB_ENTERPRISE_SOURCE)&.named_captures
|
66
|
+
return unless captures
|
67
|
+
|
68
|
+
base_url = "https://#{captures.fetch('host')}"
|
69
|
+
|
70
|
+
return unless github_enterprise?(base_url)
|
71
|
+
|
72
|
+
new(
|
73
|
+
provider: "github",
|
74
|
+
repo: captures.fetch("repo"),
|
75
|
+
directory: captures.fetch("directory"),
|
76
|
+
branch: captures.fetch("branch"),
|
77
|
+
hostname: captures.fetch("host"),
|
78
|
+
api_endpoint: File.join(base_url, "api", "v3")
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.github_enterprise?(base_url)
|
83
|
+
resp = Excon.get(File.join(base_url, "status"))
|
84
|
+
resp.status == 200 &&
|
85
|
+
# Alternatively: resp.headers["Server"] == "GitHub.com", but this
|
86
|
+
# currently doesn't work with development environments
|
87
|
+
resp.headers["X-GitHub-Request-Id"] &&
|
88
|
+
!resp.headers["X-GitHub-Request-Id"].empty?
|
89
|
+
end
|
90
|
+
|
55
91
|
def initialize(provider:, repo:, directory: nil, branch: nil, commit: nil,
|
56
92
|
hostname: nil, api_endpoint: nil)
|
57
93
|
if (hostname.nil? ^ api_endpoint.nil?) && (provider != "codecommit")
|
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.164.
|
4
|
+
version: 0.164.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|