module Ec2ssh::Dsl::Parser

Public Class Methods

parse(dsl_str) click to toggle source
# File lib/ec2ssh/dsl.rb, line 61
def self.parse(dsl_str)
  dsl = Dsl.new
  dsl.instance_eval dsl_str
  dsl._result.tap {|result| validate result }
rescue SyntaxError => e
  raise DotfileSyntaxError, e.to_s
end
parse_file(path) click to toggle source
# File lib/ec2ssh/dsl.rb, line 69
def self.parse_file(path)
  raise DotfileNotFound, path.to_s unless File.exist?(path)
  parse File.read(path)
end
validate(result) click to toggle source
# File lib/ec2ssh/dsl.rb, line 74
def self.validate(result)
  if result.aws_keys && result.profiles
    raise DotfileValidationError, "`aws_keys` and `profiles` doesn't work together in dotfile."
  end
end