Base
(Not documented)
# File lib/mcollective/generators/agent_generator.rb, line 7 7: def initialize(plugin_name, actions = [], name = nil, description = nil, author = nil , 8: license = nil, version = nil, url = nil, timeout = nil) 9: 10: super(name, description, author, license, version, url, timeout) 11: @plugin_name = plugin_name 12: @actions = actions || [] 13: @ddl = create_ddl 14: @mod_name = "Agent" 15: @pclass = "RPC::Agent" 16: @content = create_plugin_content 17: @plugin = create_plugin_string 18: write_plugins 19: end
(Not documented)
# File lib/mcollective/generators/agent_generator.rb, line 45 45: def action_help 46: action_snippet = File.read(File.join(File.dirname(__FILE__), "templates", "action_snippet.erb")) 47: ERB.new(action_snippet).result 48: end
(Not documented)
# File lib/mcollective/generators/agent_generator.rb, line 21 21: def create_ddl 22: action_text = "" 23: @actions.each_with_index do |action, i| 24: action_text += "action \"#{action}\", :description => \"%ACTIONDESCRIPTION%\" do\n" 25: action_text += action_help if i == 0 26: action_text += "end\n" 27: action_text += "\n" unless @actions.size == (i + 1) 28: end 29: # Use inherited method to create metadata part of the ddl 30: create_metadata_string + action_text 31: end
(Not documented)
# File lib/mcollective/generators/agent_generator.rb, line 33 33: def create_plugin_content 34: content_text = "" 35: 36: # Add actions to agent file 37: @actions.each_with_index do |action, i| 38: content_text += "%6s%s" % [" ", "action \"#{action}\" do\n"] 39: content_text += "%6s%s" % [" ", "end\n"] 40: content_text += "\n" unless @actions.size == (i + 1) 41: end 42: content_text 43: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.