Sha256: 95fd4ceeb0d9fe16b3279e00d5b89a2715f686d7fc9eb68ab3b237bffc0df545

Contents?: true

Size: 484 Bytes

Versions: 4

Compression:

Stored size: 484 Bytes

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
nymphia-0.2.0 lib/nymphia/dsl.rb
nymphia-0.1.2 lib/nymphia/dsl.rb
nymphia-0.1.1 lib/nymphia/dsl.rb
nymphia-0.1.0 lib/nymphia/dsl.rb