Sha256: b0553493a0db256bf9b9aa2c5f38965eba7e93785c55bf8841c9b8135fc202ed

Contents?: true

Size: 1.42 KB

Versions: 8

Compression:

Stored size: 1.42 KB

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rivet'

DEBUG = Logger::DEBUG
WARN  = Logger::WARN
FATAL = Logger::FATAL
INFO  = Logger::INFO

client_type = ARGV[0]

unless ["ec2","autoscale","-h"].include? client_type
  Rivet::Utils.die "You must select either 'ec2' or 'autoscale' your first argument"
end

# Default option values
options             = OpenStruct.new
options.log_level   = INFO
options.profile     = 'default'
options.config_path = File.join('.', client_type)

OptionParser.new do |o|
  o.on('-l', '--log-level [LEVEL]', String, 'specify the log level (default is INFO)') do |l|
    options.log_level = Kernel.const_get l.upcase
  end

  o.on('-p', '--profile [PROFILE_NAME]', 'Selects the AWS profile to use (default is "default")') do |p|
    options.profile = p
  end

  o.on('-s', '--sync', 'Sync the changes remotely to AWS') do |s|
    options.sync = s
  end

  o.on('-c', '--config-path [PATH]', 'The configuration path to use (default is ./autoscale or ./ec2)') do |c|
    options.config_path = c
  end

  o.on('-n', '--name [NAME]', String, 'Server or Autoscaling group name') do |n|
    options.name = n
  end

  o.on('-h') { Rivet::Log.info o; exit 0 }

  begin
    o.parse!
  rescue OptionParser::InvalidOption, OptionParser::MissingArgument
    Rivet::Log.fatal $!.to_s
    Rivet::Log.fatal o
    exit 255
  end
end

Rivet::Client.new.run(client_type,options)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rivet-3.2.0 bin/rivet
rivet-3.1.0 bin/rivet
rivet-3.0.5 bin/rivet
rivet-3.0.4 bin/rivet
rivet-3.0.3 bin/rivet
rivet-3.0.2 bin/rivet
rivet-3.0.1 bin/rivet
rivet-3.0.0 bin/rivet