lib/licensed/configuration.rb in licensed-1.4.0 vs lib/licensed/configuration.rb in licensed-1.5.1
- old
+ new
@@ -9,13 +9,17 @@
".licensed.yaml".freeze,
".licensed.json".freeze
].freeze
SOURCE_TYPES = Source.constants.map { |c| Source.const_get(c) }.freeze
+ attr_reader :ui
+
def initialize(options = {}, inherited_options = {})
super()
+ @ui = Licensed::UI::Shell.new
+
# update order:
# 1. anything inherited from root config
# 2. app defaults
# 3. explicitly configured app settings
update(inherited_options)
@@ -118,12 +122,10 @@
end
class Configuration < AppConfiguration
class LoadError < StandardError; end
- attr_accessor :ui
-
# 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.
def self.load_from(path)
@@ -131,11 +133,9 @@
config_path = find_config(config_path) if config_path.directory?
Configuration.new(parse_config(config_path))
end
def initialize(options = {})
- @ui = Licensed::UI::Shell.new
-
apps = options.delete("apps") || []
super(default_options.merge(options))
self["apps"] = apps.map { |app| AppConfiguration.new(app, options) }
end