Sha256: 2e2283f0c142f1b9d73e7e1888ff297c1edcbcbd166cd01339abe4274bc2712c

Contents?: true

Size: 1.78 KB

Versions: 3

Compression:

Stored size: 1.78 KB

Contents

# encoding: utf-8

require_relative './util/http'
require_relative './util/config'
require_relative './util/parser/apk'
require_relative './util/parser/ipa'
require_relative './util/login'
require_relative './util/me'
require_relative './util/info'
require_relative './util/build_common'
require_relative './util/build_ipa'
require_relative './util/build_apk'
require_relative './util/publish'
require_relative './util/mapping'

module FIR
  module Util
    extend ActiveSupport::Concern

    module ClassMethods
      include FIR::Http
      include FIR::Config
      include FIR::Login
      include FIR::Me
      include FIR::Info
      include FIR::BuildCommon
      include FIR::BuildIpa
      include FIR::BuildApk
      include FIR::Publish
      include FIR::Mapping

      attr_accessor :logger

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

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

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

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

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

        logger.error 'Unsupported file type'
        exit 1
      end

      def check_token_cannot_be_blank(token)
        return unless token.blank?

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

      def check_logined
        return unless current_token.blank?

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

      def logger_info_blank_line
        logger.info ''
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fir-cli-1.2.5 lib/fir/util.rb
fir-cli-1.2.4 lib/fir/util.rb
fir-cli-1.2.3 lib/fir/util.rb