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

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, #publish

Methods included from ThirdNotifierModule

#dingtalk_notifier, #feishu_notifier, #notify_to_thirds, #wxwork_notifier

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, #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_app_info, #write_config

Methods included from Http

#default_options, #old_default_options

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: #{path}"
  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



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
# 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'
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



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