Class: Bosh::PluginGenerator::Generator
- Inherits:
-
Object
- Object
- Bosh::PluginGenerator::Generator
- Defined in:
- lib/bosh/plugin_generator/generator.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #generate(source, target) ⇒ Object
-
#initialize(context, options = {}) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(context, options = {}) ⇒ Generator
Returns a new instance of Generator.
8 9 10 11 |
# File 'lib/bosh/plugin_generator/generator.rb', line 8 def initialize(context, = {}) @options = @context = context end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
7 8 9 |
# File 'lib/bosh/plugin_generator/generator.rb', line 7 def context @context end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/bosh/plugin_generator/generator.rb', line 7 def @options end |
Instance Method Details
#generate(source, target) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/bosh/plugin_generator/generator.rb', line 13 def generate(source, target) folder = File.dirname(target) FileUtils.mkdir_p(folder) template = File.read(File.join(source_folder, source)) result = Erubis::Eruby.new(template).result(context) File.write(target, result) end |