dependabot-nuget 0.180.4 → 0.182.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2758aa36546dc2baeaa219132e628e75846800fb357ad9bfa061f7fdb30ada4
4
- data.tar.gz: ded4b1e1bc8ed592898e8b8c7170f6b9cefe23f51bf3038be9efa41a48164072
3
+ metadata.gz: a920467ace961b168648f0eaf5454df96a264894eae8ac303d5a5b54ac71b5a5
4
+ data.tar.gz: d144ca8b6b2b891c758069ef02f91f9220a80ad532f8764cb78b8bd0764b1195
5
5
  SHA512:
6
- metadata.gz: c5b9f545e0bfb6bd255bdd2fd49613764ec678c9ae38f0bd9123129c037c3253d981cf0b994e7b16c598d9f55c0d3d24955cc03ad492cf55a57d8865152795ad
7
- data.tar.gz: 211704b0bef1eccf894a38e4619049e35e975913fdac05117660f628c80b349c3855ee58a1e9253edb773e7867775bc52ac42dd2a74e913ceb50d4a7f03f956e
6
+ metadata.gz: 4c3aa954e32b96781fbc00340d9f7d3480084361a7265dd6b74ab65c5206aadaaa544c0a24ba89b7e93778de1d87d7f88a158b40cbc65140334400b7a4a0e726
7
+ data.tar.gz: 0cdddde6131043a33c23c4c9f3367b2e517685ddc9d2efb2296f5c470498adca8d547ef5700be4f6d6da0d60f82c762f360672863b8ff88df8a717e8af8dc087
@@ -12,7 +12,62 @@ module Dependabot
12
12
  def look_up_source
13
13
  return Source.from_url(dependency_source_url) if dependency_source_url
14
14
 
15
- look_up_source_in_nuspec(dependency_nuspec_file)
15
+ src_repo = look_up_source_in_nuspec(dependency_nuspec_file)
16
+ return src_repo if src_repo
17
+
18
+ # Fallback to getting source from the search result's projectUrl or licenseUrl.
19
+ # GitHub Packages doesn't support getting the `.nuspec`, switch to getting
20
+ # that instead once it is supported.
21
+ src_repo_from_project
22
+ end
23
+
24
+ def src_repo_from_project
25
+ source = dependency.requirements.find { |r| r&.fetch(:source) }&.fetch(:source)
26
+ return unless source
27
+
28
+ # Query the service index e.g. https://nuget.pkg.github.com/ORG/index.json
29
+ response = Excon.get(
30
+ source.fetch(:url),
31
+ idempotent: true,
32
+ **SharedHelpers.excon_defaults(headers: auth_header)
33
+ )
34
+ return unless response.status == 200
35
+
36
+ # Extract the query url e.g. https://nuget.pkg.github.com/ORG/query
37
+ search_base = extract_search_url(response.body)
38
+ return unless search_base
39
+
40
+ response = Excon.get(
41
+ search_base + "?q=#{dependency.name.downcase}&prerelease=true&semVerLevel=2.0.0",
42
+ idempotent: true,
43
+ **SharedHelpers.excon_defaults(headers: auth_header)
44
+ )
45
+ return unless response.status == 200
46
+
47
+ # Find a projectUrl or licenseUrl that look like a source URL
48
+ extract_source_repo(response.body)
49
+ end
50
+
51
+ def extract_search_url(body)
52
+ JSON.parse(body).
53
+ fetch("resources", []).
54
+ find { |r| r.fetch("@type") == "SearchQueryService" }&.
55
+ fetch("@id")
56
+ end
57
+
58
+ def extract_source_repo(body)
59
+ JSON.parse(body).fetch("data", []).each do |search_result|
60
+ next unless search_result["id"].downcase == dependency.name.downcase
61
+
62
+ if search_result.fetch("projectUrl")
63
+ source = Source.from_url(search_result.fetch("projectUrl"))
64
+ return source unless source.repo.nil?
65
+ end
66
+ if search_result.fetch("licenseUrl")
67
+ source = Source.from_url(search_result.fetch("licenseUrl"))
68
+ return source unless source.repo.nil?
69
+ end
70
+ end
16
71
  end
17
72
 
18
73
  def look_up_source_in_nuspec(nuspec)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-nuget
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.180.4
4
+ version: 0.182.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-06 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.180.4
19
+ version: 0.182.0
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.180.4
26
+ version: 0.182.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: debase
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.4.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.4.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: debug
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +114,28 @@ dependencies:
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: 1.26.0
117
+ version: 1.27.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 1.27.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: ruby-debug-ide
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 0.7.3
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
136
  - - "~>"
109
137
  - !ruby/object:Gem::Version
110
- version: 1.26.0
138
+ version: 0.7.3
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: simplecov
113
141
  requirement: !ruby/object:Gem::Requirement