class StackAgent::Cli

Public Instance Methods

cli() click to toggle source
# File lib/stack-agent/cli.rb, line 46
def cli
  ARGV.clear
  IRB.start
end
register(app_token = nil, name = nil, uri = nil) click to toggle source
# File lib/stack-agent/cli.rb, line 8
def register(app_token = nil, name = nil, uri = nil)

  StackAgent.configure do |c|
    c.app_token = app_token
    c.name = name
    c.uri = uri
  end

  if id = StackAgent::Instance.new().register
    puts "Registered as stack #{id}"
  end
end
stacks(app_token) click to toggle source
# File lib/stack-agent/cli.rb, line 32
def stacks(app_token)
  StackAgent.configure do |c|
    c.app_token = app_token
  end

  stacks = StackAgent::Instance.stacks

  puts "Stacks"
  stacks.each do |stack|
    puts "#{stack['id'].ljust(30)} #{stack['name'].ljust(30)} #{stack['uri']}"
  end
end
unregister(app_token, instance_token) click to toggle source
# File lib/stack-agent/cli.rb, line 22
def unregister(app_token, instance_token)
  StackAgent.configure do |c|
    c.app_token = app_token
  end

  StackAgent::Instance.new(instance_token).unregister
  puts "Unregistered stack"
end