Sha256: 32f3e03a2214d9fcf9c5f14f12fe2417187e71c77185699a423ebb564fe71162

Contents?: true

Size: 1.77 KB

Versions: 3

Compression:

Stored size: 1.77 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'grid'
require 'optparse'

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: grid [options] command"
  opts.separator ""
  opts.separator "Commands:"
  opts.separator "   list - List all grids"
  opts.separator "   show - Show specified grids"
  opts.separator "   create - Create a new grid"
  opts.separator "   add - Add intranode to specified grid ID"
  opts.separator "   delete - Delete intranode from specified grid ID"
  opts.separator "   start - Start specified grid ID"
  opts.separator "   stop - Stop specified grid ID"
  opts.separator "   restart - Restart specified grid ID"
  opts.separator "   status - Update status of specified grid ID"
  opts.separator ""
  opts.separator "Options:"
  opts.on("-g", "--grid ID", String,
  "Specify the Grid ID to use") do |g|
    options[:grid_id] = g || nil
  end
  opts.on("-t", "--token TOKEN", String,
  "Specify the token to authenticate with") do |t|
    options[:token] = t || nil
  end
  opts.on("-e", "--email EMAIL", String,
  "Specify the email to authenticate with, if not using token") do |e|
    options[:email] = e || nil
  end
  opts.on("-p", "--password PASSWORD", String,
  "Specify the password to authenticate with, if not using token") do |p|
    options[:password] = p || nil
  end
  opts.on("-u", "--uri URI", String,
  "Optional URI of the Gridinit API, default http://gridin.it/api/v0") do |u|
    options[:uri] = u || nil
  end

  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
  end.parse!

helper = Grid::Helper.new(
  :grid_id    => options[:grid_id],
  :token      => options[:token],
  :email      => options[:email],
  :password   => options[:password],
  :uri        => options[:uri],
  :args       => ARGV
)
helper.send(ARGV[0])

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
grid-0.3.1 bin/grid
grid-0.3.0 bin/grid
grid-0.2.0 bin/grid