Class: LicenseScout::Collector
- Inherits:
-
Object
- Object
- LicenseScout::Collector
- Defined in:
- lib/license_scout/collector.rb
Instance Attribute Summary collapse
-
#dependencies ⇒ Object
readonly
Returns the value of attribute dependencies.
Instance Method Summary collapse
Instance Attribute Details
#dependencies ⇒ Object (readonly)
Returns the value of attribute dependencies.
26 27 28 |
# File 'lib/license_scout/collector.rb', line 26 def dependencies @dependencies end |
Instance Method Details
#collect ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/license_scout/collector.rb', line 28 def collect @dependencies = Set.new if dependency_managers.empty? raise LicenseScout::Exceptions::Error.new("Failed to find any files associated with known dependency managers in the following directories:\n#{LicenseScout::Config.directories.map { |dir| "\t• #{dir}" }.join("\n")}\n") end dependency_managers.each { |d| collect_licenses_from(d) } LicenseScout::Log.info("[collector] All licenses successfully collected") rescue Exceptions::UpstreamFetchError => e LicenseScout::Log.error("[collector] Encountered an error attempting to fetch package metadata from upstream source:") LicenseScout::Log.error("[collector] #{e}") raise Exceptions::FailExit.new(e) rescue Exceptions::PackageNotFound => e LicenseScout::Log.error("[collector] One of the project's transitive dependencies could not be found:") LicenseScout::Log.error("[collector] #{e}") raise Exceptions::FailExit.new(e) end |