fir-cli 0.2.0 → 0.2.1.a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/README.md +89 -106
- data/fir-cli.gemspec +1 -0
- data/fir-cli.rb +5 -0
- data/lib/fir-cli/version.rb +1 -1
- data/lib/fir-cli-commands/00-login.rb +2 -2
- data/lib/fir-cli-commands/00-profile.rb +2 -2
- data/lib/fir-cli-commands/01-config.rb +2 -13
- data/lib/fir-cli-commands/100-resign_codesign.rb +54 -0
- data/lib/fir-cli-commands/{10-resign.rb → 100-resign_tapbeta.rb} +11 -11
- data/lib/fir-cli-commands/101-resign.rb +26 -0
- data/lib/fir-cli-commands/11-publish.rb +3 -3
- data/lib/fir-cli-commands/12-build_ipa.rb +14 -17
- data/lib/fir-cli.chk.rb +33 -0
- data/lib/fir-cli.core.rb +96 -0
- data/lib/{fir-cli.core.ext.rb → fir-cli.fir.rb} +16 -9
- data/lib/fir-cli.opt.rb +33 -0
- data/lib/fir-cli.output.rb +55 -0
- data/lib/fir-cli.utils.rb +105 -0
- data/lib/lagunitas.ext.rb +2 -2
- data/lib/lagunitas.patch.rb +2 -3
- metadata +26 -6
- data/lib/fir-cli.utils.ext.rb +0 -247
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffcd067aa56b7c3d830516808a6654e15fb31327
|
4
|
+
data.tar.gz: 394e53f52c3891e1de361f8b79f17836bdb410d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6b8bdee57e9e630937732c11f3755b992179709f9721e2f7aba3273793cce4a40d2370fbad8ad8f7591c0e1428276e5f2dd59d4f4ce95745e7cecd8019067d6
|
7
|
+
data.tar.gz: a59d788c74321a5b03c204e8896541e7757aa2d60fe8530fe2ecc3708983e97eb7dbe504221d5eb1b5739aa91e7724e5c7ebc8ecfd2f2cf6f46286c214f866e1
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fir-cli (0.2.
|
4
|
+
fir-cli (0.2.1.a)
|
5
5
|
highline (~> 1.6)
|
6
6
|
lagunitas (= 0.0.1)
|
7
7
|
paint (~> 0.9)
|
8
8
|
pngdefry (= 0.1.1)
|
9
9
|
rest_client (~> 1.8)
|
10
10
|
ruby_apk (~> 0.7)
|
11
|
+
rubyzip (~> 0.9.9)
|
11
12
|
thor (~> 0.19)
|
12
13
|
user_config (= 0.0.4)
|
13
14
|
|
data/README.md
CHANGED
@@ -2,49 +2,94 @@ FIR.im CLI
|
|
2
2
|
---
|
3
3
|
> FIR.im CLI 可以通过指令查看、上传、编译应用,同时还集成了第三方网站 [resign.tapbeta.com](http://resign.tapbeta.com) 进行企业签名以方便 inhouse 测试。
|
4
4
|
|
5
|
-
##
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
## 新指令 `build_ipa`
|
6
|
+
> 这个指令对 `xcodebuild` 这个原生指令进行了包装,将常用的参数名简化,同时支持全部的自带参数和设置。
|
7
|
+
|
8
|
+
### 编译并获得 ipa
|
9
|
+
|
10
|
+
```
|
11
|
+
$ fir build_ipa path/to/project -o path/to/output
|
12
|
+
> 欢迎使用 FIR.im 命令行工具,如需帮助请输入: fir help
|
13
|
+
> 正在编译
|
14
|
+
> 正在打包 app: demo.app 到 path/to/output/demo.ipa
|
15
|
+
> 完成
|
16
|
+
```
|
14
17
|
|
15
|
-
|
18
|
+
### 复杂一点
|
19
|
+
```
|
20
|
+
$ fir build_ipa path/to/workspace -o path/to/output -w -C Release -s allTargets GCC_PREPROCESSOR_DEFINITIONS="FOO=bar"
|
21
|
+
```
|
22
|
+
|
23
|
+
该指令在指向的目录中,找到第一个 workspace 文件,对其进行编译。使用 `Release` 设置,编译策略为 `allTargets`,同时设置了预编译参数 `FOO`。
|
24
|
+
|
25
|
+
### 一步,从源代码到 FIR.im
|
26
|
+
> 只需要多输入一个 -p
|
27
|
+
|
28
|
+
```
|
29
|
+
$ fir build_ipa path/to/project -p
|
30
|
+
> 欢迎使用 FIR.im 命令行工具,如需帮助请输入: fir help
|
31
|
+
> 正在编译
|
32
|
+
> 正在打包 app: demo.app 到 /var/folders/z7/7_cp03nx0535g0cd6ynfmxt80000gn/T/d20141218-13295-1oe0zlm/demo.ipa
|
33
|
+
> 完成
|
34
|
+
> 正在发布 demo.ipa
|
35
|
+
> 正在解析 ipa 文件...
|
36
|
+
> 正在获取 im.fir.demo@FIR.im 的应用信息...
|
37
|
+
> 上传应用...
|
38
|
+
> 上传应用成功
|
39
|
+
> 正在更新 fir 的应用信息...
|
40
|
+
> 更新成功
|
41
|
+
> 正在更新 fir 的应用版本信息...
|
42
|
+
> 更新成功
|
43
|
+
> 正在获取 im.fir.demo@FIR.im 的应用信息...
|
44
|
+
> http://fir.im/xxxx
|
45
|
+
```
|
46
|
+
|
47
|
+
## 使用入门
|
16
48
|
### 从安装入手
|
49
|
+
|
17
50
|
FIR.im CLI 使用 ruby 构建,只要安装相应 ruby gem 即可:
|
51
|
+
|
18
52
|
```shell
|
19
53
|
$ sudo gem install fir-cli
|
20
54
|
```
|
55
|
+
|
21
56
|
安装后,你可以在命令行执行指令
|
57
|
+
|
22
58
|
```shell
|
23
59
|
$ fir
|
24
60
|
> 欢迎使用 FIR.im 命令行工具,如需帮助请输入: fir help
|
25
61
|
Commands:
|
26
|
-
fir
|
27
|
-
fir
|
28
|
-
fir
|
29
|
-
fir
|
30
|
-
fir
|
31
|
-
fir
|
32
|
-
fir
|
62
|
+
fir build_ipa PATH [options] [settings] # 编译 ios app 项目
|
63
|
+
fir config # 配置全局设置
|
64
|
+
fir help [COMMAND] # Describe available commands or one specific command
|
65
|
+
fir info APP_FILE_PATH # 获取应用文件的信息(支持 ipa 文件和 apk 文件)
|
66
|
+
fir login # 登录
|
67
|
+
fir profile # 切换配置文件
|
68
|
+
fir publish APP_FILE_PATH # 将应用文件发布至 FIR.im(支持 ipa 文件和 apk 文件)
|
69
|
+
fir resign IPA_FILE_PATH OUTPUT_PATH # 使用 resign.tapbeta.com 进行企业签名
|
70
|
+
fir upgrade # 更新 fir-cli 的所有组件
|
71
|
+
fir version # 当前版本
|
33
72
|
```
|
34
73
|
|
35
74
|
### 发布一个应用
|
75
|
+
|
36
76
|
输入下面的指令便可轻松发布应用
|
77
|
+
|
37
78
|
```shell
|
38
79
|
$ fir publish 应用路径
|
39
80
|
```
|
81
|
+
|
40
82
|
这时系统会提示输入用户 token
|
83
|
+
|
41
84
|
```shell
|
42
85
|
> 欢迎使用 FIR.im 命令行工具,如需帮助请输入: fir help
|
43
86
|
> 正在解析 ipa 文件...
|
44
87
|
> 正在获取 im.fir.juo@FIR.im 的应用信息...
|
45
88
|
请输入用户 token:
|
46
89
|
```
|
90
|
+
|
47
91
|
输入用户 token 后,系统会自动上传
|
92
|
+
|
48
93
|
```shell
|
49
94
|
请输入用户 token:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
50
95
|
> 上传应用...
|
@@ -59,12 +104,15 @@ $ fir publish 应用路径
|
|
59
104
|
用户 token 可在[这里](http://fir.im/user/info)查看
|
60
105
|
|
61
106
|
### 方便一点
|
107
|
+
|
62
108
|
如果觉得每次都输入用户 token 很不方便,那么可使用登录命令
|
63
109
|
|
64
110
|
```shell
|
65
111
|
$ fir login
|
66
112
|
```
|
113
|
+
|
67
114
|
这时系统会提示输入用户 token
|
115
|
+
|
68
116
|
```shell
|
69
117
|
> 欢迎使用 FIR.im 命令行工具,如需帮助请输入: fir help
|
70
118
|
输入你的用户 token:
|
@@ -78,12 +126,15 @@ $ fir login
|
|
78
126
|
|
79
127
|
|
80
128
|
### 需要企业签名?
|
129
|
+
|
81
130
|
很多开发者需要一个企业签名的应用,来让更多的用户参与到测试中,这种行为并不符合企业证书的使用规范。但是我们还是集成了第三方签名网站 [resign.tapbeta.com](http://resign.tapbeta.com) 来帮助我们的用户更方便的进行测试。
|
82
131
|
|
83
132
|
```shell
|
84
133
|
$ fir resign ipa文件路径 输出文件路径
|
85
134
|
```
|
135
|
+
|
86
136
|
这条指令会输出一段风险提示;如果没有设置邮件地址,这里会让你输入邮件地址。输入邮件地址后,便开始进行企业签名了
|
137
|
+
|
87
138
|
```
|
88
139
|
> 欢迎使用 FIR.im 命令行工具,如需帮助请输入: fir help
|
89
140
|
! resign.tapbeta.com 签名服务风险提示
|
@@ -103,110 +154,42 @@ $ fir resign ipa文件路径 输出文件路径
|
|
103
154
|
|
104
155
|
|
105
156
|
### 一步到位
|
106
|
-
企业签名后自动发布到 [FIR.im](http://fir.im)
|
107
|
-
```shell
|
108
|
-
$ fir publish ipa文件路径 -r
|
109
|
-
```
|
110
157
|
|
111
|
-
|
112
|
-
输入以下指令获取全面功能介绍
|
113
|
-
```shell
|
114
|
-
$ fir help
|
115
|
-
```
|
116
|
-
如果还有疑问随时发邮件至[fir-cli](mailto:fir-cli@fir.im)
|
117
|
-
|
118
|
-
### 永远使用最新功能
|
119
|
-
下面的指令会自动更新 fir-cli 及所有扩展命令至最新状态
|
120
|
-
```shell
|
121
|
-
$ fir upgrade
|
122
|
-
```
|
123
|
-
随时更新以使用最新功能
|
124
|
-
|
125
|
-
## 指令文档
|
126
|
-
### 帮助
|
127
|
-
> 以下指令用于获取帮助
|
128
|
-
|
129
|
-
```shell
|
130
|
-
fir help
|
131
|
-
```
|
132
|
-
|
133
|
-
> 以下指令用于获取更具体的帮助
|
134
|
-
|
135
|
-
- `COMMAND`:具体的一个指令,如`publish`,`update`
|
136
|
-
```shell
|
137
|
-
fir help COMMAND
|
138
|
-
```
|
139
|
-
|
140
|
-
### 切换配置文件
|
141
|
-
> 以下指令用于切换配置文件,一个用户可以拥有多个配置文件。用户所有全局设置都跟随配置文件的切换而变化
|
142
|
-
|
143
|
-
- `-d` 删除指定配置文件
|
144
|
-
```shell
|
145
|
-
fir profile PROFILE [-d]
|
146
|
-
```
|
147
|
-
|
148
|
-
### 登录
|
149
|
-
> 以下指令用于登录,登录后系统会从 FIR.im 自动获取你的邮件等信息。已登录用户在[这里](http://fir.im/user/info)可以找到自己的用户 token。
|
158
|
+
企业签名后自动发布到 [FIR.im](http://fir.im)
|
150
159
|
|
151
160
|
```shell
|
152
|
-
fir
|
161
|
+
$ fir publish ipa文件路径 -r
|
153
162
|
```
|
154
|
-
### 设置全局信息
|
155
|
-
> 以下指令用于全局设置。执行指令时如果不指明相应选项,会读取全局设置。
|
156
163
|
|
157
|
-
|
158
|
-
- `--resign`:见`第三方企业证书签名服务`
|
159
|
-
- `--email=EMAIL`:见`第三方企业证书签名服务`
|
160
|
-
- `--verbose=v|vv|vvv`:见`控制输出参数`
|
161
|
-
- `--quiet` 与 `--no-quiet`:见`控制输出参数`
|
162
|
-
- `--color` 与 `--no-color`:见`控制输出参数`
|
163
|
-
```shell
|
164
|
-
fir config [options]
|
165
|
-
```
|
164
|
+
## 需要帮助?
|
166
165
|
|
167
|
-
|
168
|
-
> 以下指令用于显示应用信息,支持 ipa 和 apk 文件。
|
166
|
+
输入以下指令获取全面功能介绍
|
169
167
|
|
170
|
-
- `--all` 与 `--no-all`:可选,现实全部信息
|
171
|
-
- `--fir` 与 `--no-fir`:可选,显示托管在 [FIR.im](http://fir.im) 的信息
|
172
168
|
```shell
|
173
|
-
fir
|
169
|
+
$ fir help
|
174
170
|
```
|
175
171
|
|
172
|
+
如果还有疑问随时发邮件至[fir-cli](mailto:fir-cli@fir.im)
|
176
173
|
|
174
|
+
## 永远使用最新功能
|
177
175
|
|
178
|
-
|
179
|
-
> 以下指令使用 [resign.tapbeta.com](http://resign.tapbeta.com) 进行企业证书签名
|
180
|
-
|
181
|
-
- `INPUT_IPA_PATH`:待签名的 ipa 文件路径
|
182
|
-
- `OUTPUT_IPA_PATH`:签名后的输出文件路径
|
183
|
-
- `--email=EMAIL`:可选,设置使用签名服务的邮件地址
|
184
|
-
```shell
|
185
|
-
fir resign INTPUT_IPA_FILE OUTPUT_IPA_FILE [--email=EMAIL]
|
186
|
-
```
|
187
|
-
|
188
|
-
### 发布应用至 [FIR.im](http://fir.im)
|
189
|
-
> 以下指令用于发布应用到 [FIR.im](http://fir.im),支持 ipa 和 apk 文件。
|
176
|
+
下面的指令会自动更新 fir-cli 及所有扩展命令至最新状态
|
190
177
|
|
191
|
-
- `--resign` 与 `--no-resign`:可选,此开关控制是否使用第三方企业签名服务,仅支持 ipa 文件
|
192
|
-
- `--short=SHORT`:可选,指定发布应用的短地址
|
193
|
-
- `--token=USER_TOKEN`:可选,设定发布应用的帐号,未设置则使用全局设置
|
194
|
-
- `--changelog=CHANGE_LOG`:可选,设置更新日志
|
195
178
|
```shell
|
196
|
-
fir
|
179
|
+
$ fir upgrade
|
197
180
|
```
|
198
181
|
|
199
|
-
|
200
|
-
> 以下指令用于更新已安装的 fir-cli 指令集
|
201
|
-
|
202
|
-
```shell
|
203
|
-
fir upgrade
|
204
|
-
```
|
182
|
+
随时更新以使用最新功能
|
205
183
|
|
206
|
-
|
207
|
-
|
208
|
-
|
184
|
+
## 更新记录
|
185
|
+
### FIR-cli 0.2.0
|
186
|
+
- 新指令 `build_ipa`
|
209
187
|
|
210
|
-
-
|
211
|
-
-
|
212
|
-
-
|
188
|
+
### FIR-cli 0.1.8
|
189
|
+
- 支持 ruby 1.9.x
|
190
|
+
- 规范输出参数选项,支持无颜色信息输出
|
191
|
+
-`--verbose=v|vv|vvv`:设置输出级别
|
192
|
+
-`--quiet` 与 `--no-quiet`:设置是否不输出辅助信息
|
193
|
+
-`--color` 与 `--no-color`:设置输出是否携带颜色信息
|
194
|
+
- 修复 ipa 应用图标不清晰问题
|
195
|
+
- 增加切换配置文件功能:使用此功能可以在多个用户中切换使用
|
data/fir-cli.gemspec
CHANGED
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_dependency 'thor', '~> 0.19'
|
28
28
|
s.add_dependency 'ruby_apk', '~> 0.7'
|
29
29
|
s.add_dependency 'highline', '~> 1.6'
|
30
|
+
s.add_dependency 'rubyzip', '~> 0.9.9'
|
30
31
|
|
31
32
|
s.add_development_dependency "bundler", "~> 1.7"
|
32
33
|
s.add_development_dependency "rake", "~> 10.0"
|
data/fir-cli.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'uri'
|
2
3
|
require 'json'
|
3
4
|
require 'pathname'
|
@@ -13,6 +14,10 @@ require 'lagunitas'
|
|
13
14
|
require 'ruby_apk'
|
14
15
|
require 'highline/import'
|
15
16
|
|
17
|
+
require 'zip'
|
18
|
+
require 'zip/zip'
|
19
|
+
|
20
|
+
|
16
21
|
module Fir
|
17
22
|
class Cli < Thor; end
|
18
23
|
end
|
data/lib/fir-cli/version.rb
CHANGED
@@ -7,12 +7,12 @@ module Fir
|
|
7
7
|
token = _prompt_secret('输入你的用户 token:')
|
8
8
|
if token.empty?
|
9
9
|
_puts_require_token
|
10
|
-
|
10
|
+
_exit
|
11
11
|
end
|
12
12
|
user = _user token
|
13
13
|
if !user
|
14
14
|
_puts_invalid_token
|
15
|
-
|
15
|
+
_exit
|
16
16
|
end
|
17
17
|
if _opt_token && _opt_token != token
|
18
18
|
_puts "> 已登陆用户: #{_opt_token}"
|
@@ -7,7 +7,7 @@ module Fir
|
|
7
7
|
def profile(prof)
|
8
8
|
if prof == 'global'
|
9
9
|
_puts '! 不能使用 global 作为配置文件名'
|
10
|
-
|
10
|
+
_exit
|
11
11
|
end
|
12
12
|
prof = "#{prof}.yaml"
|
13
13
|
if options[:delete]
|
@@ -16,7 +16,7 @@ module Fir
|
|
16
16
|
else
|
17
17
|
if _profile == prof
|
18
18
|
_puts "! #{Paint["你正在使用该配置:#{prof}", :red]}"
|
19
|
-
|
19
|
+
_exit
|
20
20
|
end
|
21
21
|
_puts "> 正在使用配置文件:#{_profile}"
|
22
22
|
_puts "> 即将替换为:#{prof}"
|
@@ -7,20 +7,9 @@ module Fir
|
|
7
7
|
option :resign, :aliases => '-r', :desc => '是否以企业签名发布 ios 应用', :type => :boolean
|
8
8
|
option :publish, :aliases => '-p', :desc => '编译打包自动发布至 FIR.im', :type => :boolean
|
9
9
|
output_options
|
10
|
-
def config
|
11
|
-
|
12
|
-
options.each do |option|
|
13
|
-
_puts "> #{Paint[option[0].to_s.rjust(10), :blue]} : #{@config[option[0].to_s]} => #{option[1]}"
|
14
|
-
@config[option[0].to_s] = option[1]
|
15
|
-
end
|
16
|
-
if @config['token'] && !_user(@config['token'])
|
17
|
-
_puts_invalid_token
|
18
|
-
exit 1
|
19
|
-
end
|
20
|
-
@config.save
|
21
|
-
end
|
10
|
+
def config(*args)
|
11
|
+
_set_config options.merge _convert_settings *args
|
22
12
|
_puts '> 设置完成,您现在使用的设置是'
|
23
|
-
@config.save
|
24
13
|
@config.each { |conf| _puts "> #{Paint[conf[0].to_s.rjust(10), :blue]} => #{conf[1]}" }
|
25
14
|
end
|
26
15
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
module Fir
|
3
|
+
class Cli
|
4
|
+
def self.resign_local_options
|
5
|
+
option :mobile_provision,
|
6
|
+
:aliases => '-m'
|
7
|
+
option :sign,
|
8
|
+
:aliases => '-s'
|
9
|
+
end
|
10
|
+
desc 'resign_codesign IPA_FILE_PATH OUTPUT_PATH', '使用 codesign 指令进行签名'
|
11
|
+
resign_local_options
|
12
|
+
output_options
|
13
|
+
def resign_codesign(ipath, opath)
|
14
|
+
_chk_os! 'mac'
|
15
|
+
_chk_opt! :mobile_provision, :sign
|
16
|
+
mp_path, sign_name = _opt :mobile_provision, :sign
|
17
|
+
mp_path = _path mp_path
|
18
|
+
ipath = _path ipath
|
19
|
+
opath = _path opath
|
20
|
+
opath += '.ipa' if !opath.to_s.end_with? '.ipa'
|
21
|
+
_edit(ipath, opath) do |_d|
|
22
|
+
Dir.chdir(_d) do
|
23
|
+
apps = Dir['Payload/*.app']
|
24
|
+
if apps.length != 1
|
25
|
+
_puts "! #{Paint['输入文件不是一个合法的 ipa 文件', :red]}"
|
26
|
+
_exit
|
27
|
+
end
|
28
|
+
app = apps[0]
|
29
|
+
_puts "> 替换 mobile provision"
|
30
|
+
mp_dest_path = "#{app}/embedded.mobileprovision"
|
31
|
+
File.unlink mp_dest_path if File.file? mp_dest_path
|
32
|
+
FileUtils.cp mp_path, mp_dest_path
|
33
|
+
frmwrk_dir = "#{app}/Frameworks"
|
34
|
+
if File.directory? frmwrk_dir
|
35
|
+
_puts "> 重签名 dylibs"
|
36
|
+
Dir["#{frmwrk_dir}/*.dylib"].each do |_dylib|
|
37
|
+
_exec "codesign -f -s \"#{sign_name}\""
|
38
|
+
end
|
39
|
+
end
|
40
|
+
# Dir["Payload/#{app}/*.nib"].each do |_nib|
|
41
|
+
# _exec "codesign -f -s \"#{sign_name}\"
|
42
|
+
# end
|
43
|
+
# cs_dir = "Payload/#{app}/_CodeSignature"
|
44
|
+
# cr_dir = "Payload/#{app}/CodeResources"
|
45
|
+
# Dir.rmdir cs_dir if File.directory? cs_dir
|
46
|
+
# Dir.rmdir cr_dir if File.directory? cr_dir
|
47
|
+
_puts "> 重签名 #{app}"
|
48
|
+
_exec "codesign -f -s \"#{sign_name}\" \"#{app}\" --deep"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
module Fir
|
3
3
|
class Cli
|
4
|
-
def self.
|
4
|
+
def self.resign_tapbeta_options
|
5
5
|
option :email, :aliases => '-e', :desc => '邮件地址'
|
6
6
|
end
|
7
|
-
desc '
|
8
|
-
|
7
|
+
desc 'resign_tapbeta IPA_FILE_PATH OUTPUT_PATH', '使用 resign.tapbeta.com 进行企业签名'
|
8
|
+
resign_tapbeta_options
|
9
9
|
output_options
|
10
|
-
def
|
10
|
+
def resign_tapbeta(ipath, opath)
|
11
11
|
_puts "! #{Paint['resign.tapbeta.com 签名服务风险提示', :red]}"
|
12
12
|
_puts '! tapbeta 无法保证签名证书的长期有效性,苹果随时可'
|
13
13
|
_puts '! 能封杀他们的企业账号,所有由这个企业账号签发的证'
|
@@ -21,15 +21,15 @@ module Fir
|
|
21
21
|
_puts "! #{Paint['你需要提供邮件地址才能使用 resign.tapbeta.com 的', :red]}"
|
22
22
|
_puts "! #{Paint['签名服务, 请使用', :red]} fir config --email=EMAIL #{Paint['进行设', :red]}"
|
23
23
|
_puts "! #{Paint['置', :red]}"
|
24
|
-
|
25
|
-
elsif !_is_email @email
|
24
|
+
_exit
|
25
|
+
elsif !_is_email? @email
|
26
26
|
_puts_invalid_email
|
27
|
-
|
27
|
+
_exit
|
28
28
|
end
|
29
29
|
end
|
30
|
-
if !_is_ipa ipath
|
30
|
+
if !_is_ipa? ipath
|
31
31
|
_puts "! #{Paint['只能给以 ipa 为扩展名的文件签名', :red]}"
|
32
|
-
|
32
|
+
_exit
|
33
33
|
end
|
34
34
|
_puts '> 正在申请上传令牌...'
|
35
35
|
upload_res = RestClient.post 'http://api.resign.tapbeta.com/public/upload',
|
@@ -66,10 +66,10 @@ module Fir
|
|
66
66
|
end
|
67
67
|
if info[:status] == 'error'
|
68
68
|
_puts "! #{Paint['签名失败', :red]}"
|
69
|
-
|
69
|
+
_exit
|
70
70
|
elsif info[:status] == 'timeout'
|
71
71
|
_puts "! #{Paint['签名超时', :red]}"
|
72
|
-
|
72
|
+
_exit
|
73
73
|
end
|
74
74
|
break if info[:url] != ''
|
75
75
|
sleep 5
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
module Fir
|
3
|
+
class Cli
|
4
|
+
def self.resign_options
|
5
|
+
option :resign_type,
|
6
|
+
:desc => '选择使用哪种方式进行重签名,默认使用 tapbeta'
|
7
|
+
resign_tapbeta_options
|
8
|
+
resign_local_options
|
9
|
+
end
|
10
|
+
desc 'resign ORIGINAL_IPA OUTPUT_IPA [--resign-type=codesign]', '使用指定类型的签名方式'
|
11
|
+
resign_options
|
12
|
+
output_options
|
13
|
+
def resign(ipath, opath)
|
14
|
+
if !options[:resign_type]
|
15
|
+
resign_tapbeta ipath, opath
|
16
|
+
else
|
17
|
+
begin
|
18
|
+
method("resign_#{options[:resign_type]}".to_sym).call ipath, opath
|
19
|
+
rescue NameError => e
|
20
|
+
_puts "! #{Paint["没有 resign_#{options[:resign_type]} 的重签名方式"]}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -12,7 +12,7 @@ module Fir
|
|
12
12
|
resign_options
|
13
13
|
output_options
|
14
14
|
def publish(path)
|
15
|
-
if _opt_resign && _is_ipa(path)
|
15
|
+
if _opt_resign && _is_ipa?(path)
|
16
16
|
tfile = Tempfile.new ["resign-#{SecureRandom.hex}", '.ipa']
|
17
17
|
resign path, tfile.path
|
18
18
|
path = tfile.path
|
@@ -27,7 +27,7 @@ module Fir
|
|
27
27
|
if app[:icons] != nil && app[:icons].length > 0
|
28
28
|
icon_path = app[:icons][0][:path]
|
29
29
|
|
30
|
-
if _is_ipa path
|
30
|
+
if _is_ipa? path
|
31
31
|
_puts '> 转换图标...'
|
32
32
|
Pngdefry.defry icon_path, icon_path
|
33
33
|
end
|
@@ -67,7 +67,7 @@ module Fir
|
|
67
67
|
|
68
68
|
# Get updated app info
|
69
69
|
fir_app = _fir_info app[:identifier]
|
70
|
-
_puts "> #{
|
70
|
+
_puts "> #{_fir_url}/#{fir_app[:short]}"
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
@@ -13,19 +13,16 @@ module Fir
|
|
13
13
|
publish_options
|
14
14
|
output_options
|
15
15
|
def build_ipa(path, *args)
|
16
|
-
|
17
|
-
_puts "! #{Paint['不支持在非 mac 系统上编译打包', :red]}"
|
18
|
-
exit 1
|
19
|
-
end
|
16
|
+
_chk_os! 'mac'
|
20
17
|
settings = _convert_settings *args
|
21
18
|
|
22
19
|
path = _path(path).to_s
|
23
|
-
project_dir = (
|
20
|
+
project_dir = (File.directory? path) ? path : (File.dirname path)
|
24
21
|
|
25
22
|
ipa_path = _path(options[:output]).to_s if options[:output]
|
26
23
|
if !ipa_path && !_opt_publish
|
27
24
|
_puts "! #{Paint['如果不发布到 FIR.im,则需要指定 ipa 文件的输出路径', :red]}"
|
28
|
-
|
25
|
+
_exit
|
29
26
|
end
|
30
27
|
if !ipa_path
|
31
28
|
Dir.mktmpdir do |_d|
|
@@ -38,9 +35,9 @@ module Fir
|
|
38
35
|
_build_ipa project_dir, settings, options,
|
39
36
|
:ipa_path => ipa_path
|
40
37
|
return if !_opt_publish
|
41
|
-
if
|
38
|
+
if File.directory? ipa_path
|
42
39
|
_batch_publish ipa_path
|
43
|
-
elsif File.
|
40
|
+
elsif File.file? ipa_path
|
44
41
|
publish ipa_path
|
45
42
|
end
|
46
43
|
end
|
@@ -73,23 +70,23 @@ module Fir
|
|
73
70
|
[_setstr, _argstr, _opts]
|
74
71
|
end
|
75
72
|
project = begin
|
76
|
-
if _is_xcodeproject project_dir
|
73
|
+
if _is_xcodeproject? project_dir
|
77
74
|
project_dir
|
78
|
-
elsif _is_workspace project_dir
|
75
|
+
elsif _is_workspace? project_dir
|
79
76
|
opts[:workspace] = true
|
80
77
|
project_dir
|
81
78
|
elsif opts[:workspace]
|
82
79
|
_spaces = Dir["#{project_dir}/*.xcworkspace"]
|
83
80
|
if _spaces.length == 0
|
84
81
|
_puts "! #{Paint['指定目录中找不到 workspace 文件,无法编译', :red]}"
|
85
|
-
|
82
|
+
_exit
|
86
83
|
end
|
87
84
|
_spaces[0]
|
88
85
|
else
|
89
86
|
_projs = Dir["#{project_dir}/*.xcodeproj"]
|
90
87
|
if _projs.length == 0
|
91
88
|
_puts "! #{Paint['指定目录中找不到 project 文件,无法编译', :red]}"
|
92
|
-
|
89
|
+
_exit
|
93
90
|
else
|
94
91
|
_projs[0]
|
95
92
|
end
|
@@ -101,7 +98,7 @@ module Fir
|
|
101
98
|
if opts[:workspace]
|
102
99
|
unless opts[:scheme]
|
103
100
|
_puts "! #{Paint['如果编译 workspace, 则必须指定一个 scheme', :red]}"
|
104
|
-
|
101
|
+
_exit
|
105
102
|
end
|
106
103
|
argstr += " -workspace \"#{project}\" -scheme \"#{opts[:scheme]}\""
|
107
104
|
else
|
@@ -118,17 +115,17 @@ module Fir
|
|
118
115
|
apps = Dir['*.app']
|
119
116
|
if opts[:ipa_path]
|
120
117
|
ipa_path = opts[:ipa_path]
|
121
|
-
if
|
118
|
+
if File.directory? ipa_path
|
122
119
|
apps.each do |app|
|
123
120
|
_ipa_path = File.join ipa_path, "#{File.basename app, '.app'}.ipa"
|
124
121
|
_zip_ipa File.join(_d, app), _ipa_path
|
125
122
|
end
|
126
123
|
elsif apps.length > 1
|
127
124
|
_puts "! #{Paint['项目编译输出了多个 app,需要指定一个已经存在的目录作为输出目录', :red]}"
|
128
|
-
|
125
|
+
_exit
|
129
126
|
elsif apps.length == 0
|
130
127
|
_puts "! #{Paint['项目编译没有输出 app,无法打包 ipa', :red]}"
|
131
|
-
|
128
|
+
_exit
|
132
129
|
else
|
133
130
|
ipa_path += '.ipa' unless ipa_path.end_with? '.ipa'
|
134
131
|
_zip_ipa File.join(_d, apps[0]), ipa_path
|
@@ -143,7 +140,7 @@ module Fir
|
|
143
140
|
Dir.chdir(_d) do
|
144
141
|
Dir.mkdir "Payload"
|
145
142
|
FileUtils.cp_r app_path, 'Payload'
|
146
|
-
if File.
|
143
|
+
if File.file? ipa_path
|
147
144
|
_puts "> 删除已有文件 #{ipa_path}"
|
148
145
|
_exec "rm -r #{ipa_path}"
|
149
146
|
end
|