class PropertiesGenerator

Generates the propetires.yml to be used in tests

Public Class Methods

new(root_path = nil) click to toggle source
# File lib/serverspec_launcher/generators/properties_generator.rb, line 6
def initialize(root_path = nil)
  path = root_path ? "#{root_path}/" : ''
  @template_path = File.expand_path('../../../../templates', __FILE__)
  @properties_file = "#{path}properties.yml"
  @full_properties_file = "#{path}properties.full.example.yml"
end

Public Instance Methods

full_properties_template() click to toggle source
# File lib/serverspec_launcher/generators/properties_generator.rb, line 17
def full_properties_template
  File.read "#{@template_path}/properties.yaml.erb"
end
generate() click to toggle source
# File lib/serverspec_launcher/generators/properties_generator.rb, line 21
def generate
  renderer = ERB.new properties_template
  File.open(@properties_file, 'w') { |file| file.write renderer.result } unless File.exists? @properties_file
  File.open(@full_properties_file, 'w') { |file| file.write renderer.result } unless File.exists? @full_properties_file
end
properties_template() click to toggle source
# File lib/serverspec_launcher/generators/properties_generator.rb, line 13
def properties_template
  File.read "#{@template_path}/properties-light.yaml.erb"
end