lib/license_finder/configuration.rb in license_finder-4.0.2 vs lib/license_finder/configuration.rb in license_finder-5.0.0

- old
+ new

@@ -17,10 +17,48 @@ def valid_project_path? return project_path.exist? if get(:project_path) true end + def mix_command + get(:mix_command) || 'mix' + end + + def merge(other_hash) + dup_with other_hash + end + + def rebar_deps_dir + path = get(:rebar_deps_dir) || 'deps' + project_path.join(path).expand_path + end + + def mix_deps_dir + path = get(:mix_deps_dir) || 'deps' + project_path.join(path).expand_path + end + + def decisions_file_path + path = File.join(project_path, 'doc/dependency_decisions.yml') unless project_path.nil? + path = get(:decisions_file) unless get(:decisions_file).nil? + path = 'doc/dependency_decisions.yml' if path.nil? + Pathname.new(path) + end + + def log_directory + path = get(:log_directory) || 'lf_logs' + project_path.join(path).expand_path + end + + def project_path + Pathname(path_prefix).expand_path + end + + def logger_mode + get(:logger) + end + def gradle_command get(:gradle_command) end def go_full_version @@ -45,42 +83,57 @@ def rebar_command get(:rebar_command) end - def mix_command - get(:mix_command) || 'mix' + def prepare + get(:prepare) || prepare_no_fail end - def rebar_deps_dir - path = get(:rebar_deps_dir) || 'deps' - project_path.join(path).expand_path + def prepare_no_fail + get(:prepare_no_fail) end - def mix_deps_dir - path = get(:mix_deps_dir) || 'deps' - project_path.join(path).expand_path + def save_file + get(:save) end - def decisions_file_path - path = get(:decisions_file) || 'doc/dependency_decisions.yml' - project_path.join(path).expand_path + def aggregate_paths + get(:aggregate_paths) end - def project_path - Pathname(path_prefix).expand_path + def recursive + get(:recursive) end - def prepare - get(:prepare) + def format + get(:format) end + def columns + get(:columns) + end + + protected + + attr_accessor :primary_config + def dup_with(other_hash) + dup.tap do |dup| + dup.primary_config.merge!(other_hash) + end + end + private attr_reader :saved_config def get(key) @primary_config[key.to_sym] || @saved_config[key.to_s] + end + + def initialize_copy(orig) + super + @primary_config = @primary_config.dup end def path_prefix get(:project_path) || '' end