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 38 |
# File 'lib/license_finder/core.rb', line 33 def initialize(configuration) @printer = Printer.new @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
56 57 58 |
# File 'lib/license_finder/core.rb', line 56 def decisions @decisions ||= DecisionsFactory.decisions(config.decisions_file_path) end |
#modifying ⇒ Object
40 41 42 43 |
# File 'lib/license_finder/core.rb', line 40 def yield decisions.save!(config.decisions_file_path) end |
#prepare_projects ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/license_finder/core.rb', line 60 def prepare_projects clear_logs package_managers = @scanner.active_package_managers package_managers.each do |manager| logger.debug manager.class, "Running prepare on project '#{config.project_path}'" manager.prepare logger.debug manager.class, "Finished prepare on project '#{config.project_path}'", color: :green end end |
#project_name ⇒ Object
48 49 50 |
# File 'lib/license_finder/core.rb', line 48 def project_name decisions.project_name || config.project_path.basename.to_s end |
#project_path ⇒ Object
52 53 54 |
# File 'lib/license_finder/core.rb', line 52 def project_path config.project_path end |