Sha256: caf5bd423e971949f73495b1a802eb1eaf594bd6acd1e27f9425b9d8ee6c4dc5

Contents?: true

Size: 851 Bytes

Versions: 14

Compression:

Stored size: 851 Bytes

Contents

# frozen_string_literal: true

module Getv
  class Package
    # Getv::Package::GitHub class
    class GitHub < Package
      def initialize(name, opts = {})
        super name, opts
      end

      private

      def github_defaults(name)
        case name.count('/')
        when 1
          { owner: name.split('/')[0], repo: name.split('/')[1], token: nil }
        else
          { owner: name, repo: name, token: nil }
        end
      end

      def github # rubocop:disable Metrics/MethodLength
        require 'octokit'
        if opts[:token]
          github = Octokit::Client.new(access_token: opts[:token])
          user = github.user
          user.login
        else
          github = Octokit::Client.new
        end
        github.auto_paginate = true
        github.proxy = opts[:proxy]
        github
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
getv-rs-2.3.5 lib/getv/package/github.rb
getv-rs-2.3.4 lib/getv/package/github.rb
getv-rs-2.3.3 lib/getv/package/github.rb
getv-rs-2.3.2 lib/getv/package/github.rb
getv-rs-2.3.1 lib/getv/package/github.rb
getv-rs-2.3.0 lib/getv/package/github.rb
getv-2.2.2 lib/getv/package/github.rb
getv-2.2.0 lib/getv/package/github.rb
getv-2.1.4 lib/getv/package/github.rb
getv-2.1.3 lib/getv/package/github.rb
getv-2.1.2 lib/getv/package/github.rb
getv-2.1.1 lib/getv/package/github.rb
getv-2.1.0 lib/getv/package/github.rb
getv-2.0.0 lib/getv/package/github.rb