Module: FIR::Config

Included in:
Util::ClassMethods
Defined in:
lib/fir/util/config.rb

Constant Summary collapse

CONFIG_PATH =
"#{ENV['HOME']}/.omt-cli"
APP_INFO_PATH =
"#{ENV['HOME']}/.omt-cli-app"
API_YML_PATH =
File.expand_path('../../', __FILE__) + '/api.yml'
XCODE_WRAPPER_PATH =
File.expand_path('../../', __FILE__) + '/xcode_wrapper.sh'
APP_FILE_TYPE =
%w(.ipa .apk .apks .aab .zip).freeze

Instance Method Summary collapse

Instance Method Details

#bughd_apiObject



15
16
17
# File 'lib/fir/util/config.rb', line 15

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

#configObject



19
20
21
22
# File 'lib/fir/util/config.rb', line 19

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

#current_tokenObject



36
37
38
# File 'lib/fir/util/config.rb', line 36

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

#fir_apiObject



11
12
13
# File 'lib/fir/util/config.rb', line 11

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

#reload_configObject



24
25
26
# File 'lib/fir/util/config.rb', line 24

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

#write_app_info(hash) ⇒ Object



32
33
34
# File 'lib/fir/util/config.rb', line 32

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

#write_config(hash) ⇒ Object



28
29
30
# File 'lib/fir/util/config.rb', line 28

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