Module: Prometheus::PluginDSL

Included in:
Base
Defined in:
lib/prometheus/plugin_dsl.rb,
lib/prometheus/extra/config/lib/plugin_dsl.rb

Instance Method Summary collapse

Instance Method Details

#configurable(klass, key, opts = {}) ⇒ Object

Options for hash:

:label => 'Some Configurable'
:default => 'default value'


19
20
21
22
23
24
25
# File 'lib/prometheus/extra/config/lib/plugin_dsl.rb', line 19

def configurable(klass, key, opts={})
  opts[:key] = key
  opts[:label] ||= key
  Config.configurables ||= {}
  Config.configurables[klass.full_name] ||= []
  Config.configurables[klass.full_name] << opts
end

#full_name(str = nil) ⇒ Object



8
9
10
# File 'lib/prometheus/plugin_dsl.rb', line 8

def full_name(str = nil)
  @full_name ||= str
end

#readme(text = nil) ⇒ Object



4
5
6
# File 'lib/prometheus/plugin_dsl.rb', line 4

def readme(text = nil)
  @readme ||= text
end

#startObject

Make sure the user has a complete config before continuing.



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/prometheus/extra/config/lib/plugin_dsl.rb', line 4

def start
  if File.exists? CONFIG_PATH
    if Config.missing_configurables.size > 0
      Prometheus::ConfigCommands.new.invoke :repair
    else
      super
    end
  else
    Prometheus::ConfigCommands.new.invoke :edit
  end
end