Sha256: fd530568e65acb910c342ff7e6299a19295ef25c8cf4945b80848279153ae1e8
Contents?: true
Size: 899 Bytes
Versions: 1
Compression:
Stored size: 899 Bytes
Contents
require 'octokit' require 'octokit/repository' require 'json' module Gerd class GHClient def self.create(explicit_token) Octokit.auto_paginate = true token = explicit_token token = ENV['GERD_TOKEN'] unless token token = from_local unless token token = from_global unless token client = token ? Octokit::Client.new(:access_token => token) : client = Octokit::Client.new client end def self.from_local() file = File.join(Dir.pwd, ".gerd") return unless File.exist?(file) local_file = File.read(file) grim_conf = JSON.parse(local_file) grim_conf['token'] end def self.from_global() file = File.join(ENV['HOME'], ".gerd") return unless File.exist?(file) global_file = File.read(file) grim_conf = JSON.parse(global_file) grim_conf['token'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gerd-0.0.1 | lib/gerd/github_client.rb |