class Lariat::Github

Public Class Methods

new(config_file) click to toggle source
# File lib/lariat/github.rb, line 9
def initialize(config_file)
  @config = load_config(config_file)
  initialize_git_client
  @gh = ::Github.new
end

Public Instance Methods

handle() click to toggle source
# File lib/lariat/github.rb, line 15
def handle
  @gh
end
initialize_git_client() click to toggle source
# File lib/lariat/github.rb, line 19
def initialize_git_client
  unless @config['token']
    puts "You must have a Github API Token.  Create one, and add it to the local 'config/github.yml' and try again."
    exit
  end

  ::Github.configure do |c|
    c.oauth_token = @config['token']
    c.site = @config['site']
    c.endpoint = @config['endpoint']
  end
end
load_config(config_file) click to toggle source
# File lib/lariat/github.rb, line 32
def load_config(config_file)
  ::Lariat.load_environment_config_from_yaml(config_file)
rescue
  puts "You must have a Github API Token.  Create one, and add it to the local 'config/github.yml' and try again."
  exit
end