Module: Ec2ssh::Dsl::Parser
- Defined in:
- lib/ec2ssh/dsl.rb
Class Method Summary collapse
Class Method Details
.parse(dsl_str) ⇒ Object
61 62 63 64 65 66 67 |
# 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) ⇒ Object
69 70 71 72 |
# 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) ⇒ Object
74 75 76 77 78 |
# 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 |