Class: LicenseFinder::Configuration
- Inherits:
-
Object
- Object
- LicenseFinder::Configuration
- Defined in:
- lib/license_finder/configuration.rb
Defined Under Namespace
Modules: Persistence Classes: Artifacts
Instance Attribute Summary collapse
-
#artifacts ⇒ Object
Returns the value of attribute artifacts.
-
#gradle_command ⇒ Object
Returns the value of attribute gradle_command.
-
#ignore_dependencies ⇒ Object
Returns the value of attribute ignore_dependencies.
-
#ignore_groups ⇒ Object
Returns the value of attribute ignore_groups.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#whitelist ⇒ Object
Returns the value of attribute whitelist.
Class Method Summary collapse
- .ensure_default ⇒ Object
- .move! ⇒ Object
-
.prepare(config) ⇒ Object
It’s nice to keep destructive file system manipulation out of the initializer.
Instance Method Summary collapse
-
#initialize(config) ⇒ Configuration
constructor
A new instance of Configuration.
- #last_modified ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(config) ⇒ Configuration
Returns a new instance of Configuration.
33 34 35 36 37 38 39 40 |
# File 'lib/license_finder/configuration.rb', line 33 def initialize(config) @whitelist = Array(config['whitelist']) @ignore_groups = Array(config["ignore_groups"]) @ignore_dependencies = Array(config["ignore_dependencies"]) @artifacts = Artifacts.new(Pathname(config['dependencies_file_dir'] || './doc/')) @project_name = config['project_name'] || determine_project_name @gradle_command = config['gradle_command'] || 'gradle' end |
Instance Attribute Details
#artifacts ⇒ Object
Returns the value of attribute artifacts.
31 32 33 |
# File 'lib/license_finder/configuration.rb', line 31 def artifacts @artifacts end |
#gradle_command ⇒ Object
Returns the value of attribute gradle_command.
31 32 33 |
# File 'lib/license_finder/configuration.rb', line 31 def gradle_command @gradle_command end |
#ignore_dependencies ⇒ Object
Returns the value of attribute ignore_dependencies.
31 32 33 |
# File 'lib/license_finder/configuration.rb', line 31 def ignore_dependencies @ignore_dependencies end |
#ignore_groups ⇒ Object
Returns the value of attribute ignore_groups.
31 32 33 |
# File 'lib/license_finder/configuration.rb', line 31 def ignore_groups @ignore_groups end |
#project_name ⇒ Object
Returns the value of attribute project_name.
31 32 33 |
# File 'lib/license_finder/configuration.rb', line 31 def project_name @project_name end |
#whitelist ⇒ Object
Returns the value of attribute whitelist.
31 32 33 |
# File 'lib/license_finder/configuration.rb', line 31 def whitelist @whitelist end |
Class Method Details
.ensure_default ⇒ Object
5 6 7 8 |
# File 'lib/license_finder/configuration.rb', line 5 def self.ensure_default Persistence.init prepare(Persistence.get) end |
.move! ⇒ Object
14 15 16 17 18 19 |
# File 'lib/license_finder/configuration.rb', line 14 def self.move! config = prepare(Persistence.get.merge('dependencies_file_dir' => './doc/')) config.save FileUtils.mv(Dir["dependencies*"], config.artifacts.dir) end |
.prepare(config) ⇒ Object
It’s nice to keep destructive file system manipulation out of the initializer. That reduces test polution, but is slightly inconvenient for methods like Configuration.ensure_default and Configuration.move!, which need a working artifacts directory. This helper is a compromise.
25 26 27 28 29 |
# File 'lib/license_finder/configuration.rb', line 25 def self.prepare(config) result = new(config) result.artifacts.init result end |
Instance Method Details
#last_modified ⇒ Object
10 11 12 |
# File 'lib/license_finder/configuration.rb', line 10 def last_modified Persistence.last_modified end |
#save ⇒ Object
42 43 44 |
# File 'lib/license_finder/configuration.rb', line 42 def save Persistence.set(to_hash) end |