Class: LicenseFinder::Core
- Inherits:
-
Object
- Object
- LicenseFinder::Core
- Extended by:
- Forwardable
- Defined in:
- lib/license_finder/core.rb
Overview
Coordinates setup
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #decisions ⇒ Object
-
#initialize(configuration) ⇒ Core
constructor
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”, }. - #modifying ⇒ Object
- #prepare_projects ⇒ Object
- #project_name ⇒ Object
- #project_path ⇒ Object
Constructor Details
#initialize(configuration) ⇒ 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",
}
31 32 33 34 35 |
# File 'lib/license_finder/core.rb', line 31 def initialize(configuration) @logger = Logger.new(configuration.logger_mode) @config = configuration @scanner = Scanner.new() end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
16 17 18 |
# File 'lib/license_finder/core.rb', line 16 def config @config end |
Class Method Details
Instance Method Details
#decisions ⇒ Object
53 54 55 |
# File 'lib/license_finder/core.rb', line 53 def decisions @decisions ||= DecisionsFactory.decisions(config.decisions_file_path) end |
#modifying ⇒ Object
37 38 39 40 |
# File 'lib/license_finder/core.rb', line 37 def yield decisions.save!(config.decisions_file_path) end |
#prepare_projects ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/license_finder/core.rb', line 57 def prepare_projects clear_logs package_managers = @scanner.active_package_managers package_managers.each do |manager| logger.debug manager.class, 'Running prepare on project' manager.prepare logger.debug manager.class, 'Finished prepare on project', color: :green end end |
#project_name ⇒ Object
45 46 47 |
# File 'lib/license_finder/core.rb', line 45 def project_name decisions.project_name || config.project_path.basename.to_s end |
#project_path ⇒ Object
49 50 51 |
# File 'lib/license_finder/core.rb', line 49 def project_path config.project_path end |