Module: FIR::Util::ClassMethods

Includes:
BuildApk, BuildCommon, BuildIpa, Config, Http, Info, Login, Mapping, Me, Publish
Defined in:
lib/fir/util.rb

Constant Summary

Constants included from Config

Config::API_YML_PATH, Config::APP_FILE_TYPE, Config::CONFIG_PATH

Constants included from Http

Http::DEFAULT_TIMEOUT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Mapping

#find_or_create_bughd_full_version, #mapping, #upload_mapping_file

Methods included from Publish

#fetch_app_info, #fetch_uploading_info, #logger_info_app_short_and_qrcode, #logger_info_publishing_message, #publish, #update_app_info, #upload_app, #upload_app_binary, #upload_app_icon, #upload_device_info, #upload_mapping_file_with_publish, #uploading_binary_info, #uploading_icon_info

Methods included from BuildApk

#build_apk

Methods included from BuildIpa

#build_ipa

Methods included from BuildCommon

#convert_hash_to_assignment_string, #initialize_build_common_options, #initialize_build_dir, #initialize_output_path, #logger_info_and_run_build_command, #publish_build_app, #split_assignment_array_to_hash

Methods included from Info

#apk_info, #info, #ipa_info

Methods included from Me

#me

Methods included from Login

#login

Methods included from Config

#bughd_api, #config, #current_token, #fir_api, #reload_config, #write_config

Methods included from Http

#get

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
end

Instance Method Details

#check_file_exist(path) ⇒ Object



43
44
45
46
47
48
# File 'lib/fir/util.rb', line 43

def check_file_exist(path)
  return if File.file?(path)

  logger.error 'File does not exist'
  exit 1
end

#check_loginedObject



64
65
66
67
68
69
# File 'lib/fir/util.rb', line 64

def check_logined
  return unless current_token.blank?

  logger.error 'Please use `fir login` first'
  exit 1
end

#check_supported_file(path) ⇒ Object



50
51
52
53
54
55
# File 'lib/fir/util.rb', line 50

def check_supported_file(path)
  return if APP_FILE_TYPE.include?(File.extname(path))

  logger.error 'Unsupported file type'
  exit 1
end

#check_token_cannot_be_blank(token) ⇒ Object



57
58
59
60
61
62
# File 'lib/fir/util.rb', line 57

def check_token_cannot_be_blank(token)
  return unless token.blank?

  logger.error 'Token can not be blank'
  exit 1
end

#fetch_user_info(token) ⇒ Object



34
35
36
# File 'lib/fir/util.rb', line 34

def (token)
  get fir_api[:user_url], api_token: token
end

#fetch_user_uuid(token) ⇒ Object



38
39
40
41
# File 'lib/fir/util.rb', line 38

def fetch_user_uuid(token)
   = (token)
  [:uuid]
end

#generate_rqrcode(string, png_file_path) ⇒ Object



79
80
81
82
83
# File 'lib/fir/util.rb', line 79

def generate_rqrcode string, png_file_path
  qrcode = ::RQRCode::QRCode.new(string.to_s)
  qrcode.as_png(size: 500, border_modules: 2, file: png_file_path)
  png_file_path
end

#logger_info_blank_lineObject



71
72
73
# File 'lib/fir/util.rb', line 71

def logger_info_blank_line
  logger.info ''
end

#logger_info_dividing_lineObject



75
76
77
# File 'lib/fir/util.rb', line 75

def logger_info_dividing_line
  logger.info '✈ -------------------------------------------- ✈'
end