Module: Flappy::Config
- Included in:
- Util::ClassMethods
- Defined in:
- lib/flappy/util/config.rb
Constant Summary collapse
- CONFIG_PATH =
"#{ENV['HOME']}/.flappy-cli"
- APP_INFO_PATH =
"#{ENV['HOME']}/.flappy-cli-app"
- API_YML_PATH =
File.('../../', __FILE__) + '/api.yml'
- APP_FILE_TYPE =
%w(.ipa .apk).freeze
Instance Method Summary collapse
-
#config ⇒ Object
def bughd_api @bughd_api ||= YAML.load_file(API_YML_PATH).deep_symbolize_keys end.
- #current_token ⇒ Object
- #fir_api ⇒ Object
- #reload_config ⇒ Object
- #write_app_info(hash) ⇒ Object
- #write_config(hash) ⇒ Object
Instance Method Details
#config ⇒ Object
18 19 20 21 |
# File 'lib/flappy/util/config.rb', line 18 def config return unless File.exist?(CONFIG_PATH) @config ||= YAML.load_file(CONFIG_PATH).deep_symbolize_keys end |
#current_token ⇒ Object
35 36 37 |
# File 'lib/flappy/util/config.rb', line 35 def current_token @token ||= config[:token] if config end |
#fir_api ⇒ Object
10 11 12 |
# File 'lib/flappy/util/config.rb', line 10 def fir_api @fir_api ||= YAML.load_file(API_YML_PATH).deep_symbolize_keys[:fir] end |
#reload_config ⇒ Object
23 24 25 |
# File 'lib/flappy/util/config.rb', line 23 def reload_config @config = YAML.load_file(CONFIG_PATH).deep_symbolize_keys end |
#write_app_info(hash) ⇒ Object
31 32 33 |
# File 'lib/flappy/util/config.rb', line 31 def write_app_info(hash) File.open(APP_INFO_PATH, 'w+') { |f| f << YAML.dump(hash) } end |
#write_config(hash) ⇒ Object
27 28 29 |
# File 'lib/flappy/util/config.rb', line 27 def write_config(hash) File.open(CONFIG_PATH, 'w+') { |f| f << YAML.dump(hash) } end |