lib/fiona7/engine.rb in infopark_fiona7-1.5.2.1.0.pre.beta1 vs lib/fiona7/engine.rb in infopark_fiona7-1.5.3.2.0.pre.beta1
- old
+ new
@@ -124,16 +124,34 @@
end
end
end
def self.workflows_enabled?
- true
+ !!self.read_config.features.workflows_enabled
end
- class Config < Struct.new("Config", :mode, :instance, :host, :port, :username, :secret, :root_mode, :dont_yell_at_me_for_abusing_attributes)
+ def self.facetting_enabled?
+ !!self.read_config.features.facetting_enabled
end
+ class Config < Struct.new("Config", :mode, :instance, :host, :port, :username, :secret, :root_mode, :dont_yell_at_me_for_abusing_attributes, :features)
+ def initialize(*args)
+ super
+ self.features = Features.new unless self.features
+ end
+ end
+
+ class Features < Struct.new("Features", :workflows_enabled, :facetting_enabled)
+ def initialize(workflows_enabled=true, facetting_enabled=true)
+ super
+ end
+ end
+
mattr_accessor :config
+
+ def self.read_config
+ self.config || raise("Fiona7 gem not configured! Please create `config/initializers/fiona7.rb` and use Fiona7.configure")
+ end
def self.configure(&block)
self.config = Config.new.tap do |config|
yield config