Class: Prometheus::ConfigCommands

Inherits:
Base
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/prometheus/extra/config/config_commands.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

banner, #help, #repl, repl_banner

Methods included from PluginDSL

#configurable, #full_name, #readme, #start

Class Method Details

.source_rootObject



10
# File 'lib/prometheus/extra/config/config_commands.rb', line 10

def self.source_root; TEMPLATES_PATH; end

Instance Method Details

#editObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/prometheus/extra/config/config_commands.rb', line 14

def edit
  if File.exists?(CONFIG_PATH)
    Config.configure(self)
  else
    say "Welcome to #{APP_NAME}! You must be new, since you don't have a configuration file :-)", :blue
    if yes? "Okay to create at #{CONFIG_PATH}? (Y/N)", :green
      copy_file "default_config.yml", CONFIG_PATH
      Config.configure(self)
    else
      say 'Sorry, you have to create a configuration file to proceed.', :red
      exit
    end
  end
end

#repairObject



30
31
32
33
34
# File 'lib/prometheus/extra/config/config_commands.rb', line 30

def repair
  say "Some configuration options have changed, please review", :green
  say "You are missing: #{Config.missing_configurables.join(', ')}", :red
  Config.configure(self)
end