Sha256: 2d80d1ee9664efb5500be2dcdb8d72a1e7eac4bddad4c91572ff4385a1c019f7

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

$LOAD_PATH << File.expand_path('../../lib', __FILE__)
require 'larrow/qingcloud'
require 'pry'
require 'pry-nav'
require 'simplecov'
require 'yaml'
SimpleCov.start

module Helpers
  extend self
  include Larrow

  def load_by_default
    args = read_content_as_hash
    [args['qy_access_key_id'],
     args['qy_secret_access_key'], 
     args['zone_id']]
  end

  def read_content_as_hash
    file = "#{ENV['HOME']}/.larrow"
    fail "cannot find keyfile: #{file}" unless File.exist?(file)
    YAML.load(File.read file)['qingcloud']
  end
  
  def establish_connection
    access, secret, zone_id = load_by_default
    Qingcloud.establish_connection access, secret, zone_id
  end
end

Helpers.establish_connection

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
larrow-qingcloud-0.0.1 spec/spec_helper.rb