Sha256: f8896c3e8137b4f59c9e69cbda017a331b87522a423f99097faf380cfff363b0

Contents?: true

Size: 991 Bytes

Versions: 3

Compression:

Stored size: 991 Bytes

Contents

#!/usr/bin/env ruby

GIT_ROOT    = File.expand_path('../..', __FILE__)
CONFIG_FILE = "#{GIT_ROOT}/config/login.yml"

require 'yaml'

require 'bundler/setup'

# TODO convert from jeweler to bundler workflow and use `gemspec` directive in Gemfile
$: << "#{GIT_ROOT}/lib"
require 'right_api_client'

begin
  puts "Using configuration file #{CONFIG_FILE}"
  if File.readable? CONFIG_FILE
    @client = RightApi::Client.new(YAML.load_file(CONFIG_FILE))
    STDERR.puts "Logged in to Rightscale CM API."
  else
    STDERR.puts "Configuration file is unreadable or nonexistent!"
    STDERR.puts "Please copy login.yml.example and add your RightScale API credentials."
    exit 1
  end
end

puts
puts "Opening pry or irb session; call API methods on self"
puts "Example: self.deployments.index"
puts

begin
  require 'pry'
  Pry.start(@client)
rescue LoadError
  require 'irb'
  IRB.setup nil
  IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context
  require 'irb/ext/multi-irb'
  IRB.irb nil, @client
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
right_api_client-1.6.4 bin/console
right_api_client-1.6.3 bin/console
right_api_client-1.6.2 bin/console