Sha256: 4e930c2dcd2fbe0ef8438c3a6738e32926ef2d23384ebf078a5d69562fa56b36

Contents?: true

Size: 552 Bytes

Versions: 5

Compression:

Stored size: 552 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")
      end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cp8_cli-8.2.1 lib/cp8_cli/global_config.rb
cp8_cli-8.2.0 lib/cp8_cli/global_config.rb
cp8_cli-8.1.0 lib/cp8_cli/global_config.rb
cp8_cli-8.0.1 lib/cp8_cli/global_config.rb
cp8_cli-8.0.0 lib/cp8_cli/global_config.rb