dependabot-common 0.95.28 → 0.95.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dependabot/file_fetchers/base.rb +49 -27
- 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: 51ab8a1d3293589fe1477093a78ed847908cf3a3dfbb6e336c761dcf3cdcdcb4
|
4
|
+
data.tar.gz: ab73df799221419d36c6e26420c2015e60d69c1b62b43b10d70a7633d436a0c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be01459381d8a9990d03921f2952a5b2c2cac0c472b9dbaa3029f45886c083a7002625280936b21109aeff72c9340d7ec1b2a7b1e0218d70b0c4def82bff9819
|
7
|
+
data.tar.gz: 842019622a8b0c67d2a57af00bbb5df0edebeb40d0a3811200e3ae8586d625c496abafa34d8142965b6e2790983dfe90546e0cbba4399d5f82e119e8f9d8769c
|
@@ -32,7 +32,7 @@ module Dependabot
|
|
32
32
|
@source = source
|
33
33
|
@credentials = credentials
|
34
34
|
|
35
|
-
@
|
35
|
+
@linked_paths = {}
|
36
36
|
end
|
37
37
|
|
38
38
|
def repo
|
@@ -131,8 +131,8 @@ module Dependabot
|
|
131
131
|
|
132
132
|
return result.call unless fetch_submodules && !retrying
|
133
133
|
|
134
|
-
|
135
|
-
return result.call unless
|
134
|
+
_find_linked_dirs(path)
|
135
|
+
return result.call unless _linked_dir_for(path)
|
136
136
|
|
137
137
|
retrying = true
|
138
138
|
retry
|
@@ -154,17 +154,37 @@ module Dependabot
|
|
154
154
|
path = path.gsub(" ", "%20")
|
155
155
|
github_response = github_client.contents(repo, path: path, ref: commit)
|
156
156
|
|
157
|
-
if github_response.respond_to?(:type)
|
158
|
-
|
159
|
-
@submodule_directories[path] = github_response
|
160
|
-
raise Octokit::NotFound
|
161
|
-
elsif github_response.respond_to?(:type)
|
157
|
+
if github_response.respond_to?(:type)
|
158
|
+
update_linked_paths(repo, path, commit, github_response)
|
162
159
|
raise Octokit::NotFound
|
163
160
|
end
|
164
161
|
|
165
162
|
github_response.map { |f| _build_github_file_struct(f) }
|
166
163
|
end
|
167
164
|
|
165
|
+
def update_linked_paths(repo, path, commit, github_response)
|
166
|
+
case github_response.type
|
167
|
+
when "submodule"
|
168
|
+
sub_source = Source.from_url(github_response.submodule_git_url)
|
169
|
+
return unless sub_source
|
170
|
+
|
171
|
+
@linked_paths[path] = {
|
172
|
+
repo: sub_source.repo,
|
173
|
+
provider: sub_source.provider,
|
174
|
+
commit: github_response.sha,
|
175
|
+
path: "/"
|
176
|
+
}
|
177
|
+
when "symlink"
|
178
|
+
updated_path = File.join(File.dirname(path), github_response.target)
|
179
|
+
@linked_paths[path] = {
|
180
|
+
repo: repo,
|
181
|
+
provider: "github",
|
182
|
+
commit: commit,
|
183
|
+
path: Pathname.new(updated_path).cleanpath.to_path
|
184
|
+
}
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
168
188
|
def _build_github_file_struct(file)
|
169
189
|
OpenStruct.new(
|
170
190
|
name: file.name,
|
@@ -212,17 +232,19 @@ module Dependabot
|
|
212
232
|
end
|
213
233
|
|
214
234
|
def _full_specification_for(path, fetch_submodules:)
|
215
|
-
if fetch_submodules &&
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
235
|
+
if fetch_submodules && _linked_dir_for(path)
|
236
|
+
linked_dir_details = @linked_paths[_linked_dir_for(path)]
|
237
|
+
sub_path =
|
238
|
+
path.gsub(%r{^#{Regexp.quote(_linked_dir_for(path))}(/|$)}, "")
|
239
|
+
new_path =
|
240
|
+
Pathname.new(File.join(linked_dir_details.fetch(:path), sub_path)).
|
241
|
+
cleanpath.to_path.
|
242
|
+
gsub(%r{^/}, "")
|
221
243
|
{
|
222
|
-
repo:
|
223
|
-
commit:
|
224
|
-
provider:
|
225
|
-
path:
|
244
|
+
repo: linked_dir_details.fetch(:repo),
|
245
|
+
commit: linked_dir_details.fetch(:commit),
|
246
|
+
provider: linked_dir_details.fetch(:provider),
|
247
|
+
path: new_path
|
226
248
|
}
|
227
249
|
else
|
228
250
|
{
|
@@ -245,10 +267,10 @@ module Dependabot
|
|
245
267
|
rescue *CLIENT_NOT_FOUND_ERRORS
|
246
268
|
retrying ||= false
|
247
269
|
|
248
|
-
raise unless fetch_submodules && !retrying && !
|
270
|
+
raise unless fetch_submodules && !retrying && !_linked_dir_for(path)
|
249
271
|
|
250
|
-
|
251
|
-
raise unless
|
272
|
+
_find_linked_dirs(path)
|
273
|
+
raise unless _linked_dir_for(path)
|
252
274
|
|
253
275
|
retrying = true
|
254
276
|
retry
|
@@ -306,10 +328,10 @@ module Dependabot
|
|
306
328
|
raise Dependabot::RepoNotFound, source
|
307
329
|
end
|
308
330
|
|
309
|
-
# Update the @
|
331
|
+
# Update the @linked_paths hash by exploiting a side-effect of
|
310
332
|
# recursively calling `repo_contents` for each directory up the tree
|
311
|
-
# until a submodule is found
|
312
|
-
def
|
333
|
+
# until a submodule or symlink is found
|
334
|
+
def _find_linked_dirs(path)
|
313
335
|
path = Pathname.new(path).cleanpath.to_path.gsub(%r{^/*}, "")
|
314
336
|
dir = File.dirname(path)
|
315
337
|
|
@@ -323,9 +345,9 @@ module Dependabot
|
|
323
345
|
)
|
324
346
|
end
|
325
347
|
|
326
|
-
def
|
327
|
-
|
328
|
-
|
348
|
+
def _linked_dir_for(path)
|
349
|
+
linked_dirs = @linked_paths.keys
|
350
|
+
linked_dirs.
|
329
351
|
select { |k| path.match?(%r{^#{Regexp.quote(k)}(/|$)}) }.
|
330
352
|
max_by(&:length)
|
331
353
|
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.95.
|
4
|
+
version: 0.95.29
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dependabot
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-ecr
|