Sha256: 5474fdb7d3472b2e4ac44b1f8829a4663190f3eeb91a047772256716ade0de94

Contents?: true

Size: 1.74 KB

Versions: 1

Compression:

Stored size: 1.74 KB

Contents

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

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: grid [options] command [grid_id]"
  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 "   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 "   token   - Generate new access token"
  opts.separator "   credits - List available credits"
  opts.separator ""
  opts.separator "Options:"
  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:
                                     http://gridin.it/api/v0 (default)") 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(
  :token      => options[:token],
  :email      => options[:email],
  :password   => options[:password],
  :uri        => options[:uri],
  :args       => ARGV
)
helper.send ARGV[0], ARGV[1]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
grid-0.4.3 bin/grid