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::APP_INFO_PATH, Config::CONFIG_PATH, Config::XCODE_WRAPPER_PATH

Constants included from Http

Http::MAX_RETRIES

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

#convert_icon, #fetch_uploading_info, #initialize_publish_options, #publish, #read_changelog, #upload_app, #upload_app_binary, #upload_app_icon, #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, #git_clone_build_dir, #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

#aab_info, #apk_info, #apks_info, #info, #ipa_info, #zip_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_app_info, #write_config

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



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

def logger
  @logger
end

Instance Method Details

#check_file_exist(path) ⇒ Object



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

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

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

#check_loginedObject



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

def check_logined
  return unless current_token.blank?

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

#check_supported_file(path) ⇒ Object



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

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



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

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



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

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

#fetch_user_uuid(token) ⇒ Object



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

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

#generate_rqrcode(string, png_file_path) ⇒ Object



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

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



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

def logger_info_blank_line
  logger.info ''
end

#logger_info_dividing_lineObject



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

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