class Licensed::Commands::Notices

Public Instance Methods

default_reporter(options) click to toggle source

Returns the default reporter to use during the command run

options - The options the command was run with

Returns a Licensed::Reporters::CacheReporter

# File lib/licensed/commands/notices.rb, line 10
def default_reporter(options)
  Licensed::Reporters::NoticesReporter.new
end

Protected Instance Methods

evaluate_dependency(app, source, dependency, report) click to toggle source

Load a dependency record data and add it to the notices report.

app - The application configuration for the dependency source - The dependency source enumerator for the dependency dependency - An application dependency report - A report hash for the command to provide extra data for the report output.

Returns true.

# File lib/licensed/commands/notices.rb, line 24
def evaluate_dependency(app, source, dependency, report)
  report["record"] =
    if load_dependency_record_from_files
      load_cached_dependency_record(app, source, dependency, report)
    else
      dependency.record
    end

  true
end
load_cached_dependency_record(app, source, dependency, report) click to toggle source

Loads a dependency record from a cached file.

app - The application configuration for the dependency source - The dependency source enumerator for the dependency dependency - An application dependency report - A report hash for the command to provide extra data for the report output.

Returns a dependency record or nil if one doesn’t exist

# File lib/licensed/commands/notices.rb, line 43
def load_cached_dependency_record(app, source, dependency, report)
  filename = app.cache_path.join(source.class.type, "#{dependency.name}.#{DependencyRecord::EXTENSION}")
  record = Licensed::DependencyRecord.read(filename)
  if !record
    report.warnings << "expected cached record not found at #{filename}"
  end

  record
end
load_dependency_record_from_files() click to toggle source
# File lib/licensed/commands/notices.rb, line 53
def load_dependency_record_from_files
  !options.fetch(:computed, false)
end