Module: FIR::Util::ClassMethods

Includes:
Build, 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

#publish

Methods included from Build

#build_apk, #build_ipa

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.



27
28
29
# File 'lib/fir/util.rb', line 27

def logger
  @logger
end

Instance Method Details

#check_file_exist(path) ⇒ Object



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

def check_file_exist path
  unless File.file?(path)
    logger.error "File does not exist"
    exit 1
  end
end

#check_loginedObject



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

def check_logined
  if current_token.blank?
    logger.error "Please use `fir login` first"
    exit 1
  end
end

#check_supported_file(path) ⇒ Object



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

def check_supported_file path
  unless APP_FILE_TYPE.include?(File.extname(path))
    logger.error "Unsupported file type"
    exit 1
  end
end

#check_token_cannot_be_blank(token) ⇒ Object



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

def check_token_cannot_be_blank token
  if token.blank?
    logger.error "Token can't be blank"
    exit 1
  end
end

#fetch_user_info(token) ⇒ Object



29
30
31
# File 'lib/fir/util.rb', line 29

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

#fetch_user_uuid(token) ⇒ Object



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

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

#logger_info_blank_lineObject



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

def logger_info_blank_line
  logger.info ""
end

#logger_info_dividing_lineObject



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

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