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

Methods

+ +
+ create_ddl   + create_plugin_content   + new   +
+
+ +
+ + + + +
+ + + + + +
+

Attributes

+ +
+ + + + + + + + + + + +
content [RW] 
ddl [RW] 
+
+
+ + + + +
+

Public Class methods

+ +
+ + + + +
+

[Source]

+
+
+    # File lib/mcollective/generators/data_generator.rb, line 7
+ 7:       def initialize(plugin_name, outputs = [],  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:         @mod_name = "Data"
+12:         @pclass = "Base"
+13:         @plugin_name = plugin_name
+14:         @outputs = outputs
+15:         @ddl = create_ddl
+16:         @content = create_plugin_content
+17:         @plugin = create_plugin_string
+18:         write_plugins
+19:       end
+
+
+
+
+ +

Public Instance methods

+ +
+ + + + +
+

[Source]

+
+
+    # File lib/mcollective/generators/data_generator.rb, line 21
+21:       def create_ddl
+22:         query_text = "dataquery :description => \"Query information\" do\n"
+23:         query_text += ERB.new(File.read(File.join(File.dirname(__FILE__), "templates", "data_input_snippet.erb"))).result
+24: 
+25:         @outputs.each_with_index do |output,i|
+26:           query_text += "%2s%s" % [" ", "output :#{output},\n"]
+27:           query_text += "%9s%s" % [" ", ":description => \"%DESCRIPTION%\",\n"]
+28:           query_text += "%9s%s" % [" ", ":display_as => \"%DESCRIPTION%\"\n"]
+29:           query_text += "\n" unless @outputs.size == (i + 1)
+30:         end
+31: 
+32:         query_text += "end"
+33: 
+34:         # Use inherited method to create metadata part of the ddl
+35:         create_metadata_string + query_text
+36:       end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+    # File lib/mcollective/generators/data_generator.rb, line 38
+38:       def create_plugin_content
+39:         content_text = "%6s%s" % [" ", "query do |what|\n"]
+40: 
+41:         @outputs.each do |output|
+42:            content_text += "%8s%s" % [" ", "result[:#{output}] = nil\n"]
+43:         end
+44:         content_text += "%6s%s" % [" ", "end\n"]
+45: 
+46:         # Add actions to agent file
+47:         content_text
+48:       end
+
+
+
+
+ + +
+ + +
+ + +
+

[Validate]

+
+ + + \ No newline at end of file