Class: Aws::Cfn::Dsl::Main

Inherits:
Base
  • Object
show all
Defined in:
lib/aws/cfn/dsl/main.rb

Instance Attribute Summary

Attributes inherited from Base

#items, #output

Instance Method Summary collapse

Methods inherited from Base

#initialize, #load_template, #save_dsl

Constructor Details

This class inherits a constructor from Aws::Cfn::Dsl::Base

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/aws/cfn/dsl/main.rb', line 9

def run

  @opts = Slop.parse(help: true) do
    on :j, :template=,      'The template to convert', as: String, argument: true
    on :o, :output=,        'The directory to output the DSL to.', as: String, argument: true
    on :O, :overwrite,      'Overwrite existing generated source files. (HINT: Think twice ...)', { as: String, optional_argument: true, default: 'off', match: %r/0|1|yes|no|on|off|enable|disable|set|unset|true|false|raw/i }
  end

  @config[:overwrite] = if @opts[:overwrite].downcase.match %r'^(1|true|on|yes|enable|set)$'
                          true
                        else
                          false
                        end

  unless @opts[:template]
    abort! @opts
  end

  load_template(@opts[:template])

  save_dsl(@opts[:output])

end