fir-cli 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d84cfdd014b5dc65bd4221ba4dce498ef0fbc8a
4
- data.tar.gz: db4b492052e92961c291a6242fe90e89c885af62
3
+ metadata.gz: 983c34c1ff6964b4cff980a06a83900468aa5d56
4
+ data.tar.gz: 16e5217fd7d08a5aed2dd4451a0e46d19cd9ab63
5
5
  SHA512:
6
- metadata.gz: 2d6d298a917cddb526f1c88c34ba4f71cbfbab8e77f824ceb7da9a3a2d8a63a3887538755043623cb270ebd3bd78533198f87b457a47a7b2cc539bd755e7b734
7
- data.tar.gz: 28e45046935d7d156db8ed108d93f3de3e1c8422e9c14339e481a7f3737a33d0e38dc70e3fedf28c45b7a74c7039075148208fec916ac17d52f4ecf6677a3ed7
6
+ metadata.gz: da2875e4eea8e5f5b9263462ef7ed27afbe81831fa2614b10a3ef244074e68d79ba65938a28f710a568275e5bc5354d377894d1bf9f74cc287df3861982309f6
7
+ data.tar.gz: f174fb83ee008253cdb62689c30ca5c0e566de20af1375b13aa41b40cc41dc993ccb45ac99e848120cc4c8cfd15e991b13c7709dc74087ed64d0ee879d80a12f
data/.travis.yml CHANGED
@@ -4,6 +4,7 @@ rvm:
4
4
  - 2.0.0
5
5
  - 2.1
6
6
  - 2.2
7
+ - 2.3
7
8
  - ruby-head
8
9
  - rbx-2
9
10
  - jruby
data/CHANGELOG CHANGED
@@ -1,4 +1,4 @@
1
- ## 更新记录
1
+ ## 更新记录
2
2
 
3
3
  ### fir-cli 1.5.0
4
4
  - 取消 --open 默认值
data/Gemfile CHANGED
@@ -8,4 +8,4 @@ end
8
8
  # Specify your gem's dependencies in fir.gemspec
9
9
  gemspec
10
10
 
11
- gem 'codeclimate-test-reporter', group: :test, require: nil
11
+ gem 'codeclimate-test-reporter', group: :test, require: nil
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  ✈ fir.im-cli
2
- ---
2
+ ----
3
3
 
4
4
  ![Build Status Images](https://travis-ci.org/FIRHQ/fir-cli.svg)
5
5
  [![Code Climate](https://codeclimate.com/github/FIRHQ/fir-cli/badges/gpa.svg)](https://codeclimate.com/github/FIRHQ/fir-cli)
@@ -33,5 +33,3 @@ fir.im-cli 可以通过指令查看, 上传, 编译 iOS/Android 应用.
33
33
  如果你觉得 fir-cli 对你有所帮助, 欢迎微信打赏支持作者:smile:
34
34
 
35
35
  ![](http://7rf35s.com1.z0.glb.clouddn.com/coffee.png)
36
-
37
-
data/fir-cli.gemspec CHANGED
@@ -27,10 +27,8 @@ Gem::Specification.new do |spec|
27
27
  /_/ /___/_/ |_| \____/_____/___/
28
28
 
29
29
  ## 更新记录
30
- ### fir-cli 1.5.0
31
- - 修正 build 后直接 -p 发布的权限错误
32
- - 增加上传时候设置密码及公开访问权限
33
- - 增加 build_ipa 中的 destination 参数
30
+ ### fir-cli 1.5.1
31
+ - 修复了在 ruby 2.4.0 中登录出错的bug
34
32
  - 详细更新记录, 请查看: https://github.com/FIRHQ/fir-cli/blob/master/CHANGELOG
35
33
  - [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源
36
34
  - 欢迎 fork, issue 和 pull request
@@ -43,7 +41,7 @@ Gem::Specification.new do |spec|
43
41
 
44
42
  spec.add_dependency 'thor', '~> 0.19'
45
43
  spec.add_dependency 'CFPropertyList', '~> 2.3'
46
- spec.add_dependency 'rest-client', '~> 1.7'
44
+ spec.add_dependency 'rest-client', '~> 2.0'
47
45
  spec.add_dependency 'ruby_android', '~> 0.7'
48
46
  spec.add_dependency 'rqrcode', '~> 0.7'
49
47
  end
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ module RestClient
4
+ class Request
5
+ def default_headers
6
+ { content_type: :json, source: 'fir-cli', version: FIR::VERSION }
7
+ end
8
+ end
9
+ end
data/lib/fir/patches.rb CHANGED
@@ -7,3 +7,4 @@ require_relative './patches/instance_variables'
7
7
  require_relative './patches/native_patch'
8
8
  require_relative './patches/os_patch'
9
9
  require_relative './patches/try'
10
+ require_relative './patches/default_headers'
data/lib/fir/util/http.rb CHANGED
@@ -2,61 +2,29 @@
2
2
 
3
3
  module FIR
4
4
  module Http
5
- DEFAULT_TIMEOUT = 300
5
+ MAX_RETRIES = 5
6
6
 
7
- def get(url, params = {})
8
- tries = 5
9
- begin
10
- res = ::RestClient::Request.execute(
11
- method: :get,
12
- url: url,
13
- timeout: DEFAULT_TIMEOUT,
14
- headers: default_headers.merge(params: params)
15
- )
16
- rescue => e
17
- logger.error e.message.to_s
18
- if tries > 0
19
- logger.info "Retry in #{tries} times......"
20
- tries -= 1
21
- retry
22
- else
23
- exit 1
24
- end
25
- end
26
-
27
- JSON.parse(res.body.force_encoding('UTF-8'), symbolize_names: true)
28
- end
29
-
30
- %w(post patch put).each do |method|
31
- define_method method do |url, query|
32
- tries = 5
33
- begin
34
- res = ::RestClient::Request.execute(
35
- method: method.to_sym,
36
- url: url,
37
- payload: query,
38
- timeout: DEFAULT_TIMEOUT,
39
- headers: default_headers
40
- )
41
- rescue => e
42
- logger.error e.message.to_s
43
- if tries > 0
44
- logger.info "Retry in #{tries} times......"
45
- tries -= 1
46
- retry
47
- else
48
- exit 1
7
+ %w(get post patch put).each do |_m|
8
+ class_eval <<-METHOD, __FILE__, __LINE__ + 1
9
+ def #{_m}(url, params = {})
10
+ query = :#{_m} == :get ? { params: params } : params
11
+ begin
12
+ res = ::RestClient.#{_m}(url, query)
13
+ rescue => e
14
+ @retries ||= 0
15
+ logger.error(e.message.to_s)
16
+ if @retries < MAX_RETRIES
17
+ @retries += 1
18
+ logger.info("Retry \#{@retries} times......")
19
+ sleep 2
20
+ retry
21
+ else
22
+ exit 1
23
+ end
49
24
  end
25
+ JSON.parse(res.body.force_encoding('UTF-8'), symbolize_names: true)
50
26
  end
51
-
52
- JSON.parse(res.body.force_encoding('UTF-8'), symbolize_names: true)
53
- end
54
- end
55
-
56
- private
57
-
58
- def default_headers
59
- { content_type: :json, source: 'fir-cli', version: FIR::VERSION }
27
+ METHOD
60
28
  end
61
29
  end
62
30
  end
@@ -43,15 +43,18 @@ module FIR
43
43
  fetch_app_info
44
44
  end
45
45
 
46
- def upload_app_icon
47
- logger.info 'Uploading app icon......'
46
+ %w(icon binary).each do |postfix|
47
+ class_eval <<-METHOD, __FILE__, __LINE__ + 1
48
+ def upload_app_#{postfix}
49
+ logger.info "Uploading app #{postfix}......"
50
+ uploaded_info = post(@#{postfix}_cert[:upload_url], uploading_#{postfix}_info)
48
51
 
49
- uploaded_info = post(@icon_cert[:upload_url], uploading_icon_info)
52
+ return if uploaded_info[:is_completed]
50
53
 
51
- return if uploaded_info[:is_completed]
52
-
53
- logger.error 'Upload app icon failed'
54
- exit 1
54
+ logger.error "Uploading app #{postfix} failed"
55
+ exit 1
56
+ end
57
+ METHOD
55
58
  end
56
59
 
57
60
  def uploading_icon_info
@@ -66,17 +69,6 @@ module FIR
66
69
  }
67
70
  end
68
71
 
69
- def upload_app_binary
70
- logger.info 'Uploading app binary......'
71
-
72
- uploaded_info = post(@binary_cert[:upload_url], uploading_binary_info)
73
-
74
- return if uploaded_info[:is_completed]
75
-
76
- logger.error 'Upload app binary failed'
77
- exit 1
78
- end
79
-
80
72
  def uploading_binary_info
81
73
  {
82
74
  key: @binary_cert[:key],
data/lib/fir/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- VERSION = '1.5.0'
4
+ VERSION = '1.5.1'
5
5
  end
data/test/test_helper.rb CHANGED
@@ -1,7 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
+ # CodeClimate::TestReporter.start
3
4
  require 'codeclimate-test-reporter'
4
- CodeClimate::TestReporter.start
5
+ require 'simplecov'
6
+ SimpleCov.start
7
+
5
8
 
6
9
  require 'minitest/autorun'
7
10
  require 'ostruct'
@@ -71,4 +74,25 @@ class Minitest::Test
71
74
  def default_distribution_name
72
75
  'iOSTeam Provisioning Profile: im.fir.* - Fly It Remotely LLC.'
73
76
  end
77
+
78
+ end
79
+
80
+
81
+ # 跑完测试之后再发结果到Codelimate
82
+ # 测试CODECLIMATE_REPO_TOKEN: c454b9a54151b3ed3e18949279aec49d6a25bf507706815f99a919f1c01679ed
83
+ Minitest.after_run do
84
+ COVERAGE_FILE = "coverage/.resultset.json".freeze
85
+ if (repo_token = ENV["CODECLIMATE_REPO_TOKEN"]) && !repo_token.empty?
86
+ if File.exist?(COVERAGE_FILE)
87
+ begin
88
+ results = JSON.parse(File.read(COVERAGE_FILE))
89
+ rescue JSON::ParserError => e
90
+ $stderr.puts "Error encountered while parsing #{COVERAGE_FILE}: #{e}"
91
+ end
92
+
93
+ CodeClimate::TestReporter.run(results)
94
+ else
95
+ $stderr.puts "Coverage results not found"
96
+ end
97
+ end
74
98
  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.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - NaixSpirit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-04 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '1.7'
103
+ version: '2.0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '1.7'
110
+ version: '2.0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: ruby_android
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -174,6 +174,7 @@ files:
174
174
  - lib/fir/patches.rb
175
175
  - lib/fir/patches/blank.rb
176
176
  - lib/fir/patches/concern.rb
177
+ - lib/fir/patches/default_headers.rb
177
178
  - lib/fir/patches/hash.rb
178
179
  - lib/fir/patches/instance_variables.rb
179
180
  - lib/fir/patches/native_patch.rb
@@ -215,10 +216,9 @@ metadata: {}
215
216
  post_install_message: "\n ______________ ________ ____\n /
216
217
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
217
218
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
218
- \ ## 更新记录\n ### fir-cli 1.5.0\n - 修正 build 后直接 -p 发布的权限错误\n - 增加上传时候设置密码及公开访问权限\n
219
- \ - 增加 build_ipa 中的 destination 参数\n - 详细更新记录, 请查看: https://github.com/FIRHQ/fir-cli/blob/master/CHANGELOG\n
220
- \ - [fir-cli](https://github.com/FIRHQ/fir-cli) 已经开源\n - 欢迎 fork, issue 和 pull
221
- request\n "
219
+ \ ## 更新记录\n ### fir-cli 1.5.1\n - 修复了在 ruby 2.4.0 中登录出错的bug\n - 详细更新记录, 请查看:
220
+ https://github.com/FIRHQ/fir-cli/blob/master/CHANGELOG\n - [fir-cli](https://github.com/FIRHQ/fir-cli)
221
+ 已经开源\n - 欢迎 fork, issue 和 pull request\n "
222
222
  rdoc_options: []
223
223
  require_paths:
224
224
  - lib
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  version: '0'
235
235
  requirements: []
236
236
  rubyforge_project:
237
- rubygems_version: 2.4.8
237
+ rubygems_version: 2.6.10
238
238
  signing_key:
239
239
  specification_version: 4
240
240
  summary: fir.im command tool