Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
refactoring
  • Loading branch information
jicheng1014 committed Mar 22, 2018
1 parent c07162c commit a907aa4
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,6 +20,7 @@ Gemfile.lock
/test/cases/*.png
/build_apk_example_*
/build_ipa_example_*
.byebug*

.idea/
lib/.byebug_history
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -2,7 +2,7 @@
if ENV['USE_OFFICIAL_GEM_SOURCE']
source 'https://rubygems.org'
else
source 'https://gems.ruby-china.org'
source 'http://gems.ruby-china.org'
end

# Specify your gem's dependencies in fir.gemspec
Expand Down
10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -11,6 +11,9 @@
fir.im-cli 可以通过指令查看, 上传, iOS/Android 应用.

![fir-cli](http://7rf35s.com1.z0.glb.clouddn.com/fir-cli-new.gif)
## 重要提示
- 由于部分地区上传时遇到的证书问题, 新版本默认忽略证书校验. 如需打开, 请在命令前加入`UPLOAD_VERIFY_SSL=1`
- 介于在ios 等编译越来越复杂化, fir-cli 自带的编译功能较为简单, 不能很好的满足用户需求, 推荐用户使用 fastlane (fastlane gym)进行打包,生成好 ipa 文件后,再使用 fir publish 上传生成的ipa 包

## 文档

Expand All @@ -34,10 +37,7 @@ fir help
```
## 提交反馈

直接使用 Github 的 [Issue](https://github.com/FIRHQ/fir-cli/issues) 即可.
- 联系微信 `atpking`

## 捐赠支持
- 使用 Github 的 [Issue](https://github.com/FIRHQ/fir-cli/issues)

如果你觉得 fir-cli 对你有所帮助, 欢迎微信打赏支持作者:smile:

![](http://7rf35s.com1.z0.glb.clouddn.com/coffee.png)
2 changes: 1 addition & 1 deletion lib/fir/patches/default_headers.rb
Expand Up @@ -3,7 +3,7 @@
module RestClient
class Request
def default_headers
{ content_type: :json, source: 'fir-cli', version: FIR::VERSION }
{ source: 'fir-cli', version: FIR::VERSION }
end
end
end
16 changes: 14 additions & 2 deletions lib/fir/util/http.rb
@@ -1,8 +1,20 @@
# encoding: utf-8

# frozen_string_literal: true

require 'api_tools'

module FIR
module Http
module Http
include ApiTools::DefaultRestModule

alias old_default_options default_options
def default_options
@default_options = old_default_options
unless ENV['UPLOAD_VERIFY_SSL']
@default_options.merge!(other_base_execute_option: {
verify_ssl: OpenSSL::SSL::VERIFY_NONE
})
end
end
end
end
28 changes: 18 additions & 10 deletions lib/fir/util/publish.rb
Expand Up @@ -42,19 +42,27 @@ def upload_app
update_app_info
fetch_app_info
end

%w(binary icon).each do |word|
define_method("upload_app_#{word}") do
upload_file(word)
end
end

%w(icon binary).each do |postfix|
class_eval <<-METHOD, __FILE__, __LINE__ + 1
def upload_app_#{postfix}
logger.info "Uploading app #{postfix}......"
uploaded_info = post(@#{postfix}_cert[:upload_url], uploading_#{postfix}_info)
def upload_file(postfix)
logger.info "Uploading app #{postfix}......"
url = @uploading_info[:cert][postfix.to_sym][:upload_url]
info = send("uploading_#{postfix}_info")
logger.debug "url = #{url}, info = #{info}"
uploaded_info = post(url, info, {
params_to_json: false,
header: nil
})

return if uploaded_info[:is_completed]
return if uploaded_info[:is_completed]

logger.error "Uploading app #{postfix} failed"
exit 1
end
METHOD
logger.error "Uploading app #{postfix} failed"
exit 1
end

def uploading_icon_info
Expand Down
2 changes: 1 addition & 1 deletion lib/fir/version.rb
@@ -1,5 +1,5 @@
# encoding: utf-8

module FIR
VERSION = '1.6.3'
VERSION = '1.6.4.beta1'
end

0 comments on commit a907aa4

Please sign in to comment.