✈ fir.im-cli

Build Status Images Code Climate Test Coverage Gem Version Gitter

fir.im-cli 可以通过指令查看, 上传, 编译 ios/android 应用.

安装

OSX 安装

在安装前需要确保 osx command line tools 已经被提前安装好:

$ xcode-select --install

fir.im-cli 使用 Ruby 构建, 无需编译, 只要安装相应 ruby gem 即可(如果出现相关权限不足的错误, 请在命令行前加上 sudo):

$ gem install fir-cli

注意: 如果你的系统是 mac OSX 10.11 以后的版本, 由于10.11引入了 rootless, 无法直接安装 fir-cli, 有以下三种解决办法:

1. 使用 RVM 安装 Ruby, 再安装 fir-cli(推荐)

# Install RVM:
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby

$ gem install fir-cli

2. 指定 fir-cli 中 bin 文件的 PATH

$ export PATH=/usr/local/bin:$PATH;gem install -n /usr/local/bin fir-cli

3. 重写 Ruby Gem 的 bindir

$ echo 'gem: --bindir /usr/local/bin' >> ~/.gemrc
$ gem install fir-cli

Linux 安装

需要提前安装好 Ruby 版本 > 1.9.3

$ gem install fir-cli

注意: 如果出现 ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) 的错误, 请先更换 Ruby 的淘宝源(由于国内网络原因, 你懂的), 并升级下系统自带的 gem

$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***

https://ruby.taobao.org
# 请确保只有 ruby.taobao.org, 如果有其他的源, 请 remove 掉

gem update --system
gem install fir-cli

使用说明

fir help 使用说明

fir help 命令不仅可以运行在 fir 主命令上, 还可以运行在相应子命令上查看相关的帮助

$ fir help
Commands:
  fir build_apk BUILD_DIR                       # Build Android app (alias: `ba`).
  fir build_ipa BUILD_DIR [options] [settings]  # Build iOS app (alias: `bi`).
  fir help                                      # Describe available commands or one specific command (aliases: `h`).
  fir info APP_FILE_PATH                        # Show iOS/Android app info, support ipa/apk file (aliases: `i`).
  fir login                                     # Login fir.im (aliases: `l`).
  fir mapping MAPPING_FILE_PATH                 # Upload app mapping file to BugHD.com (aliases: `m`).
  fir me                                        # Show current user info if user is logined.
  fir publish APP_FILE_PATH                     # Publish iOS/Android app to fir.im, support ipa/apk file (aliases: `...
  fir upgrade                                   # Upgrade fir-cli and quit (aliases: `u`).
  fir version                                   # Show fir-cli version number and quit (aliases: `v`).

Options:
  -T, [--token=TOKEN]              # User's API Token at fir.im
  -L, [--logfile=LOGFILE]          # Path to writable logfile
  -V, [--verbose], [--no-verbose]  # Show verbose
                                   # Default: true
  -q, [--quiet], [--no-quiet]      # Silence commands
  -h, [--help], [--no-help]        # Show this help message and quit

全局参数说明

  • alias <short command> 意味着可以用 alias 别名来代替该指令, 例如 fir b
  • -T 用户在 fir.im 上的 api_token
  • -L 指定 fir-cli 的输出 log, 默认为 STDOUT
  • -V Verbose, 默认为输出所有信息( INFO 和 ERROR), 如果设置 --no-verbose, 则只输出 ERROR 信息
  • -q 静默模式, 默认关闭
  • -h 查看相关命令帮助

fir publish 使用说明

fir publish 命令可以轻松发布应用到 fir.im, 支持 ipa 和 apk 文件.

$ fir publish path/to/application -T YOUR_FIR_TOKEN

如果需要上传 changelog, 自定义 short 地址, 上传符号表, 生成二维码等功能, 可以使用 fir publish -h查看相应的帮助

fir login 使用说明

如果觉得每次上传都输入 -T 很不方便, 那么可使用 login 命令

$ fir login

这时系统会提示输入用户 API token, 用户的 API token 可在 fir.im 应用管理页 的右上角查看

Please enter your fir.im API Token:
I, [2015-08-26T10:10:28.235295 #6833]  INFO -- : Login succeed, previous user's email: [email protected]
I, [2015-08-26T10:10:28.245083 #6833]  INFO -- : Login succeed, current  user's email: [email protected]
I, [2015-08-26T10:10:28.245152 #6833]  INFO -- :

fir build 使用说明

该指令分为两个不同的指令, build_ipabuild_apk, 可以编译 ipa 及 apk 应用并上传到 fir.im

编译 ipa

build_ipaxcodebuild 原生指令进行了封装, 将常用的参数名简化, 支持全部的自带参数及设置, 同时输出符号表 dSYM 文件.

编译 project

$ fir build_ipa path/to/project -o path/to/output

编译 workspace

$ fir build_ipa path/to/workspace -o path/to/output -w -C Release -t allTargets GCC_PREPROCESSOR_DEFINITIONS="FOO=bar"

该指令在指向的目录中,找到第一个 workspace 文件,对其进行编译。使用 Release 设置,编译策略为 allTargets,同时设置了预编译参数 FOO

编译用 CocoaPods 做依赖管理的 .ipa 包

$ fir build_ipa path/to/workspace -w -S <scheme name>

编译用 Gradle 打包 apk

$ fir build_apk path/to/project

编译并且上传至 fir.im

只需要输入 -p -T 即可

$ fir build_ipa/build_apk path/to/project -o path/to/output -p -T YOUR_FIR_TOKEN -c YOUR_CHANGELOG

如果需要更详细的使用说明, 可以使用 fir build_ipa/build_apk -h查看相应的帮助

fir mapping 使用说明

该指令可以上传符号表至 BugHD.com 所对应的项目, 目前已经支持 dSYM 和 txt 两种格式的符号表文件上传, 有以下三种方法上传:

指定 version 和 build 上传:

$ fir m <mapping file path> -P <bughd project id> -v <app version> -b <app build> -T <your api token>

在 publish 的时候自动上传:

$ fir p <app file path> -m <mapping file path> -P <bughd project id> -T <your api token>

在 build_ipa 的时候自动上传:

$ fir b <project dir> -P <bughd project id> -M -p -T <your api token>

如果需要更详细的使用说明, 可以使用 fir mapping -h查看相应的帮助

fir me 使用说明

该指令可以查看当前使用者

$ fir me
I, [2015-11-02T03:03:04.933645 #29886]  INFO -- : Login succeed, current user's email: xxxx
I, [2015-11-02T03:03:04.933756 #29886]  INFO -- : Login succeed, current user's name:  xxxx
I, [2015-11-02T03:03:04.933787 #29886]  INFO -- :

fir upgrade 使用说明

该指令用于升级最新版本的 fir-cli

$ fir upgrade

提交反馈

直接使用 Github 的 Issue 即可.

捐赠支持

如果你觉得 fir-cli 对你有所帮助, 欢迎打赏支持作者:smile: