### Home Classes Methods

### In Files

- lib/mcollective/generators/base.rb

### Parent

Object

### Methods

- ::new
- #create_metadata_string
- #create_plugin_string
- #write_plugins

### 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::Base

### Attributes

meta[RW]
mod_name[RW]
plugin_name[RW]

### Public Instance Methods

create_metadata_string() click to toggle source

    # File lib/mcollective/generators/base.rb, line 15
    def create_metadata_string
      ddl_template = File.read(File.join(File.dirname(__FILE__), "templates", "ddl.erb"))
      ERB.new(ddl_template, nil, "-").result(binding)
    end

create_plugin_string() click to toggle source

    # File lib/mcollective/generators/base.rb, line 20
    def create_plugin_string
      plugin_template = File.read(File.join(File.dirname(__FILE__), "templates", "plugin.erb"))
      ERB.new(plugin_template, nil, "-").result(binding)
    end

write_plugins() click to toggle source

    # File lib/mcollective/generators/base.rb, line 25
    def write_plugins
      begin
        Dir.mkdir @plugin_name
        dirname = File.join(@plugin_name, @mod_name.downcase)
        Dir.mkdir dirname
        puts "Created plugin directory : #{@plugin_name}"

        File.open(File.join(dirname, "#{@plugin_name}.ddl"), "w"){|f| f.puts @ddl}
        puts "Created DDL file : #{File.join(dirname, "#{@plugin_name}.ddl")}"

        File.open(File.join(dirname, "#{@plugin_name}.rb"), "w"){|f| f.puts @plugin}
        puts "Created #{@mod_name} file : #{File.join(dirname, "#{@plugin_name}.rb")}"
      rescue Errno::EEXIST
        raise "cannot generate '#{@plugin_name}' : plugin directory already exists."
      rescue Exception => e
        FileUtils.rm_rf(@plugin_name) if File.directory?(@plugin_name)
        raise "cannot generate plugin - #{e}"
      end
    end

### Public Class Methods

new(name, description, author, license, version, url, timeout) click to toggle source

    # File lib/mcollective/generators/base.rb, line 5
    def initialize(name, description, author, license, version, url, timeout)
      @meta = {:name => name,
               :description => description,
               :author => author,
               :license => license,
               :version => version,
               :url => url,
               :timeout => timeout}
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.