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: nil, # can be :quiet or :debug 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: nil, # can be :quiet or :debug
decisions_file: "doc/dependency_decisions.yml",
gradle_command: "gradle",
rebar_command: "rebar",
rebar_deps_dir: "deps",
33 34 35 36 37 |
# File 'lib/license_finder/core.rb', line 33 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.
18 19 20 |
# File 'lib/license_finder/core.rb', line 18 def config @config end |
Class Method Details
Instance Method Details
#decisions ⇒ Object
55 56 57 |
# File 'lib/license_finder/core.rb', line 55 def decisions @decisions ||= DecisionsFactory.decisions(config.decisions_file_path) end |
#modifying ⇒ Object
39 40 41 42 |
# File 'lib/license_finder/core.rb', line 39 def yield decisions.save!(config.decisions_file_path) end |
#prepare_projects ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/license_finder/core.rb', line 59 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
47 48 49 |
# File 'lib/license_finder/core.rb', line 47 def project_name decisions.project_name || config.project_path.basename.to_s end |
#project_path ⇒ Object
51 52 53 |
# File 'lib/license_finder/core.rb', line 51 def project_path config.project_path end |