Module: FIR::Config
- Included in:
- Util::ClassMethods
- Defined in:
- lib/fir/util/config.rb
Constant Summary collapse
- CONFIG_PATH =
"#{ENV['HOME']}/.fir-cli"- API_YML_PATH =
File.("../../", __FILE__) + '/api.yml'
- APP_FILE_TYPE =
%w(.ipa .apk).freeze
Instance Method Summary collapse
- #bughd_api ⇒ Object
- #config ⇒ Object
- #current_token ⇒ Object
- #fir_api ⇒ Object
- #reload_config ⇒ Object
- #write_config(hash) ⇒ Object
Instance Method Details
#bughd_api ⇒ Object
13 14 15 |
# File 'lib/fir/util/config.rb', line 13 def bughd_api @bughd_api ||= YAML.load_file(API_YML_PATH).deep_symbolize_keys[:bughd] end |
#config ⇒ Object
17 18 19 |
# File 'lib/fir/util/config.rb', line 17 def config @config ||= YAML.load_file(CONFIG_PATH).deep_symbolize_keys if File.exist?(CONFIG_PATH) end |
#current_token ⇒ Object
29 30 31 |
# File 'lib/fir/util/config.rb', line 29 def current_token @token ||= config[:token] if config end |
#fir_api ⇒ Object
9 10 11 |
# File 'lib/fir/util/config.rb', line 9 def fir_api @fir_api ||= YAML.load_file(API_YML_PATH).deep_symbolize_keys[:fir] end |
#reload_config ⇒ Object
21 22 23 |
# File 'lib/fir/util/config.rb', line 21 def reload_config @config = YAML.load_file(CONFIG_PATH).deep_symbolize_keys end |
#write_config(hash) ⇒ Object
25 26 27 |
# File 'lib/fir/util/config.rb', line 25 def write_config hash File.open(CONFIG_PATH, 'w+') { |f| f << YAML.dump(hash) } end |