Module: Aws::Cfn::Compiler::Options

Included in:
Base
Defined in:
lib/aws/cfn/compiler/mixins/options.rb

Instance Method Summary collapse

Instance Method Details

#parse_optionsObject

TODO: [2014-06-29 Christo] Hook into super class and add on options instead of starting from scratch every time



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/aws/cfn/compiler/mixins/options.rb', line 7

def parse_options

  setup_options

  @opts.on :F, :format=,        'The output format of the components. [JSON|YAML|Ruby]', { as: String, match: @format_regex, default: 'yaml' }
  @opts.on :s, :specification=, 'The specification to use when selecting components. A JSON or YAML file', { as: String
  }
  @opts.on :f, :formatversion=, 'The AWS Template format version. ', {as: String,
                                                                      default: '2010-09-09'
  }
  @opts.on :D, :description=,    'The AWS Template description. Default: template name', { as: String }
  @opts.on :p, :parametersfile=, 'The parameters file for the template', { as: String }
  @opts.on :i, :stackinifile=,   'The INI file for the stack builder == build.py', { as: String }
  @opts.on :P, :precedence=,     'The precedence of template component types. Default: rb,ruby,yaml,yml,json,js', { as: String,
                                                                                                                default: 'rb,ruby,yaml,yml,json,js', }

  @opts.parse!

  if ARGV.size > 0
    puts @opts
    puts "Extra arguments! #{ARGV}"
    exit 1
  end

  unless @opts[:specification]
    puts @opts
    abort! "Missing required option --specification"
  end

end

#set_config_optionsObject



38
39
40
41
42
43
44
# File 'lib/aws/cfn/compiler/mixins/options.rb', line 38

def set_config_options

  @config[:precedence]    = @opts[:precedence].split(%r',+\s*').reverse

  setup_config

end