Class: Licensed::Configuration
- Inherits:
-
AppConfiguration
- Object
- Hash
- AppConfiguration
- Licensed::Configuration
- Defined in:
- lib/licensed/configuration.rb
Defined Under Namespace
Classes: LoadError
Constant Summary
Constants inherited from AppConfiguration
AppConfiguration::DEFAULT_CACHE_PATH, AppConfiguration::DEFAULT_CONFIG_FILES
Class Method Summary collapse
-
.load_from(path) ⇒ Object
Loads and returns a Licensed::Configuration object from the given path.
Instance Method Summary collapse
-
#apps ⇒ Object
Returns an array of the applications for this licensed configuration.
-
#initialize(options = {}) ⇒ Configuration
constructor
A new instance of Configuration.
Methods inherited from AppConfiguration
#allow, #allowed?, #cache_path, #enabled?, #ignore, #ignored?, #pwd, #review, #reviewed?, #root, #source_path, #sources
Constructor Details
#initialize(options = {}) ⇒ Configuration
Returns a new instance of Configuration.
132 133 134 135 136 137 |
# File 'lib/licensed/configuration.rb', line 132 def initialize( = {}) apps = .delete("apps") || [] super(.merge()) self["apps"] = apps.map { |app| AppConfiguration.new(app, ) } end |
Class Method Details
.load_from(path) ⇒ Object
Loads and returns a Licensed::Configuration object from the given path. The path can be relative or absolute, and can point at a file or directory. If the path given is a directory, the directory will be searched for a ‘config.yml` file.
126 127 128 129 130 |
# File 'lib/licensed/configuration.rb', line 126 def self.load_from(path) config_path = Pathname.pwd.join(path) config_path = find_config(config_path) if config_path.directory? Configuration.new(parse_config(config_path)) end |
Instance Method Details
#apps ⇒ Object
Returns an array of the applications for this licensed configuration. If the configuration did not explicitly configure any applications, return self as an application configuration.
142 143 144 145 |
# File 'lib/licensed/configuration.rb', line 142 def apps return [self] if self["apps"].empty? self["apps"] end |