Class: LicenseFinder::Configuration
- Inherits:
-
Object
- Object
- LicenseFinder::Configuration
- Defined in:
- lib/license_finder/configuration.rb
Class Method Summary collapse
Instance Method Summary collapse
- #decisions_file_path ⇒ Object
- #go_full_version ⇒ Object
- #gradle_command ⇒ Object
- #gradle_include_groups ⇒ Object
-
#initialize(primary_config, saved_config) ⇒ Configuration
constructor
A new instance of Configuration.
- #project_path ⇒ Object
- #rebar_command ⇒ Object
- #rebar_deps_dir ⇒ Object
- #valid_project_path? ⇒ Boolean
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)). 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_path ⇒ Object
56 57 58 59 |
# File 'lib/license_finder/configuration.rb', line 56 def decisions_file_path path = get(:decisions_file) || 'doc/dependency_decisions.yml' project_path.join(path). end |
#go_full_version ⇒ Object
39 40 41 |
# File 'lib/license_finder/configuration.rb', line 39 def go_full_version get(:go_full_version) end |
#gradle_command ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/license_finder/configuration.rb', line 24 def gradle_command get(:gradle_command) || ( if Platform.windows? wrapper = 'gradlew.bat' gradle = 'gradle.bat' else wrapper = 'gradlew' gradle = 'gradle' end executable = File.exist?(wrapper) ? wrapper : gradle "#{executable} --console plain" ) end |
#gradle_include_groups ⇒ Object
43 44 45 |
# File 'lib/license_finder/configuration.rb', line 43 def gradle_include_groups get(:gradle_include_groups) end |
#project_path ⇒ Object
61 62 63 |
# File 'lib/license_finder/configuration.rb', line 61 def project_path Pathname(path_prefix). end |
#rebar_command ⇒ Object
47 48 49 |
# File 'lib/license_finder/configuration.rb', line 47 def get(:rebar_command) || 'rebar' end |
#rebar_deps_dir ⇒ Object
51 52 53 54 |
# File 'lib/license_finder/configuration.rb', line 51 def path = get(:rebar_deps_dir) || 'deps' project_path.join(path). end |
#valid_project_path? ⇒ 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 |