Class: LicenseFinder::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/license_finder/configuration.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(primary_config, saved_config) ⇒ Configuration

Returns a new instance of Configuration.



12
13
14
15
# File 'lib/license_finder/configuration.rb', line 12

def initialize(primary_config, saved_config)
  @primary_config = primary_config
  @saved_config = saved_config
end

Class Method Details

.with_optional_saved_config(primary_config) ⇒ Object



5
6
7
8
9
10
# File 'lib/license_finder/configuration.rb', line 5

def self.with_optional_saved_config(primary_config)
  project_path = Pathname(primary_config.fetch(:project_path, Pathname.pwd)).expand_path
  config_file =  project_path.join('config', 'license_finder.yml')
  saved_config = config_file.exist? ? YAML.load(config_file.read) : {}
  new(primary_config, saved_config)
end

Instance Method Details

#decisions_file_pathObject



53
54
55
56
# File 'lib/license_finder/configuration.rb', line 53

def decisions_file_path
  path = get(:decisions_file) || 'doc/dependency_decisions.yml'
  project_path.join(path).expand_path
end

#go_full_versionObject



28
29
30
# File 'lib/license_finder/configuration.rb', line 28

def go_full_version
  get(:go_full_version)
end

#gradle_commandObject



24
25
26
# File 'lib/license_finder/configuration.rb', line 24

def gradle_command
  get(:gradle_command)
end

#gradle_include_groupsObject



32
33
34
# File 'lib/license_finder/configuration.rb', line 32

def gradle_include_groups
  get(:gradle_include_groups)
end

#maven_include_groupsObject



36
37
38
# File 'lib/license_finder/configuration.rb', line 36

def maven_include_groups
  get(:maven_include_groups)
end

#maven_optionsObject



40
41
42
# File 'lib/license_finder/configuration.rb', line 40

def maven_options
  get(:maven_options)
end

#project_pathObject



58
59
60
# File 'lib/license_finder/configuration.rb', line 58

def project_path
  Pathname(path_prefix).expand_path
end

#rebar_commandObject



44
45
46
# File 'lib/license_finder/configuration.rb', line 44

def rebar_command
  get(:rebar_command)
end

#rebar_deps_dirObject



48
49
50
51
# File 'lib/license_finder/configuration.rb', line 48

def rebar_deps_dir
  path = get(:rebar_deps_dir) || 'deps'
  project_path.join(path).expand_path
end

#valid_project_path?Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
# File 'lib/license_finder/configuration.rb', line 17

def valid_project_path?
  if get(:project_path)
    return project_path.exist?
  end
  true
end