module AWS::Flow::Utils

Public Class Methods

main() click to toggle source

Invoked from the shell.

@api private

# 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) click to toggle source

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

@api private

# 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