Sha256: 724b5699fb4d4cf2f0cfaede663cc31a3c1242fa46bb2e5b497d5230df083fae

Contents?: true

Size: 832 Bytes

Versions: 6

Compression:

Stored size: 832 Bytes

Contents

# encoding: utf-8

module FIR
  module Config
    CONFIG_PATH   = "#{ENV['HOME']}/.fir-cli"
    API_YML_PATH  = File.expand_path("../../", __FILE__) + '/api.yml'
    APP_FILE_TYPE = %w(.ipa .apk).freeze

    def fir_api
      @fir_api ||= YAML.load_file(API_YML_PATH).deep_symbolize_keys[:fir]
    end

    def bughd_api
      @bughd_api ||= YAML.load_file(API_YML_PATH).deep_symbolize_keys[:bughd]
    end

    def config
      @config ||= YAML.load_file(CONFIG_PATH).deep_symbolize_keys if File.exist?(CONFIG_PATH)
    end

    def reload_config
      @config = YAML.load_file(CONFIG_PATH).deep_symbolize_keys
    end

    def write_config hash
      File.open(CONFIG_PATH, 'w+') { |f| f << YAML.dump(hash) }
    end

    def current_token
      @token ||= config[:token] if config
    end

    alias_method :☠, :exit
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fir-cli-1.2.2 lib/fir/util/config.rb
fir-cli-1.2.1 lib/fir/util/config.rb
fir-cli-1.2.0 lib/fir/util/config.rb
fir-cli-1.1.9 lib/fir/util/config.rb
fir-cli-1.1.8 lib/fir/util/config.rb
fir-cli-1.1.7 lib/fir/util/config.rb