Module: FIR::Config
- Included in:
- Util::ClassMethods
- Defined in:
- lib/fir/util/config.rb
Constant Summary collapse
- CONFIG_PATH =
"#{ENV['HOME']}/.fir-cli"
- APP_INFO_PATH =
"#{ENV['HOME']}/.fir-cli-app"
- API_YML_PATH =
ENV['API_YML_PATH'] || File.('../../', __FILE__) + '/api.yml'
- XCODE_WRAPPER_PATH =
File.('../../', __FILE__) + '/xcode_wrapper.sh'
- 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_app_info(hash) ⇒ Object
- #write_config(hash) ⇒ Object
Instance Method Details
#bughd_api ⇒ Object
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 |
#config ⇒ Object
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_token ⇒ Object
36 37 38 39 |
# File 'lib/fir/util/config.rb', line 36 def current_token return @token = ENV["API_TOKEN"] if ENV["API_TOKEN"] @token ||= config[:token] if config end |
#fir_api ⇒ Object
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_config ⇒ Object
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 |