Class: MCollective::Generators::DataGenerator

### Home Classes Methods

### In Files

- lib/mcollective/generators/data_generator.rb

### Parent

MCollective::Generators::Base

### Methods

- ::new
- #create_ddl
- #create_plugin_content

### Files

- COPYING
- README
- Rakefile
- PLACEHOLDER
- PLACEHOLDER

### Class/Module Index

Quicksearch

- MCollective
- MCollective::Agent
- MCollective::Agents
- MCollective::Aggregate
- MCollective::Aggregate::Base
- MCollective::Aggregate::Result
- MCollective::Aggregate::Result::Base
- MCollective::Aggregate::Result::CollectionResult
- MCollective::Aggregate::Result::NumericResult
- MCollective::Application
- MCollective::Applications
- MCollective::Client
- MCollective::Config
- MCollective::Connector
- MCollective::Connector::Base
- MCollective::DDL
- MCollective::DDLValidationError
- MCollective::Data
- MCollective::Data::Base
- MCollective::Data::Result
- MCollective::Discovery
- MCollective::Facts
- MCollective::Facts::Base
- MCollective::Generators
- MCollective::Generators::AgentGenerator
- MCollective::Generators::Base
- MCollective::Generators::DataGenerator
- MCollective::InvalidRPCData
- MCollective::Log
- MCollective::Logger
- MCollective::Logger::Base
- MCollective::Logger::Console_logger
- MCollective::Logger::File_logger
- MCollective::Logger::Syslog_logger
- MCollective::Matcher
- MCollective::Matcher::Parser
- MCollective::Matcher::Scanner
- MCollective::Message
- MCollective::MissingRPCData
- MCollective::MsgDoesNotMatchRequestID
- MCollective::MsgTTLExpired
- MCollective::NotTargettedAtUs
- MCollective::Optionparser
- MCollective::PluginManager
- MCollective::PluginPackager
- MCollective::PluginPackager::AgentDefinition
- MCollective::PluginPackager::StandardDefinition
- MCollective::RPC
- MCollective::RPC::ActionRunner
- MCollective::RPC::Agent
- MCollective::RPC::Audit
- MCollective::RPC::Client
- MCollective::RPC::Helpers
- MCollective::RPC::Progress
- MCollective::RPC::Reply
- MCollective::RPC::Request
- MCollective::RPC::Result
- MCollective::RPC::Stats
- MCollective::RPCAborted
- MCollective::RPCError
- MCollective::Registration
- MCollective::Registration::Base
- MCollective::Runner
- MCollective::RunnerStats
- MCollective::SSL
- MCollective::Security
- MCollective::Security::Base
- MCollective::SecurityValidationFailed
- MCollective::Shell
- MCollective::UnixDaemon
- MCollective::UnknownRPCAction
- MCollective::UnknownRPCError
- MCollective::Util
- MCollective::WindowsDaemon
- Array
- Dir
- Object
- String
- Symbol

No matching classes.

# MCollective::Generators::DataGenerator

### Attributes

content[RW]
ddl[RW]

### Public Instance Methods

create_ddl() click to toggle source

    # File lib/mcollective/generators/data_generator.rb, line 21
    def create_ddl
      query_text = "dataquery :description => \"Query information\" do\n"
      query_text += ERB.new(File.read(File.join(File.dirname(__FILE__), "templates", "data_input_snippet.erb"))).result

      @outputs.each_with_index do |output,i|
        query_text += "%2s%s" % [" ", "output :#{output},\n"]
        query_text += "%9s%s" % [" ", ":description => \"%DESCRIPTION%\",\n"]
        query_text += "%9s%s" % [" ", ":display_as => \"%DESCRIPTION%\"\n"]
        query_text += "\n" unless @outputs.size == (i + 1)
      end

      query_text += "end"

      # Use inherited method to create metadata part of the ddl
      create_metadata_string + query_text
    end

create_plugin_content() click to toggle source

    # File lib/mcollective/generators/data_generator.rb, line 38
    def create_plugin_content
      content_text = "%6s%s" % [" ", "query do |what|\n"]

      @outputs.each do |output|
         content_text += "%8s%s" % [" ", "result[:#{output}] = nil\n"]
      end
      content_text += "%6s%s" % [" ", "end\n"]

      # Add actions to agent file
      content_text
    end

### Public Class Methods

new(plugin_name, outputs = [], name = nil, description = nil, author = nil , license = nil, version = nil, url = nil, timeout = nil) click to toggle source

    # File lib/mcollective/generators/data_generator.rb, line 7
    def initialize(plugin_name, outputs = [],  name = nil, description = nil, author = nil ,
                   license = nil, version = nil, url = nil, timeout = nil)

      super(name, description, author, license, version, url, timeout)
      @mod_name = "Data"
      @pclass = "Base"
      @plugin_name = plugin_name
      @outputs = outputs
      @ddl = create_ddl
      @content = create_plugin_content
      @plugin = create_plugin_string
      write_plugins
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.