Module: AWS::Flow::Utils

Defined in:
lib/aws/utils.rb

Defined Under Namespace

Classes: FlowUtils, InitConfig

Class Method Summary collapse

Class Method Details

.mainObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Invoked from the shell.



260
261
262
# File 'lib/aws/utils.rb', line 260

def self.main
  FlowUtils.utils.each { |x| x.generate(parse_command_line) }
end

.parse_command_line(argv = ARGV) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Interprets the command-line paramters pased in from the shell.



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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/aws/utils.rb', line 12

def self.parse_command_line(argv = ARGV)
  options = {}
  optparse = OptionParser.new do |opts|
    opts.banner = "Usage: aws-flow-utils -c <command> [options]"

    opts.separator ""
    options[:deploy] = {enabled: false}
    opts.on('-c', '--command COMMAND', [:eb,:local], "Specify the command to run. (eb, local)") do |f|
      options[:deploy][:enabled] = true
      options[:deploy][:eb] = true if f == :eb
      options[:deploy][:local] = true if f == :local
    end

    opts.separator ""
    opts.separator "Commands"
    opts.separator ""
    opts.separator "\tlocal: Generates an AWS Flow Framework for Ruby "\
      "application skeleton."
    opts.separator "\t   eb: Generates an AWS Flow Framework for Ruby "\
      "application skeleton compatible with AWS Elastic Beanstalk."
    opts.separator ""
    opts.separator "Specific options"
    opts.separator ""

    opts.on('-n', '--name NAME', "Set the name of the application") do |f|
      options[:deploy][:name] = f
    end

    opts.on('-r', '--region [REGION]', "Set the AWS Region. Default "\
            "value is taken from environment variable AWS_REGION if "\
            "it is set.") do |f|
      options[:deploy][:region] = f.downcase
    end

    opts.on('-p', '--path [PATH]', "Set the location where the AWS Flow "\
            "for Ruby application will be created. (Default is '.')") do |f|
      options[:deploy][:path] = f
    end

    opts.on('-a', '--act_path [PATH]', "Set the location where activity "\
            "classes reside.") do |f|
      options[:deploy][:act] = f
    end

    opts.on('-w', '--wf_path [PATH]', "Set the location where workflow "\
            "classes reside.") do |f|
      options[:deploy][:wf] = f
    end

    opts.on('-A', "--activities x,y,z", Array, "Set the names of Activity "\
            "classes") do |f|
      options[:deploy][:activities] = f
    end

    opts.on('-W', "--workflows x,y,z", Array, "Set the names of Workflow "\
            "classes") do |f|
      options[:deploy][:workflows] = f
    end

  end

  optparse.parse!(argv)

  return options
end