Class: Chemtrail::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/chemtrail/cli.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cloud_formation=(value) ⇒ Object

Sets the attribute cloud_formation

Parameters:

  • value

    the value to set the attribute cloud_formation to.



7
8
9
# File 'lib/chemtrail/cli.rb', line 7

def cloud_formation=(value)
  @cloud_formation = value
end

Instance Method Details

#build(template_name) ⇒ Object



20
21
22
23
# File 'lib/chemtrail/cli.rb', line 20

def build(template_name)
  template_json = extract_template_json(template_name, options[:path])
  Kernel.puts(template_json)
end

#listObject



13
14
15
16
# File 'lib/chemtrail/cli.rb', line 13

def list
  require_templates_from(options[:path])
  Chemtrail::Template.subclass_map.keys.each { |k| Kernel.puts(k) }
end

#validate(template_name) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/chemtrail/cli.rb', line 27

def validate(template_name)
  template_json = extract_template_json(template_name, options[:path])
  cloud_formation.validate_template(template_body: template_json)
  Kernel.puts("Template #{template_name} is valid")
rescue Aws::CloudFormation::Errors::ValidationError => e
  raise Thor::Error.new(e)
end