lib/licensed/configuration.rb in licensed-0.6.0 vs lib/licensed/configuration.rb in licensed-0.10.0
- old
+ new
@@ -2,12 +2,13 @@
module Licensed
class Configuration < Hash
attr_accessor :ui
- def initialize
+ def initialize(options = {})
super()
+ self.path = options["license-dir"] if options["license-dir"]
update config_path.exist? ? YAML.load_file(config_path) : {}
self["sources"] ||= {}
self["reviewed"] ||= {}
self["ignored"] ||= {}
@@ -15,13 +16,17 @@
@ui = Licensed::UI::Shell.new
end
def path
- Pathname.new("vendor/licenses")
+ @path ||= Pathname.new("vendor/licenses")
end
+ def path=(value)
+ @path = Pathname.new(value)
+ end
+
def config_path
path.join("config.yml")
end
def pwd
@@ -30,10 +35,13 @@
def sources
@sources ||= [
Source::Bundler.new(self),
Source::Bower.new(self),
- Source::NPM.new(self)
+ Source::Manifest.new(self),
+ Source::NPM.new(self),
+ Source::Stack.new(self),
+ Source::Go.new(self)
].select(&:enabled?)
end
def enabled?(source_type)
self["sources"].fetch(source_type, true)