Sha256: b15c20aa77826a7a6e5ffe6e57d85c795d35837e2db512a827021e2aaaf6ed37

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 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 token (https://github.com/settings/tokens)")
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cp8_cli-9.0.0 lib/cp8_cli/global_config.rb