Sha256: 16ff8cbdcdf479e0af0ca75a78366ddc2dba8f9bf9bd21ad95f5c599840bec13

Contents?: true

Size: 631 Bytes

Versions: 8

Compression:

Stored size: 631 Bytes

Contents

module PT::Flow
  class Repo
    require "github_api"
    CONFIG_PATH = ENV['HUB_CONFIG'] ||  ENV['HOME'] + '/.config/hub'

    def pull_requests
      client.pull_requests.all(user, name)
    end

    def user
      path.split('/').first
    end

    def name
      path.split('/').last
    end

    private

    def path
      @path ||= `git config --get remote.origin.url`.strip.match(/:(\S+\/\S+)\.git/)[1]
    end

    def client
      @client ||= Github.new(oauth_token: oauth_token)
    end

    def oauth_token
      @oauth_token ||= YAML.load(File.read(CONFIG_PATH)).values.flatten.first['oauth_token']
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pt-flow-0.6.3 lib/pt-flow/repo.rb
pt-flow-0.6.2 lib/pt-flow/repo.rb
pt-flow-0.6.1 lib/pt-flow/repo.rb
pt-flow-0.6.0 lib/pt-flow/repo.rb
pt-flow-0.5.3 lib/pt-flow/repo.rb
pt-flow-0.5.2 lib/pt-flow/repo.rb
pt-flow-0.5.1 lib/pt-flow/repo.rb
pt-flow-0.5.0 lib/pt-flow/repo.rb