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 20 |
# File 'lib/fir/util/config.rb', line 17 def config return unless File.exist?(CONFIG_PATH) @config ||= YAML.load_file(CONFIG_PATH).deep_symbolize_keys end |
#current_token ⇒ Object
30 31 32 |
# File 'lib/fir/util/config.rb', line 30 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
22 23 24 |
# File 'lib/fir/util/config.rb', line 22 def reload_config @config = YAML.load_file(CONFIG_PATH).deep_symbolize_keys end |
#write_config(hash) ⇒ Object
26 27 28 |
# File 'lib/fir/util/config.rb', line 26 def write_config(hash) File.open(CONFIG_PATH, 'w+') { |f| f << YAML.dump(hash) } end |