Class: LicenseFinder::Core

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/license_finder/core.rb

Overview

Coordinates setup

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Core

Default options:

project_path: Pathname.pwd
logger: {,   # can include quiet: true or debug: true
decisions_file: "doc/dependency_decisions.yml",
gradle_command: "gradle",
rebar_command: "rebar",
rebar_deps_dir: "deps",

}



27
28
29
30
31
32
# File 'lib/license_finder/core.rb', line 27

def initialize(options = {})
  @logger = Logger.new(options.fetch(:logger, {}))
  @project_path = Pathname(options.fetch(:project_path, Pathname.pwd))
  @config = Configuration.with_optional_saved_config(options, project_path)
  @decisions = Decisions.saved!(config.decisions_file)
end

Instance Attribute Details

#decisionsObject (readonly)

Returns the value of attribute decisions.



41
42
43
# File 'lib/license_finder/core.rb', line 41

def decisions
  @decisions
end

Class Method Details

.default_loggerObject



14
15
16
# File 'lib/license_finder/core.rb', line 14

def self.default_logger
  Logger::Default.new
end

Instance Method Details

#modifyingObject



34
35
36
37
# File 'lib/license_finder/core.rb', line 34

def modifying
  yield
  decisions.save!(config.decisions_file)
end

#project_nameObject



43
44
45
# File 'lib/license_finder/core.rb', line 43

def project_name
  decisions.project_name || project_path.basename.to_s
end