Module: Nucleon::Mixin::Action::Config
- Included in:
- Plugin::CmAction
- Defined in:
- lib/core/mixin/action/config.rb
Instance Method Summary collapse
-
#config_config ⇒ Object
—————————————————————————– Settings.
-
#config_ignore ⇒ Object
—.
-
#import_system_config(path) ⇒ Object
—————————————————————————– Utilities.
Instance Method Details
#config_config ⇒ Object
Settings
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/core/mixin/action/config.rb', line 10 def config_config register_str :settings_path, CM.config_path, 'nucleon.mixin.action.config.options.settings_path' do |value| success = true if value path = File.(value) if File.exist?(path) success = false unless import_system_config(path) else warn('nucleon.mixin.action.config.errors.settings_path', { :path => path }) success = false end end success end end |
#config_ignore ⇒ Object
30 31 32 |
# File 'lib/core/mixin/action/config.rb', line 30 def config_ignore [ :settings_path ] end |
#import_system_config(path) ⇒ Object
Utilities
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/core/mixin/action/config.rb', line 40 def import_system_config(path) config_provider = (File.directory?(path) ? :directory : :file) system_config = CM.configuration(extended_config(:system_config, { :path => path, :translator_error => 'nucleon.mixin.action.config.errors.translator', :config_error => 'nucleon.mixin.action.config.errors.config_file' }), config_provider).export unless system_config.nil? # Values are already set from parameters and validation is just starting system_config.each do |key, value| # TODO: Some error handling here if config key doesn't exist # For instance, if extra properties in config file if !config.has_key?(key) || settings[key] == config[key].default settings[key] = value end end end system_config.nil? ? false : true end |