Sha256: 613a82171c55a2ba1aade83c854ab31079e3e5f287138e24d6b3a1d931956f09

Contents?: true

Size: 651 Bytes

Versions: 3

Compression:

Stored size: 651 Bytes

Contents

require "cp8_cli/config_store"

module Cp8Cli
  class GlobalConfig
    PATH = ENV["HOME"] + "/.trello_flow"

    def initialize(store = nil)
      @store = store || ConfigStore.new(PATH)
    end

    def github_token
      @_github_token ||= store[:github_token] || env_github_token || configure_github_token
    end

    private

      attr_reader :store

      def env_github_token
        ENV["OCTOKIT_ACCESS_TOKEN"]
      end

      def configure_github_token
        store.save(
          :github_token,
          Command.ask("Input GitHub access token with repo access scope (https://github.com/settings/tokens):")
        )
      end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cp8_cli-9.0.3 lib/cp8_cli/global_config.rb
cp8_cli-9.0.2 lib/cp8_cli/global_config.rb
cp8_cli-9.0.1 lib/cp8_cli/global_config.rb