Sha256: 630bf2560a69d17640334e9af2b4d58dd40c78d3816c1a3772fcf336fb609b40

Contents?: true

Size: 499 Bytes

Versions: 1

Compression:

Stored size: 499 Bytes

Contents

require 'time'
require 'erb'
require 'pathname'

class Nymphia::DSL
  def initialize(dsl_code, path)
    @dsl_code = dsl_code
    @path = path
  end

  def compile
    @result = Nymphia::DSL::Context.eval(@dsl_code, @path).result
  end

  def render(output)
    ssh_config = ERB.new(File.read(find_template('ssh_config_template.erb')), nil, '-').result(binding)
    output.write(ssh_config)
  end

  private

  def find_template(filename)
    Pathname.new(__FILE__).dirname.join(filename)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nymphia-0.2.1 lib/nymphia/dsl.rb