fir-cli 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +54 -21
- data/Rakefile +4 -4
- data/bin/fir +1 -1
- data/fir-cli.gemspec +22 -24
- data/lib/fir/api.yml +7 -7
- data/lib/fir/cli.rb +67 -68
- data/lib/fir/patches/concern.rb +6 -4
- data/lib/fir/patches/native_patch.rb +10 -12
- data/lib/fir/patches/os_patch.rb +9 -3
- data/lib/fir/util/build_apk.rb +37 -15
- data/lib/fir/util/build_common.rb +38 -8
- data/lib/fir/util/build_ipa.rb +93 -98
- data/lib/fir/util/config.rb +4 -3
- data/lib/fir/util/http.rb +8 -9
- data/lib/fir/util/info.rb +9 -51
- data/lib/fir/util/login.rb +1 -1
- data/lib/fir/util/mapping.rb +50 -44
- data/lib/fir/util/parser/apk.rb +38 -0
- data/lib/fir/util/parser/common.rb +14 -0
- data/lib/fir/util/{parser.rb → parser/ipa.rb} +36 -12
- data/lib/fir/util/publish.rb +74 -68
- data/lib/fir/util.rb +25 -24
- data/lib/fir/version.rb +1 -1
- data/test/build_ipa_test.rb +1 -1
- data/test/info_test.rb +2 -5
- data/test/mapping_test.rb +1 -1
- data/test/test_helper.rb +1 -2
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea56efea5d40f829e8dda5577bedc83315e7dadb
|
4
|
+
data.tar.gz: 5d672c450dd8cc2115b26fdc4681cb7031e20a89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5e5d7e67186cb666fe8b96576a3046bffdfc985028d8d4b4b61713bc96c4e7a89417c39f37209be8a64df1c4dc2b09797fd34f7f23c3f00316296161a97a7d0
|
7
|
+
data.tar.gz: 911c4e30e32238144e65819b84725f9cb70191ff245d4e2ac4ed2a081ead711a3a53ec8fac951d475c13a5d069dde8e35ab78d45c4a963df389ca977f72d694e
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
fir.im-cli
|
2
2
|
---
|
3
3
|
|
4
4
|
|
@@ -8,12 +8,12 @@ FIR.im CLI
|
|
8
8
|
[![Gem Version](https://badge.fury.io/rb/fir-cli.svg)](http://badge.fury.io/rb/fir-cli)
|
9
9
|
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/FIRHQ/fir-cli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
10
10
|
|
11
|
-
>
|
11
|
+
> fir.im-cli 可以通过指令查看, 上传, 编译应用
|
12
12
|
|
13
13
|
## 使用入门
|
14
14
|
### 从安装入手
|
15
15
|
|
16
|
-
|
16
|
+
fir.im-cli 使用 Ruby 构建,只要安装相应 ruby gem 即可:
|
17
17
|
|
18
18
|
```shell
|
19
19
|
$ sudo gem install fir-cli
|
@@ -34,21 +34,54 @@ sudo gem update --system
|
|
34
34
|
sudo gem install fir-cli
|
35
35
|
```
|
36
36
|
|
37
|
+
**注意: 如果你的系统是 mac OSX 10.11 以后的版本, 由于10.11引入了 `rootless`, 无法直接安装 fir-cli, 有以下三种解决办法:**
|
38
|
+
|
39
|
+
1\. 使用 [RVM](https://rvm.io/) 安装 Ruby, 再安装 fir-cli(推荐)
|
40
|
+
|
41
|
+
```shell
|
42
|
+
# Install RVM:
|
43
|
+
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby
|
44
|
+
|
45
|
+
$ gem install fir-cli
|
46
|
+
```
|
47
|
+
|
48
|
+
2\. 指定 fir-cli 中 bin 文件的 PATH
|
49
|
+
|
50
|
+
```shell
|
51
|
+
$ export PATH=/usr/local/bin:$PATH;sudo gem install -n /usr/local/bin fir-cli
|
52
|
+
```
|
53
|
+
|
54
|
+
3\. 重写 Ruby Gem 的 bindir
|
55
|
+
|
56
|
+
```shell
|
57
|
+
$ echo 'gem: --bindir /usr/local/bin' >> ~/.gemrc
|
58
|
+
$ sudo gem install fir-cli
|
59
|
+
```
|
60
|
+
|
37
61
|
安装后,你可以在命令行执行指令
|
38
62
|
|
39
63
|
```shell
|
40
64
|
$ fir
|
41
65
|
Commands:
|
42
|
-
fir build_apk BUILD_DIR # Build Android app (alias:
|
43
|
-
fir build_ipa BUILD_DIR [options] [settings] # Build iOS app (alias:
|
44
|
-
fir help # Describe available commands or one specific command.
|
45
|
-
fir info APP_FILE_PATH # Show iOS/Android app
|
46
|
-
fir login # Login
|
47
|
-
fir mapping MAPPING_FILE_PATH # Upload app
|
66
|
+
fir build_apk BUILD_DIR # Build Android app (alias: `ba`).
|
67
|
+
fir build_ipa BUILD_DIR [options] [settings] # Build iOS app (alias: `bi`).
|
68
|
+
fir help # Describe available commands or one specific command (aliases: `h`).
|
69
|
+
fir info APP_FILE_PATH # Show iOS/Android app info, support ipa/apk file (aliases: `i`).
|
70
|
+
fir login # Login fir.im (aliases: `l`).
|
71
|
+
fir mapping MAPPING_FILE_PATH # Upload app mapping file to BugHD.com (aliases: `m`).
|
48
72
|
fir me # Show current user info if user is logined.
|
49
|
-
fir publish APP_FILE_PATH # Publish iOS/Android app to
|
50
|
-
fir upgrade # Upgrade
|
51
|
-
fir version # Show
|
73
|
+
fir publish APP_FILE_PATH # Publish iOS/Android app to fir.im, support ipa/apk file (aliases: `p`).
|
74
|
+
fir upgrade # Upgrade fir-cli and quit (aliases: `u`).
|
75
|
+
fir version # Show fir-cli version number and quit (aliases: `v`).
|
76
|
+
|
77
|
+
Options:
|
78
|
+
-T, [--token=TOKEN] # User's API Token at fir.im
|
79
|
+
-L, [--logfile=LOGFILE] # Path to writable logfile
|
80
|
+
-V, [--verbose], [--no-verbose] # Show verbose
|
81
|
+
# Default: true
|
82
|
+
-q, [--quiet], [--no-quiet] # Silence commands
|
83
|
+
-h, [--help], [--no-help] # Show this help message and quit
|
84
|
+
|
52
85
|
|
53
86
|
Options:
|
54
87
|
-T, [--token=TOKEN] # User's API Token at FIR.im
|
@@ -62,8 +95,8 @@ Options:
|
|
62
95
|
### 参数说明
|
63
96
|
|
64
97
|
- `alias <short command>` 意味着可以用 alias 别名来代替该指令, 例如 `fir b`
|
65
|
-
- `-T` 用户在
|
66
|
-
- `-L` 指定
|
98
|
+
- `-T` 用户在 fir.im 上的 api_token, `publish` 需要使用此参数
|
99
|
+
- `-L` 指定 fir-cli 的输出 log, 默认为 STDOUT
|
67
100
|
- `-V` Verbose, 默认为输出所有信息( INFO 和 ERROR), 如果设置 `--no-verbose`, 则只输出 ERROR 信息
|
68
101
|
- `-q` 静默模式, 默认关闭
|
69
102
|
- `-h` 查看帮助
|
@@ -81,11 +114,11 @@ $ fir p path/to/application -T YOUR_FIR_TOKEN
|
|
81
114
|
```shell
|
82
115
|
I, [2015-08-26T10:08:35.447209 #6774] INFO -- : Publishing app.......
|
83
116
|
I, [2015-08-26T10:08:35.447334 #6774] INFO -- : ✈ -------------------------------------------- ✈
|
84
|
-
I, [2015-08-26T10:08:35.514378 #6774] INFO -- : Fetching xxxx@
|
117
|
+
I, [2015-08-26T10:08:35.514378 #6774] INFO -- : Fetching xxxx@fir.im uploading info......
|
85
118
|
I, [2015-08-26T10:08:35.692616 #6774] INFO -- : Uploading app......
|
86
119
|
I, [2015-08-26T10:08:36.920226 #6774] INFO -- : Updating devices info......
|
87
120
|
I, [2015-08-26T10:08:37.075149 #6774] INFO -- : ✈ -------------------------------------------- ✈
|
88
|
-
I, [2015-08-26T10:08:37.075238 #6774] INFO -- : Fetch app info from
|
121
|
+
I, [2015-08-26T10:08:37.075238 #6774] INFO -- : Fetch app info from fir.im
|
89
122
|
I, [2015-08-26T10:08:37.235071 #6774] INFO -- : Published succeed: http://fir.im/xxxx
|
90
123
|
I, [2015-08-26T10:08:37.235155 #6774] INFO -- :
|
91
124
|
```
|
@@ -101,7 +134,7 @@ $ fir l
|
|
101
134
|
这时系统会提示输入用户 token, 用户 token 可在 **[这里](http://fir.im/user/info)** 查看
|
102
135
|
|
103
136
|
```shell
|
104
|
-
Please enter your
|
137
|
+
Please enter your fir.im API Token:
|
105
138
|
I, [2015-08-26T10:10:28.235295 #6833] INFO -- : Login succeed, previous user's email: xxx@xxx.com
|
106
139
|
I, [2015-08-26T10:10:28.245083 #6833] INFO -- : Login succeed, current user's email: xxx@xxx.com
|
107
140
|
I, [2015-08-26T10:10:28.245152 #6833] INFO -- :
|
@@ -142,7 +175,7 @@ $ fir bi path/to/workspace -w -S <scheme name>
|
|
142
175
|
$ fir ba path/to/project
|
143
176
|
```
|
144
177
|
|
145
|
-
### 一步, 从源代码到
|
178
|
+
### 一步, 从源代码到 fir.im
|
146
179
|
> 只需要输入 -p -T
|
147
180
|
|
148
181
|
```shell
|
@@ -157,11 +190,11 @@ I, [2015-08-26T10:12:00.893819 #7273] INFO -- : Build Success
|
|
157
190
|
I, [2015-08-26T10:12:00.894051 #7273] INFO -- :
|
158
191
|
I, [2015-08-26T10:12:01.026832 #7273] INFO -- : Publishing app.......
|
159
192
|
I, [2015-08-26T10:12:01.026905 #7273] INFO -- : ✈ -------------------------------------------- ✈
|
160
|
-
I, [2015-08-26T10:12:01.098759 #7273] INFO -- : Fetching im.fir.OnlyiPad@
|
193
|
+
I, [2015-08-26T10:12:01.098759 #7273] INFO -- : Fetching im.fir.OnlyiPad@fir.im uploading info......
|
161
194
|
I, [2015-08-26T10:12:01.249832 #7273] INFO -- : Uploading app......
|
162
195
|
I, [2015-08-26T10:12:01.859718 #7273] INFO -- : Updating devices info......
|
163
196
|
I, [2015-08-26T10:12:02.015517 #7273] INFO -- : ✈ -------------------------------------------- ✈
|
164
|
-
I, [2015-08-26T10:12:02.015588 #7273] INFO -- : Fetch app info from
|
197
|
+
I, [2015-08-26T10:12:02.015588 #7273] INFO -- : Fetch app info from fir.im
|
165
198
|
I, [2015-08-26T10:12:02.210391 #7273] INFO -- : Published succeed: http://fir.im/xxxx
|
166
199
|
I, [2015-08-26T10:12:02.210459 #7273] INFO -- :
|
167
200
|
I, [2015-08-26T10:12:02.210520 #7273] INFO -- :
|
@@ -201,7 +234,7 @@ $ fir publish -h
|
|
201
234
|
|
202
235
|
## 永远使用最新功能
|
203
236
|
|
204
|
-
下面的指令会自动更新
|
237
|
+
下面的指令会自动更新 fir-cli
|
205
238
|
|
206
239
|
```shell
|
207
240
|
$ fir upgrade
|
data/Rakefile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
require File.expand_path('../test/test_helper', __FILE__)
|
3
3
|
|
4
|
-
desc
|
4
|
+
desc 'Run the tests.'
|
5
5
|
task :test do
|
6
|
-
|
7
|
-
Dir[
|
6
|
+
$LOAD_PATH << 'lib' << 'test'
|
7
|
+
Dir['test/*_test.rb'].each { |f| require f[5..-4] }
|
8
8
|
end
|
9
9
|
|
10
10
|
task default: :test
|
data/bin/fir
CHANGED
data/fir-cli.gemspec
CHANGED
@@ -5,20 +5,19 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'fir/version'
|
6
6
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name =
|
8
|
+
spec.name = 'fir-cli'
|
9
9
|
spec.version = FIR::VERSION
|
10
|
-
spec.authors = [
|
11
|
-
spec.email = [
|
12
|
-
spec.date = Time.now.strftime(
|
13
|
-
spec.summary =
|
14
|
-
spec.description =
|
15
|
-
spec.homepage =
|
16
|
-
spec.license =
|
17
|
-
|
10
|
+
spec.authors = ['NaixSpirit']
|
11
|
+
spec.email = ['dev@fir.im']
|
12
|
+
spec.date = Time.now.strftime('%Y-%m-%d')
|
13
|
+
spec.summary = 'fir.im command tool'
|
14
|
+
spec.description = 'fir.im command tool, support iOS and Android'
|
15
|
+
spec.homepage = 'http://blog.fir.im/fir_cli'
|
16
|
+
spec.license = 'MIT'
|
18
17
|
spec.files = `git ls-files -z`.split("\x0")
|
19
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
22
21
|
|
23
22
|
spec.post_install_message = %q(
|
24
23
|
______________ ________ ____
|
@@ -28,21 +27,20 @@ Gem::Specification.new do |spec|
|
|
28
27
|
/_/ /___/_/ |_| \____/_____/___/
|
29
28
|
|
30
29
|
## 更新记录
|
31
|
-
###
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
- [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源, 欢迎 fork, issue 和 pull request
|
30
|
+
### fir-cli 1.2.3
|
31
|
+
- 修正 `build_apk` 无法找到 apk 的 bug
|
32
|
+
- build 完毕后, ipa 和 apk 均以 $name-$version-Build-$build 形式命名
|
33
|
+
- [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源
|
34
|
+
- 欢迎 fork, issue 和 pull request
|
37
35
|
)
|
38
36
|
|
39
|
-
spec.add_development_dependency
|
40
|
-
spec.add_development_dependency
|
41
|
-
spec.add_development_dependency
|
42
|
-
spec.add_development_dependency
|
37
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
38
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
39
|
+
spec.add_development_dependency 'minitest', '~> 5.7'
|
40
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
43
41
|
|
44
|
-
spec.add_dependency
|
45
|
-
spec.add_dependency
|
46
|
-
spec.add_dependency
|
47
|
-
spec.add_dependency
|
42
|
+
spec.add_dependency 'thor', '~> 0.19'
|
43
|
+
spec.add_dependency 'CFPropertyList', '~> 2.3'
|
44
|
+
spec.add_dependency 'rest-client', '~> 1.7'
|
45
|
+
spec.add_dependency 'ruby_android', '~> 0.7'
|
48
46
|
end
|
data/lib/fir/api.yml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
fir:
|
2
|
-
domain:
|
3
|
-
base_url:
|
4
|
-
user_url:
|
5
|
-
app_url:
|
2
|
+
domain: 'http://fir.im'
|
3
|
+
base_url: 'http://api.fir.im'
|
4
|
+
user_url: 'http://api.fir.im/user'
|
5
|
+
app_url: 'http://api.fir.im/apps'
|
6
6
|
udids_url: 'http://api.fir.im/devices/multi_udid'
|
7
7
|
bughd:
|
8
|
-
domain:
|
9
|
-
base_url:
|
10
|
-
project_url:
|
8
|
+
domain: 'http://bughd.com'
|
9
|
+
base_url: 'http://api.bughd.com'
|
10
|
+
project_url: 'http://api.bughd.com/projects'
|
11
11
|
full_version_url: 'http://api.bughd.com/full_versions'
|
data/lib/fir/cli.rb
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
module FIR
|
4
4
|
class CLI < Thor
|
5
|
-
class_option :token, type: :string, aliases:
|
6
|
-
class_option :logfile, type: :string, aliases:
|
7
|
-
class_option :verbose, type: :boolean, aliases:
|
8
|
-
class_option :quiet, type: :boolean, aliases:
|
9
|
-
class_option :help, type: :boolean, aliases:
|
5
|
+
class_option :token, type: :string, aliases: '-T', desc: "User's API Token at fir.im"
|
6
|
+
class_option :logfile, type: :string, aliases: '-L', desc: 'Path to writable logfile'
|
7
|
+
class_option :verbose, type: :boolean, aliases: '-V', desc: 'Show verbose', default: true
|
8
|
+
class_option :quiet, type: :boolean, aliases: '-q', desc: 'Silence commands'
|
9
|
+
class_option :help, type: :boolean, aliases: '-h', desc: 'Show this help message and quit'
|
10
10
|
|
11
|
-
desc
|
11
|
+
desc 'build_ipa BUILD_DIR [options] [settings]', 'Build iOS app (alias: `bi`).'
|
12
12
|
long_desc <<-LONGDESC
|
13
13
|
`build_ipa` command will auto build your project/workspace to an ipa package
|
14
|
-
and it also can auto publish your built ipa to
|
14
|
+
and it also can auto publish your built ipa to fir.im if use `-p` option.
|
15
15
|
Internally, it use `xcodebuild` to accomplish these things, use `man xcodebuild` to get more information.
|
16
16
|
|
17
17
|
Example:
|
@@ -22,57 +22,57 @@ module FIR
|
|
22
22
|
|
23
23
|
$ fir bi <workspace dir> -w -S <scheme name> [-C <configuration>] [-t <target name>] [-o <ipa output dir>] [settings] [-c <changelog>] [-p -T <your api token>]
|
24
24
|
LONGDESC
|
25
|
-
map [
|
26
|
-
method_option :workspace, type: :boolean, aliases:
|
27
|
-
method_option :scheme, type: :string, aliases:
|
28
|
-
method_option :configuration, type: :string, aliases:
|
29
|
-
method_option :target, type: :string, aliases:
|
30
|
-
method_option :output, type: :string, aliases:
|
31
|
-
method_option :name, type: :string, aliases:
|
32
|
-
method_option :publish, type: :boolean, aliases:
|
33
|
-
method_option :short, type: :string, aliases:
|
34
|
-
method_option :changelog, type: :string, aliases:
|
35
|
-
method_option :mapping, type: :boolean, aliases:
|
36
|
-
method_option :proj, type: :string, aliases:
|
37
|
-
def build_ipa
|
25
|
+
map ['b', 'bi'] => :build_ipa
|
26
|
+
method_option :workspace, type: :boolean, aliases: '-w', desc: 'true/false if build workspace'
|
27
|
+
method_option :scheme, type: :string, aliases: '-S', desc: 'Set the scheme NAME if build workspace'
|
28
|
+
method_option :configuration, type: :string, aliases: '-C', desc: 'Use the build configuration NAME for building each target'
|
29
|
+
method_option :target, type: :string, aliases: '-t', desc: 'Build the target specified by targetname'
|
30
|
+
method_option :output, type: :string, aliases: '-o', desc: 'IPA output path, the default is: BUILD_DIR/fir_build_ipa'
|
31
|
+
method_option :name, type: :string, aliases: '-n', desc: 'IPA name, the default is: YOUR PROJECT NAME'
|
32
|
+
method_option :publish, type: :boolean, aliases: '-p', desc: 'true/false if publish to fir.im'
|
33
|
+
method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link if publish to fir.im'
|
34
|
+
method_option :changelog, type: :string, aliases: '-c', desc: 'Set changelog if publish to fir.im'
|
35
|
+
method_option :mapping, type: :boolean, aliases: '-M', desc: 'true/false if upload app mapping file to BugHD.com'
|
36
|
+
method_option :proj, type: :string, aliases: '-P', desc: 'Project id in BugHD.com if upload app mapping file'
|
37
|
+
def build_ipa(*args)
|
38
38
|
prepare :build_ipa
|
39
39
|
|
40
40
|
FIR.build_ipa(*args, options)
|
41
41
|
end
|
42
42
|
|
43
|
-
desc
|
43
|
+
desc 'build_apk BUILD_DIR', 'Build Android app (alias: `ba`).'
|
44
44
|
long_desc <<-LONGDESC
|
45
45
|
`build_apk` command will auto build your project to an apk package
|
46
|
-
and it also can auto publish your built apk to
|
46
|
+
and it also can auto publish your built apk to fir.im if use `-p` option.
|
47
47
|
Internally, it use `gradle` to accomplish these things, use `gradle --help` to get more information.
|
48
48
|
|
49
49
|
Example:
|
50
50
|
|
51
51
|
$ fir ba <project dir> [-o <apk output dir> -c <changelog> -p -T <your api token>]
|
52
52
|
LONGDESC
|
53
|
-
map [
|
54
|
-
method_option :output, type: :string, aliases:
|
55
|
-
method_option :publish, type: :boolean, aliases:
|
56
|
-
method_option :short, type: :string, aliases:
|
57
|
-
method_option :changelog, type: :string, aliases:
|
58
|
-
def build_apk
|
53
|
+
map ['ba'] => :build_apk
|
54
|
+
method_option :output, type: :string, aliases: '-o', desc: 'APK output path, the default is: BUILD_DIR/build/outputs/apk'
|
55
|
+
method_option :publish, type: :boolean, aliases: '-p', desc: 'true/false if publish to fir.im'
|
56
|
+
method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link if publish to fir.im'
|
57
|
+
method_option :changelog, type: :string, aliases: '-c', desc: 'Set changelog if publish to fir.im'
|
58
|
+
def build_apk(*args)
|
59
59
|
prepare :build_apk
|
60
60
|
|
61
61
|
FIR.build_apk(*args, options)
|
62
62
|
end
|
63
63
|
|
64
|
-
desc
|
65
|
-
map
|
66
|
-
method_option :all, type: :boolean, aliases:
|
67
|
-
def info
|
64
|
+
desc 'info APP_FILE_PATH', 'Show iOS/Android app info, support ipa/apk file (aliases: `i`).'
|
65
|
+
map 'i' => :info
|
66
|
+
method_option :all, type: :boolean, aliases: '-a', desc: 'Show all information in application'
|
67
|
+
def info(*args)
|
68
68
|
prepare :info
|
69
69
|
|
70
70
|
FIR.info(*args, options)
|
71
71
|
end
|
72
72
|
|
73
|
-
desc
|
73
|
+
desc 'publish APP_FILE_PATH', 'Publish iOS/Android app to fir.im, support ipa/apk file (aliases: `p`).'
|
74
74
|
long_desc <<-LONGDESC
|
75
|
-
`publish` command will publish your app file to
|
75
|
+
`publish` command will publish your app file to fir.im, also the command support to publish app's short & changelog.
|
76
76
|
|
77
77
|
Example:
|
78
78
|
|
@@ -80,34 +80,34 @@ module FIR
|
|
80
80
|
|
81
81
|
$ fir p <app file path> [-c <changelog> -s <custom short link> -m <mapping file path> -P <bughd project id> -T <your api token>]
|
82
82
|
LONGDESC
|
83
|
-
map
|
84
|
-
method_option :short, type: :string, aliases:
|
85
|
-
method_option :changelog, type: :string, aliases:
|
86
|
-
method_option :mappingfile, type: :string, aliases:
|
87
|
-
method_option :proj, type: :string, aliases:
|
88
|
-
def publish
|
83
|
+
map 'p' => :publish
|
84
|
+
method_option :short, type: :string, aliases: '-s', desc: 'Set custom short link'
|
85
|
+
method_option :changelog, type: :string, aliases: '-c', desc: 'Set changelog'
|
86
|
+
method_option :mappingfile, type: :string, aliases: '-m', desc: 'App mapping file'
|
87
|
+
method_option :proj, type: :string, aliases: '-P', desc: 'Project id in BugHD.com if upload app mapping file'
|
88
|
+
def publish(*args)
|
89
89
|
prepare :publish
|
90
90
|
|
91
91
|
FIR.publish(*args, options)
|
92
92
|
end
|
93
93
|
|
94
|
-
desc
|
95
|
-
map
|
96
|
-
def login
|
94
|
+
desc 'login', 'Login fir.im (aliases: `l`).'
|
95
|
+
map 'l' => :login
|
96
|
+
def login(*args)
|
97
97
|
prepare :login
|
98
98
|
|
99
|
-
token = options[:token] || args.first || ask(
|
99
|
+
token = options[:token] || args.first || ask('Please enter your fir.im API Token:', :white, echo: true)
|
100
100
|
FIR.login(token)
|
101
101
|
end
|
102
102
|
|
103
|
-
desc
|
104
|
-
def me
|
103
|
+
desc 'me', 'Show current user info if user is logined.'
|
104
|
+
def me
|
105
105
|
prepare :me
|
106
106
|
|
107
107
|
FIR.me
|
108
108
|
end
|
109
109
|
|
110
|
-
desc
|
110
|
+
desc 'mapping MAPPING_FILE_PATH', 'Upload app mapping file to BugHD.com (aliases: `m`).'
|
111
111
|
long_desc <<-LONGDESC
|
112
112
|
`mapping` command will upload your app's mapping file to BugHD.com if you have the same app/project in BugHD.com.
|
113
113
|
|
@@ -115,39 +115,39 @@ module FIR
|
|
115
115
|
|
116
116
|
$ fir m <mapping file path> -P <bughd project id> -v <app version> -b <app build> -T <your fir api token>
|
117
117
|
LONGDESC
|
118
|
-
map
|
119
|
-
method_option :proj, type: :string, aliases:
|
120
|
-
method_option :version, type: :string, aliases:
|
121
|
-
method_option :build, type: :string, aliases:
|
122
|
-
def mapping
|
118
|
+
map 'm' => :mapping
|
119
|
+
method_option :proj, type: :string, aliases: '-P', desc: 'Project id in BugHD.com'
|
120
|
+
method_option :version, type: :string, aliases: '-v', desc: 'App version'
|
121
|
+
method_option :build, type: :string, aliases: '-b', desc: 'App build'
|
122
|
+
def mapping(*args)
|
123
123
|
prepare :mapping
|
124
124
|
|
125
125
|
FIR.mapping(*args, options)
|
126
126
|
end
|
127
127
|
|
128
|
-
desc
|
129
|
-
map
|
128
|
+
desc 'upgrade', 'Upgrade fir-cli and quit (aliases: `u`).'
|
129
|
+
map 'u' => :upgrade
|
130
130
|
def upgrade
|
131
131
|
prepare :upgrade
|
132
132
|
|
133
|
-
say
|
133
|
+
say '✈ Upgrade fir-cli (use `gem install fir-cli --no-ri --no-rdoc`)'
|
134
134
|
say `gem install fir-cli --no-ri --no-rdoc`
|
135
135
|
end
|
136
136
|
|
137
|
-
desc
|
138
|
-
map [
|
137
|
+
desc 'version', 'Show fir-cli version number and quit (aliases: `v`).'
|
138
|
+
map ['v', '-v', '--version'] => :version
|
139
139
|
def version
|
140
|
-
say
|
140
|
+
say '✈ fir-cli #{FIR::VERSION}'
|
141
141
|
end
|
142
142
|
|
143
|
-
desc
|
143
|
+
desc 'help', 'Describe available commands or one specific command (aliases: `h`).'
|
144
144
|
map Thor::HELP_MAPPINGS => :help
|
145
|
-
def help
|
145
|
+
def help(command = nil, subcommand = false)
|
146
146
|
super
|
147
147
|
end
|
148
148
|
|
149
149
|
no_commands do
|
150
|
-
def invoke_command
|
150
|
+
def invoke_command(command, *args)
|
151
151
|
logfile = options[:logfile].blank? ? STDOUT : options[:logfile]
|
152
152
|
logfile = '/dev/null' if options[:quiet]
|
153
153
|
|
@@ -159,13 +159,12 @@ module FIR
|
|
159
159
|
|
160
160
|
private
|
161
161
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
end
|
167
|
-
$DEBUG = true if ENV["DEBUG"]
|
162
|
+
def prepare(task)
|
163
|
+
if options.help?
|
164
|
+
help(task.to_s)
|
165
|
+
fail SystemExit
|
168
166
|
end
|
169
|
-
|
167
|
+
$DEBUG = true if ENV['DEBUG']
|
168
|
+
end
|
170
169
|
end
|
171
170
|
end
|
data/lib/fir/patches/concern.rb
CHANGED
@@ -125,7 +125,7 @@ module ActiveSupport
|
|
125
125
|
|
126
126
|
def included(base = nil, &block)
|
127
127
|
if base.nil?
|
128
|
-
|
128
|
+
fail MultipleIncludedBlocks if instance_variable_defined?(:@_included_block)
|
129
129
|
|
130
130
|
@_included_block = block
|
131
131
|
else
|
@@ -134,9 +134,11 @@ module ActiveSupport
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def class_methods(&class_methods_module_definition)
|
137
|
-
|
138
|
-
const_get(:ClassMethods)
|
139
|
-
|
137
|
+
if const_defined?(:ClassMethods, false)
|
138
|
+
mod = const_get(:ClassMethods)
|
139
|
+
else
|
140
|
+
mod = const_set(:ClassMethods, Module.new)
|
141
|
+
end
|
140
142
|
|
141
143
|
mod.module_eval(&class_methods_module_definition)
|
142
144
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
3
|
class Object
|
4
|
-
# activesupport/lib/active_support/core_ext/object/blank.rb
|
5
4
|
# An object is blank if it's false, empty, or a whitespace string.
|
6
5
|
# For example, '', ' ', +nil+, [], and {} are all blank.
|
7
6
|
#
|
@@ -15,7 +14,7 @@ class Object
|
|
15
14
|
#
|
16
15
|
# @return [true, false]
|
17
16
|
def blank?
|
18
|
-
respond_to?(:empty?) ?
|
17
|
+
respond_to?(:empty?) ? empty? : !self
|
19
18
|
end
|
20
19
|
|
21
20
|
# An object is present if it's not blank.
|
@@ -155,7 +154,7 @@ class Hash
|
|
155
154
|
# hash.symbolize_keys
|
156
155
|
# # => {:name=>"Rob", :age=>"28"}
|
157
156
|
def symbolize_keys
|
158
|
-
transform_keys{ |key| key.to_sym rescue key }
|
157
|
+
transform_keys { |key| key.to_sym rescue key }
|
159
158
|
end
|
160
159
|
|
161
160
|
# Returns a new hash with all keys converted by the block operation.
|
@@ -179,10 +178,11 @@ class Hash
|
|
179
178
|
# hash.deep_symbolize_keys
|
180
179
|
# # => {:person=>{:name=>"Rob", :age=>"28"}}
|
181
180
|
def deep_symbolize_keys
|
182
|
-
deep_transform_keys{ |key| key.to_sym rescue key }
|
181
|
+
deep_transform_keys { |key| key.to_sym rescue key }
|
183
182
|
end
|
184
183
|
|
185
184
|
private
|
185
|
+
|
186
186
|
# support methods for deep transforming nested hashes and arrays
|
187
187
|
def _deep_transform_keys_in_object(object, &block)
|
188
188
|
case object
|
@@ -191,7 +191,7 @@ class Hash
|
|
191
191
|
result[yield(key)] = _deep_transform_keys_in_object(value, &block)
|
192
192
|
end
|
193
193
|
when Array
|
194
|
-
object.map {|e| _deep_transform_keys_in_object(e, &block) }
|
194
|
+
object.map { |e| _deep_transform_keys_in_object(e, &block) }
|
195
195
|
else
|
196
196
|
object
|
197
197
|
end
|
@@ -199,30 +199,28 @@ class Hash
|
|
199
199
|
end
|
200
200
|
|
201
201
|
class File
|
202
|
-
|
203
202
|
class << self
|
204
203
|
# A binary file is Mach-O dSYM
|
205
204
|
#
|
206
205
|
# @return [true, false]
|
207
|
-
def
|
208
|
-
|
206
|
+
def dsym?(file_path)
|
207
|
+
!(`file -b #{file_path}` =~ /dSYM/).nil?
|
209
208
|
end
|
210
209
|
|
211
210
|
# A file is ASCII text
|
212
211
|
#
|
213
212
|
# @return [true, false]
|
214
|
-
def
|
215
|
-
|
213
|
+
def text?(file_path)
|
214
|
+
!(`file -b #{file_path}` =~ /text/).nil?
|
216
215
|
end
|
217
216
|
end
|
218
217
|
end
|
219
218
|
|
220
219
|
class String
|
221
|
-
|
222
220
|
# Convert String encoding to UTF-8
|
223
221
|
#
|
224
222
|
# @return string
|
225
223
|
def to_utf8
|
226
|
-
|
224
|
+
encode(Encoding.find('UTF-8'), invalid: :replace, undef: :replace, replace: '')
|
227
225
|
end
|
228
226
|
end
|