fir-cli 1.3.4 → 1.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40ee16eab22f396737b2b5df0c7a5f9f1d17eae9
4
- data.tar.gz: 8e6ddc3b9bd00b151f8f3aea69aea221f5fa33d8
3
+ metadata.gz: 5e2c2eb4c08bfe43c5e1237dda28ad11f9899dce
4
+ data.tar.gz: edabc62959f3098a21ecf84861d7c7d39a170b65
5
5
  SHA512:
6
- metadata.gz: 691ee0f6f1b4e79c501cb115c6525a60cc073249a6c79a3040ac40fe2e1144a815b0e65cedf409e8f1c401b921820be615e885662b3ecc80d5e62088f2e3345c
7
- data.tar.gz: 63aa7c7cbda4cd0521eafc7fe03dd3a2e16709e9315c399dadd23c177761e3b943f57f54fe7575ad6c53a6790f4be1918933300f6ab6afa189305e85b32c40a4
6
+ metadata.gz: 6c30e3dd5ff254e45401208381ec8d5d0ebd61cf7d56dcab5d353248454c95b4693f1a60ba280224d7585433ac3f81a7eb82a230004a49aa8c7efd0696006975
7
+ data.tar.gz: 5fb9eaf4199ab0d6c750f25704a2cf5b017691e46120b01a8e4604aa2b8506d23b9523287006cdc097add4c7d2dec91d440d86ee08e6a6e83f491946579f9908
data/CHANGELOG CHANGED
@@ -1,5 +1,8 @@
1
1
  ## 更新记录
2
2
 
3
+ ### fir-cli 1.3.5
4
+ - 修复转换 icon 的 bug
5
+
3
6
  ### fir-cli 1.3.4
4
7
  - 上传增加 distribution_name 信息
5
8
 
@@ -27,9 +27,8 @@ Gem::Specification.new do |spec|
27
27
  /_/ /___/_/ |_| \____/_____/___/
28
28
 
29
29
  ## 更新记录
30
- ### fir-cli 1.3.4
31
- - 修正解析 inhouse 错误的现象
32
- - 上传增加 distribution_name 信息
30
+ ### fir-cli 1.3.5
31
+ - 修复转换 icon 的 bug
33
32
  - 详细更新记录, 请查看: https://github.com/FIRHQ/fir-cli/blob/master/CHANGELOG
34
33
  - [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源
35
34
  - 欢迎 fork, issue 和 pull request
@@ -4,6 +4,7 @@ require_relative './util/http'
4
4
  require_relative './util/config'
5
5
  require_relative './util/parser/apk'
6
6
  require_relative './util/parser/ipa'
7
+ require_relative './util/parser/pngcrush'
7
8
  require_relative './util/login'
8
9
  require_relative './util/me'
9
10
  require_relative './util/info'
@@ -29,9 +29,9 @@ module FIR
29
29
  }
30
30
  end
31
31
 
32
- # @apk.icon is a hash, { icon_name: icon_data }
32
+ # @apk.icon is a hash, { icon_name: icon_binary_data }
33
33
  def tmp_icons
34
- @apk.icon.map { |_, data| generate_tmp_icon(data) }
34
+ @apk.icon.map { |_, data| generate_tmp_icon(data, :apk) }
35
35
  end
36
36
  end
37
37
  end
@@ -4,9 +4,19 @@ module FIR
4
4
  module Parser
5
5
  module Common
6
6
 
7
- def generate_tmp_icon data
7
+ # when type is ipa, the icon data is a png file.
8
+ # when type is apk, the icon data is a binary data.
9
+ def generate_tmp_icon data, type
8
10
  tmp_icon_path = "#{Dir.tmpdir}/icon-#{SecureRandom.hex[4..9]}.png"
9
- File.open(tmp_icon_path, 'w+') { |f| f << data }
11
+
12
+ if type == :ipa
13
+ FileUtils.cp(data, tmp_icon_path)
14
+ elsif type == :apk
15
+ File.open(tmp_icon_path, 'w+') { |f| f << data }
16
+ else
17
+ return
18
+ end
19
+
10
20
  tmp_icon_path
11
21
  end
12
22
  end
@@ -113,7 +113,7 @@ module FIR
113
113
  end
114
114
 
115
115
  def tmp_icons
116
- icons.map { |data| generate_tmp_icon(data) }
116
+ icons.map { |data| generate_tmp_icon(data, :ipa) }
117
117
  end
118
118
 
119
119
  def icons
@@ -0,0 +1,23 @@
1
+ # encoding: utf-8
2
+
3
+ module FIR
4
+ module Parser
5
+ module Pngcrush
6
+
7
+ class << self
8
+
9
+ def png_bin
10
+ @png_bin ||= File.expand_path('../bin/pngcrush', __FILE__)
11
+ end
12
+
13
+ def uncrush_icon crushed_icon_path, uncrushed_icon_path
14
+ system("#{png_bin} -revert-iphone-optimizations #{crushed_icon_path} #{uncrushed_icon_path} &> /dev/null")
15
+ end
16
+
17
+ def crush_icon uncrushed_icon_path, crushed_icon_path
18
+ system("#{png_bin} -iphone #{uncrushed_icon_path} #{crushed_icon_path} &> /dev/null")
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -54,12 +54,13 @@ module FIR
54
54
  end
55
55
 
56
56
  def uploading_icon_info
57
- icon = @app_info[:icons].max_by { |f| File.size(f) }
57
+ large_icon_path = @app_info[:icons].max_by { |f| File.size(f) }
58
+ uncrushed_icon_path = convert_icon(large_icon_path)
58
59
 
59
60
  {
60
61
  key: @icon_cert[:key],
61
62
  token: @icon_cert[:token],
62
- file: File.new(icon, 'rb')
63
+ file: File.new(uncrushed_icon_path, 'rb')
63
64
  }
64
65
  end
65
66
 
@@ -163,5 +164,17 @@ module FIR
163
164
  check_token_cannot_be_blank(@token)
164
165
  fetch_user_info(@token)
165
166
  end
167
+
168
+ def convert_icon origin_path
169
+ logger.info "Converting app's icon......"
170
+
171
+ if @app_info[:type] == 'ios'
172
+ output_path = Tempfile.new(['uncrushed_icon', '.png']).path
173
+ FIR::Parser::Pngcrush.uncrush_icon(origin_path, output_path)
174
+ origin_path = output_path if File.size(output_path) != 0
175
+ end
176
+
177
+ origin_path
178
+ end
166
179
  end
167
180
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- VERSION = '1.3.4'
4
+ VERSION = '1.3.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fir-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - NaixSpirit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-28 00:00:00.000000000 Z
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -173,8 +173,10 @@ files:
173
173
  - lib/fir/util/mapping.rb
174
174
  - lib/fir/util/me.rb
175
175
  - lib/fir/util/parser/apk.rb
176
+ - lib/fir/util/parser/bin/pngcrush
176
177
  - lib/fir/util/parser/common.rb
177
178
  - lib/fir/util/parser/ipa.rb
179
+ - lib/fir/util/parser/pngcrush.rb
178
180
  - lib/fir/util/publish.rb
179
181
  - lib/fir/version.rb
180
182
  - lib/fir_cli.rb
@@ -196,10 +198,9 @@ metadata: {}
196
198
  post_install_message: "\n ______________ ________ ____\n /
197
199
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
198
200
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
199
- \ ## 更新记录\n ### fir-cli 1.3.4\n - 修正解析 inhouse 错误的现象\n - 上传增加 distribution_name
200
- 信息\n - 详细更新记录, 请查看: https://github.com/FIRHQ/fir-cli/blob/master/CHANGELOG\n -
201
- [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源\n - 欢迎 fork, issue 和 pull request\n
202
- \ "
201
+ \ ## 更新记录\n ### fir-cli 1.3.5\n - 修复转换 icon 的 bug\n - 详细更新记录, 请查看: https://github.com/FIRHQ/fir-cli/blob/master/CHANGELOG\n
202
+ \ - [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源\n - 欢迎 fork, issue 和 pull
203
+ request\n "
203
204
  rdoc_options: []
204
205
  require_paths:
205
206
  - lib