Sha256: afbb17c69133fbc40b77568dfe23067e3cdcd6bf9b106699e62fd4936ff34209

Contents?: true

Size: 817 Bytes

Versions: 5

Compression:

Stored size: 817 Bytes

Contents

#!/usr/bin/env ruby

require File.join(File.dirname(__FILE__), '../lib/smartcloud')
require 'pp'

if !ENV['SMARTCLOUD_USERNAME'] || !ENV['SMARTCLOUD_PASSWORD']
  puts "Please set environment variables SMARTCLOUD_PASSWORD and SMARTCLOUD_USERNAME in your environment."
  exit(1)
end

if ARGV.size == 1
  @cmd=ARGV[0]
elsif ARGV.size == 2
  @cmd="#{ARGV[0]}('#{ARGV[1]}')"
else
  puts %{
  Usage: 
  smartcloud help
  smartcloud help [command]
  smartcloud [command]
}
  exit(0)
end

  # allows us to send arbitrary commands like
  # smartcloud username password describe_instance("122345")
  result = eval("@smartcloud.#{@cmd}")

  if result == true || result.nil?
    # do nothing, the command already logged
  else
    if result.is_a?(String)
      puts result
    else
      puts result.pretty_inspect
    end
  end

Version data entries

5 entries across 3 versions & 1 rubygems

Version Path
cft_smartcloud-0.1.8 bin/cft_smartcloud
cft_smartcloud-0.1.8 bin/smartcloud
cft_smartcloud-0.1.5 bin/cft_smartcloud
cft_smartcloud-0.1.5 bin/smartcloud
cft_smartcloud-0.1.4 bin/smartcloud