Sha256: 2a9d72cc5ec47c5f1f953b70aba92cb9b4db333f4b7fb3e79c5f9cdcc8e62326

Contents?: true

Size: 1.12 KB

Versions: 22

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require "octokit"

require_relative "../base"
require_relative "../../exception_handler"
require_relative "auth"
require_relative "../../utils"

module Neetob
  class CLI
    module Github
      class Base < CLI::Base
        include Utils
        attr_accessor :client

        def initialize
          super()
          auth_client = Auth.new(**read_and_parse_auth_params_from_env)
          unless auth_client.token_persisted?
            auth_client.start_oauth2_device_flow
          end
          @client = Octokit::Client.new(access_token: auth_client.access_token)
        end

        def check_for_apps_and_all_neeto_repos_option(apps, all_neeto_repos)
          if (apps.nil? && !all_neeto_repos) || (!apps.nil? && all_neeto_repos)
            ui.error("Please provide either \"apps\" or \"all-neeto-repos\" option.")
            exit
          end
        end

        private

          def read_and_parse_auth_params_from_env
            hash_with_keys_of_string_type = JSON.parse(ENV["AUTH_PARAMS"])
            symbolize_keys(hash_with_keys_of_string_type)
          end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
neetob-ud-1.0.59 lib/neetob/cli/github/base.rb
neetob-ud-0.2.8 lib/neetob/cli/github/base.rb
neetob-ud-0.2.6 lib/neetob/cli/github/base.rb
neetob-ud-0.2.4 lib/neetob/cli/github/base.rb
neetob-ud-0.2.3 lib/neetob/cli/github/base.rb
neetob-ud-0.2.2 lib/neetob/cli/github/base.rb
neetob-ud-0.2.1 lib/neetob/cli/github/base.rb
neetob-ud-0.2.0 lib/neetob/cli/github/base.rb
neetob-ud-0.1.3 lib/neetob/cli/github/base.rb
neetob-ud-0.1.2 lib/neetob/cli/github/base.rb
neetob-ud-0.1.1 lib/neetob/cli/github/base.rb
neetob-ud-0.1.0 lib/neetob/cli/github/base.rb
neetob-0.2.2 lib/neetob/cli/github/base.rb
neetob-0.2.1 lib/neetob/cli/github/base.rb
neetob-0.2.0 lib/neetob/cli/github/base.rb
neetob-0.1.5 lib/neetob/cli/github/base.rb
neetob-ud-0.2.14 lib/neetob/cli/github/base.rb
neetob-ud-0.2.13 lib/neetob/cli/github/base.rb
neetob-0.1.4 lib/neetob/cli/github/base.rb
neetob-ud-0.2.11 lib/neetob/cli/github/base.rb