fir-cli 1.0.8 → 1.1.0
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/CHANGELOG +4 -0
- data/README.md +2 -0
- data/fir-cli.gemspec +4 -17
- data/lib/fir/api.yml +5 -5
- data/lib/fir/util/info.rb +7 -8
- data/lib/fir/util/login.rb +1 -1
- data/lib/fir/util/publish.rb +56 -47
- data/lib/fir/util.rb +1 -2
- data/lib/fir/version.rb +1 -1
- data/lib/fir.rb +29 -11
- metadata +5 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f5d2beedaa3955abe679d71ccdae111fcdbe595
|
4
|
+
data.tar.gz: 86c4a61744d18c11768ea6c23a0b291187752be2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 523e663b825492d85a365b092850e1611b9009ee7932785c33e9029f8341a7bb649ee2dcc2cf9b3ff90bb7d989fc4a9638b8a98a42293715266a9bea08f3eb16
|
7
|
+
data.tar.gz: bc436021c8798abd0115c385f8ad87d8093af4e90814954f74bfd940088dab1f925c5052c3d9897276274dfd82d61cfaa379db5307292233fb9b863bc061cdc9
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
FIR.im CLI
|
2
2
|
---
|
3
|
+
|
4
|
+
[](https://gitter.im/FIRHQ/fir-cli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
3
5
|
> FIR.im CLI 可以通过指令查看, 上传, 编译应用
|
4
6
|
|
5
7
|
## 使用入门
|
data/fir-cli.gemspec
CHANGED
@@ -28,23 +28,10 @@ Gem::Specification.new do |spec|
|
|
28
28
|
/_/ /___/_/ |_| \____/_____/___/
|
29
29
|
|
30
30
|
## 更新记录
|
31
|
-
### FIR-CLI 1.0
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
- 增加全局参数, -T, -L, -V, -q, -h, 分别为 token, log, verbose, quite, help 参数
|
36
|
-
- 增加输出 log
|
37
|
-
- 修正部分系统安装失败问题
|
38
|
-
- 修正部分服务器安装出现编码失败问题
|
39
|
-
- 修正 ipa 路径带有空格解析失败的 bug
|
40
|
-
- 重写 ipa 解析器, 去除 `miniz.c`, 增加 pngcrash
|
41
|
-
- 上传 ipa 时, 优先取 `display_name` 作为应用名称
|
42
|
-
- build_ipa 增加默认 build 路径, `fir b` 则默认 build 当前路径
|
43
|
-
- build_ipa 增加输出 dSYM 符号表文件
|
44
|
-
- build_ipa 增加输出指定 ipa 名称
|
45
|
-
- build_ipa 增加输出 xcodebuild 的信息
|
46
|
-
- 去掉输出信息颜色, 方便查看 log
|
47
|
-
- 简化 --verbose 参数, 简化为 `--verbose --no-verbose`, 默认输出为 INFO
|
31
|
+
### FIR-CLI 1.1.0
|
32
|
+
- 完全兼容新版 API ✔
|
33
|
+
- 请使用新版 API Token
|
34
|
+
- 新版 API Token 查看地址: `http://fir.im/user/info`
|
48
35
|
- https://github.com/FIRHQ/fir-cli
|
49
36
|
)
|
50
37
|
|
data/lib/fir/api.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
domain: 'http://fir.im'
|
2
|
+
base_url: 'http://api.fir.im'
|
3
|
+
user_url: 'http://api.fir.im/user'
|
4
|
+
app_url: 'http://api.fir.im/apps'
|
5
|
+
udids_url: 'http://api.fir.im/devices/multi_udid'
|
data/lib/fir/util/info.rb
CHANGED
@@ -27,8 +27,8 @@ module FIR
|
|
27
27
|
identifier: app.identifier,
|
28
28
|
name: app.name,
|
29
29
|
display_name: app.display_name,
|
30
|
-
|
31
|
-
|
30
|
+
build: app.version,
|
31
|
+
version: app.short_version,
|
32
32
|
devices: app.devices,
|
33
33
|
release_type: app.release_type || ipa.release_type,
|
34
34
|
distribution_name: app.distribution_name
|
@@ -55,11 +55,11 @@ module FIR
|
|
55
55
|
def apk_info apk_path, is_all
|
56
56
|
apk = Android::Apk.new(apk_path)
|
57
57
|
info = {
|
58
|
-
type:
|
59
|
-
identifier:
|
60
|
-
name:
|
61
|
-
|
62
|
-
|
58
|
+
type: 'android',
|
59
|
+
identifier: apk.manifest.package_name,
|
60
|
+
name: apk.label,
|
61
|
+
build: apk.manifest.version_code,
|
62
|
+
version: apk.manifest.version_name
|
63
63
|
}
|
64
64
|
|
65
65
|
# apk.icon is a hash, { icon_name: icon_data }
|
@@ -74,6 +74,5 @@ module FIR
|
|
74
74
|
|
75
75
|
info
|
76
76
|
end
|
77
|
-
|
78
77
|
end
|
79
78
|
end
|
data/lib/fir/util/login.rb
CHANGED
@@ -9,7 +9,7 @@ module FIR
|
|
9
9
|
user_info = fetch_user_info(token)
|
10
10
|
|
11
11
|
logger.info "Login succeed, previous user's email: #{config[:email]}" unless config.blank?
|
12
|
-
write_config(email: user_info.fetch(:email, ''), token:
|
12
|
+
write_config(email: user_info.fetch(:email, ''), token: token)
|
13
13
|
reload_config
|
14
14
|
logger.info "Login succeed, current user's email: #{config[:email]}"
|
15
15
|
end
|
data/lib/fir/util/publish.rb
CHANGED
@@ -15,88 +15,97 @@ module FIR
|
|
15
15
|
logger.info "Publishing app......."
|
16
16
|
logger_info_dividing_line
|
17
17
|
|
18
|
-
file_type
|
19
|
-
app_info
|
20
|
-
|
18
|
+
file_type = File.extname(file_path).delete(".")
|
19
|
+
@app_info = send("#{file_type}_info", file_path, true)
|
20
|
+
|
21
|
+
uploading_info = fetch_uploading_info(type: @app_info[:type],
|
22
|
+
bundle_id: @app_info[:identifier],
|
23
|
+
api_token: token)
|
21
24
|
|
22
25
|
app_id = uploading_info[:id]
|
23
|
-
|
24
|
-
|
26
|
+
icon_cert = uploading_info[:cert][:icon]
|
27
|
+
binary_cert = uploading_info[:cert][:binary]
|
25
28
|
|
26
|
-
unless app_info[:icons].
|
27
|
-
large_icon_path = app_info[:icons].max_by { |f| File.size(f) }
|
29
|
+
unless @app_info[:icons].blank?
|
30
|
+
large_icon_path = @app_info[:icons].max_by { |f| File.size(f) }
|
28
31
|
uncrushed_icon_path = convert_icon(large_icon_path)
|
29
|
-
upload_app_icon(
|
32
|
+
upload_app_icon(icon_cert, uncrushed_icon_path)
|
30
33
|
end
|
31
34
|
|
32
|
-
uploaded_info =
|
33
|
-
version_id = uploaded_info[:versionOid]
|
34
|
-
short = options[:short].blank? ? uploading_info[:short] : options[:short]
|
35
|
-
|
36
|
-
update_app_info(app_id, name: app_info[:display_name] || app_info[:name],
|
37
|
-
short: short,
|
38
|
-
token: token,
|
39
|
-
source: 'fir-cli')
|
40
|
-
update_app_version_info(version_id, version: app_info[:version],
|
41
|
-
versionShort: app_info[:short_version],
|
42
|
-
devices: app_info[:devices],
|
43
|
-
release_type: app_info[:release_type],
|
44
|
-
changelog: changelog,
|
45
|
-
token: token)
|
46
|
-
published_app_info = fetch_app_info(app_id, token)
|
35
|
+
uploaded_info = upload_app_binary(binary_cert, file_path, changelog)
|
47
36
|
|
48
|
-
|
49
|
-
|
37
|
+
if uploaded_info[:is_completed]
|
38
|
+
unless @app_info[:devices].blank?
|
39
|
+
upload_device_info(key: binary_cert[:key],
|
40
|
+
udids: @app_info[:devices].join(","),
|
41
|
+
api_token: token)
|
42
|
+
end
|
43
|
+
|
44
|
+
unless options[:short].blank?
|
45
|
+
update_app_info(app_id, short: options[:short], api_token: token)
|
46
|
+
end
|
47
|
+
|
48
|
+
published_app_info = fetch_app_info(app_id, api_token: token)
|
49
|
+
|
50
|
+
logger_info_dividing_line
|
51
|
+
logger.info "Published succeed: #{api[:domain]}/#{published_app_info[:short]}"
|
52
|
+
end
|
50
53
|
end
|
51
54
|
|
52
55
|
private
|
53
56
|
|
54
57
|
def convert_icon origin_path
|
55
58
|
logger.info "Converting app's icon......"
|
56
|
-
output_path = Tempfile.new(
|
59
|
+
output_path = Tempfile.new("uncrushed_icon.png").path
|
57
60
|
Parser.uncrush_icon(origin_path, output_path)
|
58
61
|
File.size(output_path) == 0 ? origin_path : output_path
|
59
62
|
end
|
60
63
|
|
61
|
-
def upload_app_icon
|
64
|
+
def upload_app_icon icon_cert, icon_path
|
62
65
|
logger.info "Uploading app's icon......"
|
63
66
|
hash = {
|
64
|
-
key:
|
65
|
-
token:
|
66
|
-
file: File.new(icon_path,
|
67
|
+
key: icon_cert[:key],
|
68
|
+
token: icon_cert[:token],
|
69
|
+
file: File.new(icon_path, "rb")
|
67
70
|
}
|
68
|
-
post
|
71
|
+
post icon_cert[:upload_url], hash
|
69
72
|
end
|
70
73
|
|
71
|
-
def
|
74
|
+
def upload_app_binary binary_cert, file_path, changelog
|
72
75
|
logger.info "Uploading app......"
|
73
76
|
hash = {
|
74
|
-
key:
|
75
|
-
token:
|
76
|
-
file: File.new(file_path,
|
77
|
+
key: binary_cert[:key],
|
78
|
+
token: binary_cert[:token],
|
79
|
+
file: File.new(file_path, "rb"),
|
80
|
+
# Custom variables
|
81
|
+
"x:name" => @app_info[:display_name] || @app_info[:name],
|
82
|
+
"x:build" => @app_info[:build],
|
83
|
+
"x:version" => @app_info[:version],
|
84
|
+
"x:changelog" => changelog,
|
85
|
+
"x:release_type" => @app_info[:release_type],
|
77
86
|
}
|
78
|
-
post
|
87
|
+
post binary_cert[:upload_url], hash
|
88
|
+
end
|
89
|
+
|
90
|
+
def upload_device_info hash
|
91
|
+
logger.info "Updating devices info......"
|
92
|
+
post api[:udids_url], hash
|
79
93
|
end
|
80
94
|
|
81
95
|
def update_app_info id, hash
|
82
96
|
logger.info "Updating app info......"
|
83
|
-
|
97
|
+
patch api[:app_url] + "/#{id}", hash
|
84
98
|
end
|
85
99
|
|
86
|
-
def
|
87
|
-
logger.info "
|
88
|
-
put api[:version_url] + "/#{id}/complete?#{URI.encode_www_form hash}", hash
|
89
|
-
end
|
100
|
+
def fetch_uploading_info hash
|
101
|
+
logger.info "Fetching #{@app_info[:identifier]}@FIR.im uploading info......"
|
90
102
|
|
91
|
-
|
92
|
-
logger.info "Fetching #{app_info[:identifier]}@FIR.im uploading info......"
|
93
|
-
get api[:uploading_info_url] + "/#{app_info[:identifier]}", type: app_info[:type],
|
94
|
-
token: token
|
103
|
+
post api[:app_url], hash
|
95
104
|
end
|
96
105
|
|
97
|
-
def fetch_app_info id,
|
106
|
+
def fetch_app_info id, hash
|
98
107
|
logger.info "Fetch app info from FIR.im"
|
99
|
-
get api[:app_url] + "/#{id}",
|
108
|
+
get api[:app_url] + "/#{id}", hash
|
100
109
|
end
|
101
110
|
end
|
102
111
|
end
|
data/lib/fir/util.rb
CHANGED
@@ -19,7 +19,7 @@ module FIR
|
|
19
19
|
module ClassMethods
|
20
20
|
|
21
21
|
def fetch_user_info token
|
22
|
-
get api[:
|
22
|
+
get api[:user_url], api_token: token
|
23
23
|
end
|
24
24
|
|
25
25
|
def check_supported_file path
|
@@ -40,6 +40,5 @@ module FIR
|
|
40
40
|
logger.info "✈ -------------------------------------------- ✈"
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
44
43
|
end
|
45
44
|
end
|
data/lib/fir/version.rb
CHANGED
data/lib/fir.rb
CHANGED
@@ -54,34 +54,52 @@ module FIR
|
|
54
54
|
|
55
55
|
def get url, params = {}
|
56
56
|
begin
|
57
|
-
res = RestClient.get(url, params: params)
|
58
|
-
rescue
|
59
|
-
logger.error e.
|
57
|
+
res = RestClient.get(url, default_headers.merge(params: params))
|
58
|
+
rescue => e
|
59
|
+
logger.error "#{e.class}\n#{e.message}"
|
60
60
|
exit 1
|
61
61
|
end
|
62
|
+
|
63
|
+
JSON.parse(res.body.force_encoding("UTF-8"), symbolize_names: true)
|
64
|
+
end
|
65
|
+
|
66
|
+
def post url, query
|
67
|
+
begin
|
68
|
+
res = RestClient.post(url, query, default_headers)
|
69
|
+
rescue => e
|
70
|
+
logger.error "#{e.class}\n#{e.message}"
|
71
|
+
exit 1
|
72
|
+
end
|
73
|
+
|
62
74
|
JSON.parse(res.body.force_encoding("UTF-8"), symbolize_names: true)
|
63
75
|
end
|
64
76
|
|
65
|
-
def
|
77
|
+
def patch url, query
|
66
78
|
begin
|
67
|
-
res = RestClient.
|
68
|
-
rescue
|
69
|
-
logger.error e.
|
79
|
+
res = RestClient.patch(url, query, default_headers)
|
80
|
+
rescue => e
|
81
|
+
logger.error "#{e.class}\n#{e.message}"
|
70
82
|
exit 1
|
71
83
|
end
|
84
|
+
|
72
85
|
JSON.parse(res.body.force_encoding("UTF-8"), symbolize_names: true)
|
73
86
|
end
|
74
87
|
|
75
|
-
def put url, query
|
88
|
+
def put url, query
|
76
89
|
begin
|
77
|
-
res = RestClient.put(url, query,
|
78
|
-
rescue
|
79
|
-
logger.error e.
|
90
|
+
res = RestClient.put(url, query, default_headers)
|
91
|
+
rescue => e
|
92
|
+
logger.error "#{e.class}\n#{e.message}"
|
80
93
|
exit 1
|
81
94
|
end
|
95
|
+
|
82
96
|
JSON.parse(res.body.force_encoding("UTF-8"), symbolize_names: true)
|
83
97
|
end
|
84
98
|
|
99
|
+
def default_headers
|
100
|
+
{ content_type: :json, source: 'fir-cli', cli_version: FIR::VERSION }
|
101
|
+
end
|
102
|
+
|
85
103
|
alias_method :☠, :exit
|
86
104
|
end
|
87
105
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fir-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FIR.im
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05
|
12
|
+
date: 2015-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -148,14 +148,8 @@ metadata: {}
|
|
148
148
|
post_install_message: "\n ______________ ________ ____\n /
|
149
149
|
____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
|
150
150
|
/\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
|
151
|
-
\ ## 更新记录\n ### FIR-CLI 1.0\n -
|
152
|
-
|
153
|
-
\ - 修正部分服务器安装出现编码失败问题\n - 修正 ipa 路径带有空格解析失败的 bug\n - 重写 ipa 解析器, 去除 `miniz.c`,
|
154
|
-
增加 pngcrash\n - 上传 ipa 时, 优先取 `display_name` 作为应用名称\n - build_ipa 增加默认 build 路径,
|
155
|
-
`fir b` 则默认 build 当前路径\n - build_ipa 增加输出 dSYM 符号表文件\n - build_ipa 增加输出指定 ipa
|
156
|
-
名称\n - build_ipa 增加输出 xcodebuild 的信息\n - 去掉输出信息颜色, 方便查看 log\n - 简化 --verbose
|
157
|
-
参数, 简化为 `--verbose --no-verbose`, 默认输出为 INFO\n - https://github.com/FIRHQ/fir-cli\n
|
158
|
-
\ "
|
151
|
+
\ ## 更新记录\n ### FIR-CLI 1.1.0\n - 完全兼容新版 API ✔\n - 请使用新版 API Token\n - 新版 API
|
152
|
+
Token 查看地址: `http://fir.im/user/info`\n - https://github.com/FIRHQ/fir-cli\n "
|
159
153
|
rdoc_options: []
|
160
154
|
require_paths:
|
161
155
|
- lib
|
@@ -171,9 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
165
|
version: '0'
|
172
166
|
requirements: []
|
173
167
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.4.
|
168
|
+
rubygems_version: 2.4.7
|
175
169
|
signing_key:
|
176
170
|
specification_version: 4
|
177
171
|
summary: FIR.im command tool
|
178
172
|
test_files: []
|
179
|
-
has_rdoc:
|