Class: LicenseFinder::Configuration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(primary_config, saved_config) ⇒ Configuration

Returns a new instance of Configuration.



14
15
16
17
# File 'lib/license_finder/configuration.rb', line 14

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

Instance Attribute Details

#strict_matchingObject

Returns the value of attribute strict_matching.



168
169
170
# File 'lib/license_finder/configuration.rb', line 168

def strict_matching
  @strict_matching
end

Class Method Details

.with_optional_saved_config(primary_config) ⇒ Object



7
8
9
10
11
12
# File 'lib/license_finder/configuration.rb', line 7

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.safe_load(config_file.read) : {}
  new(primary_config, saved_config)
end

Instance Method Details

#aggregate_pathsObject



140
141
142
# File 'lib/license_finder/configuration.rb', line 140

def aggregate_paths
  get(:aggregate_paths)
end

#columnsObject



152
153
154
# File 'lib/license_finder/configuration.rb', line 152

def columns
  get(:columns)
end

#composer_check_require_onlyObject



164
165
166
# File 'lib/license_finder/configuration.rb', line 164

def composer_check_require_only
  get(:composer_check_require_only)
end

#conda_bash_setup_scriptObject



112
113
114
# File 'lib/license_finder/configuration.rb', line 112

def conda_bash_setup_script
  get(:conda_bash_setup_script)
end

#decisions_file_pathObject



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

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

#elixir_commandObject



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

def elixir_command
  get(:elixir_command) || 'elixir'
end

#enabled_package_manager_idsObject



68
69
70
# File 'lib/license_finder/configuration.rb', line 68

def enabled_package_manager_ids
  get(:enabled_package_managers)
end

#formatObject



148
149
150
# File 'lib/license_finder/configuration.rb', line 148

def format
  get(:format)
end

#go_full_versionObject



80
81
82
# File 'lib/license_finder/configuration.rb', line 80

def go_full_version
  get(:go_full_version)
end

#gradle_commandObject



76
77
78
# File 'lib/license_finder/configuration.rb', line 76

def gradle_command
  get(:gradle_command)
end

#gradle_include_groupsObject



84
85
86
# File 'lib/license_finder/configuration.rb', line 84

def gradle_include_groups
  get(:gradle_include_groups)
end

#log_directoryObject



54
55
56
57
58
59
60
61
62
# File 'lib/license_finder/configuration.rb', line 54

def log_directory
  path = get(:log_directory) || 'lf_logs'

  if (aggregate_paths || recursive) && project_path == ''
    Pathname(path).expand_path
  else
    project_path.join(path).expand_path
  end
end

#logger_modeObject



72
73
74
# File 'lib/license_finder/configuration.rb', line 72

def logger_mode
  get(:logger)
end

#maven_include_groupsObject



88
89
90
# File 'lib/license_finder/configuration.rb', line 88

def maven_include_groups
  get(:maven_include_groups)
end

#maven_optionsObject



92
93
94
# File 'lib/license_finder/configuration.rb', line 92

def maven_options
  get(:maven_options)
end

#merge(other_hash) ⇒ Object



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

def merge(other_hash)
  dup_with other_hash
end

#mix_commandObject



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

def mix_command
  get(:mix_command) || 'mix'
end

#mix_deps_dirObject



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

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

#npm_optionsObject



96
97
98
# File 'lib/license_finder/configuration.rb', line 96

def npm_options
  get(:npm_options)
end

#pip_requirements_pathObject



108
109
110
# File 'lib/license_finder/configuration.rb', line 108

def pip_requirements_path
  get(:pip_requirements_path)
end

#pnpm_optionsObject



104
105
106
# File 'lib/license_finder/configuration.rb', line 104

def pnpm_options
  get(:pnpm_options)
end

#prepareObject



124
125
126
# File 'lib/license_finder/configuration.rb', line 124

def prepare
  get(:prepare) || prepare_no_fail
end

#prepare_no_failObject



128
129
130
# File 'lib/license_finder/configuration.rb', line 128

def prepare_no_fail
  get(:prepare_no_fail)
end

#project_pathObject



64
65
66
# File 'lib/license_finder/configuration.rb', line 64

def project_path
  Pathname(path_prefix).expand_path
end

#python_versionObject



116
117
118
# File 'lib/license_finder/configuration.rb', line 116

def python_version
  get(:python_version)
end

#rebar_commandObject



120
121
122
# File 'lib/license_finder/configuration.rb', line 120

def rebar_command
  get(:rebar_command)
end

#rebar_deps_dirObject



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

def rebar_deps_dir
  path = get(:rebar_deps_dir) || '_build/default/lib'
  project_path.join(path).expand_path
end

#recursiveObject



144
145
146
# File 'lib/license_finder/configuration.rb', line 144

def recursive
  get(:recursive)
end

#save_fileObject



136
137
138
# File 'lib/license_finder/configuration.rb', line 136

def save_file
  get(:save)
end

#sbt_include_groupsObject



160
161
162
# File 'lib/license_finder/configuration.rb', line 160

def sbt_include_groups
  get(:sbt_include_groups)
end

#use_spdx_idObject



156
157
158
# File 'lib/license_finder/configuration.rb', line 156

def use_spdx_id
  get(:use_spdx_id)
end

#valid_project_path?Boolean

Returns:

  • (Boolean)


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

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

  true
end

#write_headersObject



132
133
134
# File 'lib/license_finder/configuration.rb', line 132

def write_headers
  get(:write_headers)
end

#yarn_optionsObject



100
101
102
# File 'lib/license_finder/configuration.rb', line 100

def yarn_options
  get(:yarn_options)
end