Class: Prometheus::Plugin

Inherits:
Base
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/prometheus/plugins/plugin/plugin_commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

banner, #help, #repl, repl_banner

Methods included from PluginDSL

#configurable, #full_name, #readme, #start

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/prometheus/plugins/plugin/plugin_commands.rb', line 6

def name
  @name
end

Instance Method Details

#new(name) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/prometheus/plugins/plugin/plugin_commands.rb', line 14

def new(name)
  @name = name
  plugin_dirs = Dir[File.join(Dir.pwd, 'lib', '**', 'plugins')]
  unless plugin_dirs.empty?
    plugin_dir = File.expand_path(File.join(plugin_dirs.first, @name))
    directory 'plugin', plugin_dir
    say "New plugin adding to application at #{plugin_dir}", :green
    say "Remember, this plugin will not be active until registered in your Prometheus::Commands subclass", :yellow
  else
    say "#{Dir.pwd} does not appear to be a Prometheus application", :red
  end
end