Class: Epi::Daemon::Responders::Config
- Inherits:
-
Epi::Daemon::Responder
- Object
- Epi::Daemon::Responder
- Epi::Daemon::Responders::Config
- Defined in:
- lib/epi/daemon/responders/config.rb
Instance Attribute Summary collapse
-
#add_paths ⇒ Object
Returns the value of attribute add_paths.
-
#remove_paths ⇒ Object
Returns the value of attribute remove_paths.
Attributes inherited from Epi::Daemon::Responder
Instance Method Summary collapse
Methods inherited from Epi::Daemon::Responder
#done, #initialize, #logger, #puts, run
Constructor Details
This class inherits a constructor from Epi::Daemon::Responder
Instance Attribute Details
#add_paths ⇒ Object
Returns the value of attribute add_paths.
6 7 8 |
# File 'lib/epi/daemon/responders/config.rb', line 6 def add_paths @add_paths end |
#remove_paths ⇒ Object
Returns the value of attribute remove_paths.
6 7 8 |
# File 'lib/epi/daemon/responders/config.rb', line 6 def remove_paths @remove_paths end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/epi/daemon/responders/config.rb', line 8 def run result = [] configs = Data.configuration_paths add_paths.each do |path| path = path.to_s if configs.include?(path) logger.warn "Tried to re-add config path: #{path}" result << "Config path already loaded: #{path}" else logger.info "Adding config path: #{path}" configs << path result << "Added config path: #{path}" end end if add_paths remove_paths.each do |path| path = path.to_s if configs.include?(path) logger.info "Removing config path: #{path}" # TODO: clean up any junk the config file may have left configs.delete path result << "Removed config path: #{path}" else logger.warn "Tried to remove unknown config path: #{path}" result << "Config path not loaded: #{path}" end end if remove_paths Data.save Jobs.beat! result.join ' ' end |