license_scout 2.1.1 → 2.1.2

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: '083e8edafd9a99be05ba58d2af282874c2afedfef05cc7d5548f68c377178f63'
4
- data.tar.gz: a00c763ddafbcf149fdfacc7b005bb372509f3bd07186858b3d9247976b2c5b3
3
+ metadata.gz: 7e473b91a8ecd48f0f275b6d5e9ac7093adcafb244ab1237b5b5474f4fce24d8
4
+ data.tar.gz: 6a376513496e154780cae375fac9aa6b897117dcd418f847e84225eacdc46b68
5
5
  SHA512:
6
- metadata.gz: c31dcd43c92cd006a7cc644389b8c29993002d6c2ec4d29db92553ce56dd6d551cc11c29a572ed5b54f3ee7d126c615a8b9f9956366c804252485490d7b5fe44
7
- data.tar.gz: c4f345b2bd3f5a1cc7d8b36c00a0bbcf9ed4431e1829b0ff18b8e48e4a987dd6c6e134114829a87ba825ff43f4f0948bf0d7bb6cd9f5da11e261bdb475adfcf3
6
+ metadata.gz: 9ba5829b5be0cda80d42b58c2f09151ccf592b3006699d49edf790aa2a6d6aea41b696293e60992055c995ad4c1ef97c8804804e50ab30ffe25f17248466ed2b
7
+ data.tar.gz: 3dbc221cc0f6c2bd9dbdecd96c1c539c0188e43d8bf55ce791a5854bc9766b6d8a1b0feb324bdaa91e8d19521ae3a3d85b94a02fc9acc0701034e4c7363b9dd0
@@ -35,6 +35,10 @@ module LicenseScout
35
35
  dependency_managers.each { |d| collect_licenses_from(d) }
36
36
 
37
37
  LicenseScout::Log.info("[collector] All licenses successfully collected")
38
+ rescue Exceptions::UpstreamFetchError => e
39
+ LicenseScout::Log.error("[collector] Encountered an error attempting to fetch package metadata from upstream source:")
40
+ LicenseScout::Log.error("[collector] #{e}")
41
+ raise Exceptions::FailExit.new(e)
38
42
  rescue Exceptions::PackageNotFound => e
39
43
  LicenseScout::Log.error("[collector] One of the project's transitive dependencies could not be found:")
40
44
  LicenseScout::Log.error("[collector] #{e}")
@@ -18,7 +18,7 @@
18
18
  require "license_scout/dependency_manager/base"
19
19
  require "license_scout/exceptions"
20
20
 
21
- require "open-uri"
21
+ require "net/http"
22
22
  require "mixlib/shellout"
23
23
 
24
24
  module LicenseScout
@@ -74,10 +74,6 @@ module LicenseScout
74
74
  end.compact
75
75
  end
76
76
 
77
- def fetched_urls
78
- @fetched_urls ||= {}
79
- end
80
-
81
77
  private
82
78
 
83
79
  def license_from_manifest(manifest_content)
@@ -144,11 +140,18 @@ module LicenseScout
144
140
  end
145
141
 
146
142
  LicenseScout::Log.debug("[habitat] Fetching pkg_info from #{base_api_uri}")
147
- FFI_Yajl::Parser.parse(open(base_api_uri).read).tap do |bldr_info|
148
- fetched_urls["#{origin}/#{name}"] = base_api_uri
143
+ response = Net::HTTP.get_response(URI(base_api_uri))
144
+
145
+ if response.is_a?(Net::HTTPSuccess)
146
+ FFI_Yajl::Parser.parse(response.body)
147
+ else
148
+ case response.code
149
+ when "404"
150
+ nil
151
+ else
152
+ raise LicenseScout::Exceptions::UpstreamFetchError.new("Received \"#{response.code} #{response.msg}\" when attempting to fetch package information for the #{origin}/#{name} Habitat package")
153
+ end
149
154
  end
150
- rescue OpenURI::HTTPError
151
- nil
152
155
  end
153
156
 
154
157
  def channel_for_origin(pkg_origin)
@@ -24,5 +24,6 @@ module LicenseScout
24
24
  class PackageNotFound < Error; end
25
25
  class HabitatPackageNotFound < PackageNotFound; end
26
26
  class FailExit < Error; end
27
+ class UpstreamFetchError < Error; end
27
28
  end
28
29
  end
@@ -16,5 +16,5 @@
16
16
  #
17
17
 
18
18
  module LicenseScout
19
- VERSION = "2.1.1"
19
+ VERSION = "2.1.2"
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: license_scout
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Serdar Sutay
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-24 00:00:00.000000000 Z
12
+ date: 2018-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi-yajl