Sha256: 8351855b6101bacdb5158b013e45bca84633522c3e84a4df679ec38c453b615a

Contents?: true

Size: 1.54 KB

Versions: 6

Compression:

Stored size: 1.54 KB

Contents

#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "poolparty"
require "poolpartycl"

# name = ARGV.select {|arg| arg if Binary.available_binaries_for("cloud").include?(arg) }.first
name = ARGV.shift if Binary.available_binaries_for("cloud").include?(ARGV.first)
# If the options include -h and they don't include a valid command, then we can just pass the 
# original options back, but if they do contain a binary, we don't want -h getting through to 
# these options, so we'll strip it if it's included
DUP_ARG = ARGV.dup
new_args = DUP_ARG.map {|arg| DUP_ARG.delete(arg) unless help_array.include?(arg) || Binary.available_binaries_for("cloud").include?(arg) }
new_args = new_args.reject {|arg| Binary.available_binaries_for("cloud").include?(arg) }.empty? ? ARGV : (name ? (help_array.each {|arg| DUP_ARG.delete(arg)}; DUP_ARG) : DUP_ARG)

# Let's make sure if no command is passed in that we show the help message
new_args.push("-h") unless name

o = PoolParty::Optioner.new(new_args, {:extra_help => "\nCloud actions\n#{Binary.list_binaries_for("cloud")}\n\n", :abstract => true}) do |opts, optioner|  
  opts.on('-n cloudname', '--name name', 'Address this cloud')    { |c| optioner.cloudname c }
end

program_name = "#{File.basename($0)}-#{name}"
program_location = File.join(Binary.binary_directory, program_name)

command_line = "#{program_location}"

# Run it from the command-line first
if Binary.available_binaries_for("cloud").include?(name)
  system command_line, *new_args
else
  puts "Unknown poolparty binary: #{name}"
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
auser-poolparty-1.1.1 bin/cloud
auser-poolparty-1.1.3 bin/cloud
auser-poolparty-1.1.4 bin/cloud
auser-poolparty-1.1.5 bin/cloud
fairchild-poolparty-1.1.3 bin/cloud
fairchild-poolparty-1.1.4 bin/cloud