X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=doc%2Fclasses%2FMCollective%2FGenerators%2FBase.html;fp=doc%2Fclasses%2FMCollective%2FGenerators%2FBase.html;h=de6cecd93abdf1cc8b2ab70fa3649e1cc4f5a6a1;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=0000000000000000000000000000000000000000;hpb=8a3fe7daeecccf43dd71c59371c5005400d35101;p=packages%2Fprecise%2Fmcollective.git diff --git a/doc/classes/MCollective/Generators/Base.html b/doc/classes/MCollective/Generators/Base.html new file mode 100644 index 0000000..de6cecd --- /dev/null +++ b/doc/classes/MCollective/Generators/Base.html @@ -0,0 +1,267 @@ + + + + + + Class: MCollective::Generators::Base + + + + + + + + + + +
+ + + + + + + + + + + + + + +
ClassMCollective::Generators::Base
In: + + lib/mcollective/generators/base.rb + +
+
Parent: + Object +
+
+ + +
+ + + +
+ + + +
+ +
+

Methods

+ + +
+ +
+ + + + +
+ + + + + +
+

Attributes

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

Public Class methods

+ +
+ + + + +
+

[Source]

+
+
+    # File lib/mcollective/generators/base.rb, line 5
+ 5:       def initialize(name, description, author, license, version, url, timeout)
+ 6:         @meta = {:name => name,
+ 7:                  :description => description,
+ 8:                  :author => author,
+ 9:                  :license => license,
+10:                  :version => version,
+11:                  :url => url,
+12:                  :timeout => timeout}
+13:       end
+
+
+
+
+ +

Public Instance methods

+ +
+ + + + +
+

[Source]

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

[Source]

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

[Source]

+
+
+    # File lib/mcollective/generators/base.rb, line 25
+25:       def write_plugins
+26:         begin
+27:           Dir.mkdir @plugin_name
+28:           dirname = File.join(@plugin_name, @mod_name.downcase)
+29:           Dir.mkdir dirname
+30:           puts "Created plugin directory : #{@plugin_name}"
+31: 
+32:           File.open(File.join(dirname, "#{@plugin_name}.ddl"), "w"){|f| f.puts @ddl}
+33:           puts "Created DDL file : #{File.join(dirname, "#{@plugin_name}.ddl")}"
+34: 
+35:           File.open(File.join(dirname, "#{@plugin_name}.rb"), "w"){|f| f.puts @plugin}
+36:           puts "Created #{@mod_name} file : #{File.join(dirname, "#{@plugin_name}.rb")}"
+37:         rescue Errno::EEXIST
+38:           raise "cannot generate '#{@plugin_name}' : plugin directory already exists."
+39:         rescue Exception => e
+40:           FileUtils.rm_rf(@plugin_name) if File.directory?(@plugin_name)
+41:           raise "cannot generate plugin - #{e}"
+42:         end
+43:       end
+
+
+
+
+ + +
+ + +
+ + +
+

[Validate]

+
+ + + \ No newline at end of file