Sha256: b06d11a3f62e1496ac5fbdd75a3689e65f9a8634b7a3200a3e56dac1bc036744
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 KB
Contents
class Nachos module Github LGHCONF = "http://github.com/guides/local-github-config" GIT_CONFIG = Hash.new do |cache, cmd| result = %x{git #{cmd}}.chomp cache[cmd] = $?.success? && !result.empty? ? result : nil end attr_reader :client def watched client.watched.sort_by do |repo| [repo["owner"], repo["name"]].join("/") end end # Either returns the GitHub user as set by git-config(1) or aborts # with an error message. def github_user(fatal = true) if user = GIT_CONFIG['config github.user'] user elsif fatal abort("** No GitHub user set. See #{LGHCONF}") end end def github_token(fatal = true) if token = GIT_CONFIG['config github.token'] token elsif fatal abort("** No GitHub token set. See #{LGHCONF}") end end def github_summary "You have #{watched.size} watched repos, and #{client.list_repos.size} owned repos." end def client @client ||= Octopussy::Client.new(:login => github_user, :token => github_token) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
nachos-0.0.6 | lib/nachos/github.rb |
nachos-0.0.5 | lib/nachos/github.rb |
nachos-0.0.4 | lib/nachos/github.rb |
nachos-0.0.3 | lib/nachos/github.rb |
nachos-0.0.2 | lib/nachos/github.rb |