fir-cli 1.1.8 → 1.1.9

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: 0c92eba76896df79468053134c355bdfbb0d2031
4
- data.tar.gz: 38284b8643672070bc2078f6f05800b97c6c10bb
3
+ metadata.gz: 849113cc22122894e41d6f9fb313812fbd64c97b
4
+ data.tar.gz: 001404da307f8e5150590a597dd187b2f55723d4
5
5
  SHA512:
6
- metadata.gz: 7541e7985bc256321aa403f2969bdaaa2c7623542ab22b87b5bcfc0774efefbc31ac903b9165cef26aaf5a79dc70b514677865885047061630893e1aa31bfeaa
7
- data.tar.gz: f10503990d06c2d513e268284ce376c52ff8c12e67f43f9eed3967ee16dc6721512b4ac3d2ac4432046f5c670f6d225452d283c812af500a3e2e9ab2edd52f0d
6
+ metadata.gz: 316b2e5b3febc05fa320d66b8cec8d5e8da64c23ea1f5a3954cf14fd98621becf10ab1ed6c872ca764974a4b44a84d87bbbb7e59f42ec74163ee6d00e444cd5b
7
+ data.tar.gz: 5474a245a6082418d90147169ef5595d6918d67c9de1a02df7a1ec9e0c5a50ced1408c10ea6371d493dde98ed8af98f41537b133ef1ca2d30234a925c3a111d3
data/.travis.yml CHANGED
@@ -8,7 +8,6 @@ rvm:
8
8
  - rbx-2
9
9
  - jruby
10
10
  - jruby-head
11
-
12
11
  matrix:
13
12
  allow_failures:
14
13
  - rvm: ruby-head
@@ -18,7 +17,9 @@ matrix:
18
17
  notifications:
19
18
  recipients:
20
19
  - hxy@fir.im
21
-
22
20
  branches:
23
21
  only:
24
22
  - master
23
+ addons:
24
+ code_climate:
25
+ repo_token: 7158bd5d0218441524b8663790dd28edba8a870387ed000a1b56968e3315af2a
data/CHANGELOG CHANGED
@@ -1,5 +1,8 @@
1
1
  ## 更新记录
2
2
 
3
+ ### FIR-CLI 1.1.9
4
+ - 修改显示上的一些小问题
5
+
3
6
  ### FIR-CLI 1.1.8
4
7
  - 支持 gradle 打包 apk 文件并自动上传至 fir.im, `fir build_apk(alias ba)`
5
8
  - `fir ba <project dir> [-o <apk output dir> -c <changelog> -p -T <your api token>]`
data/Gemfile CHANGED
@@ -7,3 +7,5 @@ end
7
7
 
8
8
  # Specify your gem's dependencies in fir.gemspec
9
9
  gemspec
10
+
11
+ gem "codeclimate-test-reporter", group: :test, require: nil
data/README.md CHANGED
@@ -3,6 +3,8 @@ FIR.im CLI
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)
6
+ [![Test Coverage](https://codeclimate.com/github/FIRHQ/fir-cli/badges/coverage.svg)](https://codeclimate.com/github/FIRHQ/fir-cli/coverage)
7
+ [![Gem Version](https://badge.fury.io/rb/fir-cli.svg)](http://badge.fury.io/rb/fir-cli)
6
8
 
7
9
  > FIR.im CLI 可以通过指令查看, 上传, 编译应用
8
10
 
data/fir-cli.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  /_/ /___/_/ |_| \____/_____/___/
29
29
 
30
30
  ## 更新记录
31
- ### FIR-CLI 1.1.8
31
+ ### FIR-CLI 1.1.9
32
32
  - 完全兼容新版 API ✔
33
33
  - 请使用新版 API Token
34
34
  - 新版 API Token 查看地址: `http://fir.im/user/info`
data/lib/fir/cli.rb CHANGED
@@ -77,6 +77,7 @@ module FIR
77
77
  Example:
78
78
 
79
79
  $ fir p <app file path> [-c <changelog> -s <custom short link> -T <your api token>]
80
+
80
81
  $ fir p <app file path> [-c <changelog> -s <custom short link> -m <mapping file path> -P <bughd project id> -T <your api token>]
81
82
  LONGDESC
82
83
  map "p" => :publish
@@ -31,15 +31,7 @@ module FIR
31
31
  @scheme_name = options[:scheme]
32
32
  @dsym_name = @wrapper_name + '.dSYM' unless @wrapper_name.blank?
33
33
 
34
- if options.workspace?
35
- workspace = check_and_find_ios_workspace(@build_dir)
36
- check_ios_scheme(@scheme_name)
37
- ipa_build_cmd += " -workspace '#{workspace}' -scheme '#{@scheme_name}'"
38
- else
39
- project = check_and_find_ios_project(@build_dir)
40
- ipa_build_cmd += " -project '#{project}'"
41
- end
42
-
34
+ ipa_build_cmd += initialize_xcode_build_path(options)
43
35
  ipa_build_cmd += " -configuration '#{@configuration}'" unless @configuration.blank?
44
36
  ipa_build_cmd += " -target '#{@target_name}'" unless @target_name.blank?
45
37
  ipa_build_cmd += " #{ipa_custom_settings(args)} 2>&1"
@@ -90,53 +82,38 @@ module FIR
90
82
  token: @token
91
83
  end
92
84
 
93
- # convert ['a=1', 'b=2'] => { 'a' => '1', 'b' => '2' }
94
- def parse_ipa_custom_settings args
95
- hash = {}
96
- args.each do |setting|
97
- k, v = setting.split('=', 2).map(&:strip)
98
- hash[k] = v
99
- end
85
+ def initialize_xcode_build_path options
86
+ if options.workspace?
87
+ workspace = check_and_find_ios_xcworkspace(@build_dir)
88
+ check_ios_scheme(@scheme_name)
100
89
 
101
- hash
102
- end
90
+ return " -workspace '#{workspace}' -scheme '#{@scheme_name}'"
91
+ else
92
+ project = check_and_find_ios_xcodeproj(@build_dir)
103
93
 
104
- def check_and_find_ios_project path
105
- unless File.exist?(path)
106
- logger.error "The first param BUILD_DIR must be a xcodeproj directory"
107
- exit 1
94
+ return " -project '#{project}'"
108
95
  end
96
+ end
109
97
 
110
- if is_ios_project?(path)
111
- project = path
112
- else
113
- project = Dir["#{path}/*.xcodeproj"].first
114
- if project.blank?
115
- logger.error "The xcodeproj file is missing, check the BUILD_DIR"
98
+ %w(xcodeproj xcworkspace).each do |workplace|
99
+ define_method "check_and_find_ios_#{workplace}" do |path|
100
+ unless File.exist?(path)
101
+ logger.error "The first param BUILD_DIR must be a #{workplace} directory"
116
102
  exit 1
117
103
  end
118
- end
119
-
120
- project
121
- end
122
104
 
123
- def check_and_find_ios_workspace path
124
- unless File.exist?(path)
125
- logger.error "The first param BUILD_DIR must be a xcworkspace directory"
126
- exit 1
127
- end
128
-
129
- if is_ios_workspace?(path)
130
- workspace = path
131
- else
132
- workspace = Dir["#{path}/*.xcworkspace"].first
133
- if workspace.blank?
134
- logger.error "The xcworkspace file is missing, check the BUILD_DIR"
135
- exit 1
105
+ if File.extname(path) == ".#{workplace}"
106
+ build_dir = path
107
+ else
108
+ build_dir = Dir["#{path}/*.#{workplace}"].first
109
+ if build_dir.blank?
110
+ logger.error "The #{workplace} file is missing, check the BUILD_DIR"
111
+ exit 1
112
+ end
136
113
  end
137
- end
138
114
 
139
- workspace
115
+ build_dir
116
+ end
140
117
  end
141
118
 
142
119
  def check_ios_scheme scheme_name
@@ -146,14 +123,6 @@ module FIR
146
123
  end
147
124
  end
148
125
 
149
- def is_ios_project? path
150
- File.extname(path) == '.xcodeproj'
151
- end
152
-
153
- def is_ios_workspace? path
154
- File.extname(path) == '.xcworkspace'
155
- end
156
-
157
126
  def zip_app2ipa app_path, ipa_path
158
127
  Dir.mktmpdir do |tmpdir|
159
128
  Dir.chdir(tmpdir) do
@@ -165,5 +134,18 @@ module FIR
165
134
  end
166
135
  end
167
136
 
137
+ private
138
+
139
+ # convert ['a=1', 'b=2'] => { 'a' => '1', 'b' => '2' }
140
+ def parse_ipa_custom_settings args
141
+ hash = {}
142
+ args.each do |setting|
143
+ k, v = setting.split('=', 2).map(&:strip)
144
+ hash[k] = v
145
+ end
146
+
147
+ hash
148
+ end
149
+
168
150
  end
169
151
  end
@@ -9,10 +9,7 @@ module FIR
9
9
  @changelog = options[:changelog].to_s
10
10
  @short = options[:short].to_s
11
11
 
12
- check_file_exist @file_path
13
- check_supported_file @file_path
14
- check_token_cannot_be_blank @token
15
- fetch_user_info @token
12
+ check_supported_file_and_token
16
13
 
17
14
  logger.info "Publishing app......."
18
15
  logger_info_dividing_line
@@ -40,93 +37,101 @@ module FIR
40
37
  logger_info_blank_line
41
38
  end
42
39
 
43
- private
44
-
45
- def upload_app
46
- @icon_cert = @uploading_info[:cert][:icon]
47
- @binary_cert = @uploading_info[:cert][:binary]
48
-
49
- upload_app_icon
50
- upload_app_binary
51
- upload_device_info
52
- update_app_info
53
- end
54
-
55
- def upload_app_icon
56
- unless @app_info[:icons].blank?
57
- logger.info "Uploading app's icon......"
58
-
59
- icon_path = @app_info[:icons].max_by { |f| File.size(f) }
60
-
61
- hash = {
62
- key: @icon_cert[:key],
63
- token: @icon_cert[:token],
64
- file: File.new(icon_path, "rb")
65
- }
40
+ def upload_app
41
+ @icon_cert = @uploading_info[:cert][:icon]
42
+ @binary_cert = @uploading_info[:cert][:binary]
66
43
 
67
- uploaded_info = post(@icon_cert[:upload_url], hash)
44
+ upload_app_icon
45
+ upload_app_binary
46
+ upload_device_info
47
+ update_app_info
48
+ end
68
49
 
69
- unless uploaded_info[:is_completed]
70
- logger.error "Upload app icon failed"
71
- exit 1
72
- end
73
- end
74
- end
50
+ def upload_app_icon
51
+ unless @app_info[:icons].blank?
52
+ logger.info "Uploading app's icon......"
75
53
 
76
- def upload_app_binary
77
- logger.info "Uploading app......"
54
+ icon_path = @app_info[:icons].max_by { |f| File.size(f) }
78
55
 
79
56
  hash = {
80
- key: @binary_cert[:key],
81
- token: @binary_cert[:token],
82
- file: File.new(@file_path, "rb"),
83
- # Custom variables
84
- "x:name" => @app_info[:display_name] || @app_info[:name],
85
- "x:build" => @app_info[:build],
86
- "x:version" => @app_info[:version],
87
- "x:changelog" => @changelog,
88
- "x:release_type" => @app_info[:release_type],
57
+ key: @icon_cert[:key],
58
+ token: @icon_cert[:token],
59
+ file: File.new(icon_path, "rb")
89
60
  }
90
61
 
91
- uploaded_info = post(@binary_cert[:upload_url], hash)
62
+ uploaded_info = post(@icon_cert[:upload_url], hash)
92
63
 
93
64
  unless uploaded_info[:is_completed]
94
- logger.error "Upload app binary failed"
65
+ logger.error "Upload app icon failed"
95
66
  exit 1
96
67
  end
97
68
  end
69
+ end
98
70
 
99
- def upload_device_info
100
- unless @app_info[:devices].blank?
101
- logger.info "Updating devices info......"
102
-
103
- post fir_api[:udids_url], key: @binary_cert[:key],
104
- udids: @app_info[:devices].join(","),
105
- api_token: @token
106
- end
71
+ def upload_app_binary
72
+ logger.info "Uploading app......"
73
+
74
+ hash = {
75
+ key: @binary_cert[:key],
76
+ token: @binary_cert[:token],
77
+ file: File.new(@file_path, "rb"),
78
+ # Custom variables
79
+ "x:name" => @app_info[:display_name] || @app_info[:name],
80
+ "x:build" => @app_info[:build],
81
+ "x:version" => @app_info[:version],
82
+ "x:changelog" => @changelog,
83
+ "x:release_type" => @app_info[:release_type],
84
+ }
85
+
86
+ uploaded_info = post(@binary_cert[:upload_url], hash)
87
+
88
+ unless uploaded_info[:is_completed]
89
+ logger.error "Upload app binary failed"
90
+ exit 1
107
91
  end
92
+ end
108
93
 
109
- def update_app_info
110
- unless @short.blank?
111
- logger.info "Updating app info......"
94
+ def upload_device_info
95
+ unless @app_info[:devices].blank?
96
+ logger.info "Updating devices info......"
112
97
 
113
- patch fir_api[:app_url] + "/#{@app_id}", short: @short,
114
- api_token: @token
115
- end
98
+ post fir_api[:udids_url], key: @binary_cert[:key],
99
+ udids: @app_info[:devices].join(","),
100
+ api_token: @token
116
101
  end
102
+ end
117
103
 
118
- def fetch_uploading_info
119
- logger.info "Fetching #{@app_info[:identifier]}@FIR.im uploading info......"
104
+ def update_app_info
105
+ unless @short.blank?
106
+ logger.info "Updating app info......"
120
107
 
121
- post fir_api[:app_url], type: @app_info[:type],
122
- bundle_id: @app_info[:identifier],
123
- api_token: @token
108
+ patch fir_api[:app_url] + "/#{@app_id}", short: @short,
109
+ api_token: @token
124
110
  end
111
+ end
112
+
113
+ def fetch_uploading_info
114
+ logger.info "Fetching #{@app_info[:identifier]}@FIR.im uploading info......"
115
+
116
+ post fir_api[:app_url], type: @app_info[:type],
117
+ bundle_id: @app_info[:identifier],
118
+ api_token: @token
119
+ end
120
+
121
+ def fetch_app_info
122
+ logger.info "Fetch app info from FIR.im"
123
+
124
+ get fir_api[:app_url] + "/#{@app_id}", api_token: @token
125
+ end
125
126
 
126
- def fetch_app_info
127
- logger.info "Fetch app info from FIR.im"
127
+ private
128
128
 
129
- get fir_api[:app_url] + "/#{@app_id}", api_token: @token
129
+ def check_supported_file_and_token
130
+ check_file_exist @file_path
131
+ check_supported_file @file_path
132
+ check_token_cannot_be_blank @token
133
+ fetch_user_info @token
130
134
  end
135
+
131
136
  end
132
137
  end
data/lib/fir/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module FIR
4
- VERSION = "1.1.8"
4
+ VERSION = "1.1.9"
5
5
  end
data/test/test_helper.rb CHANGED
@@ -3,6 +3,9 @@
3
3
  require 'minitest/autorun'
4
4
  require 'ostruct'
5
5
  require 'fir'
6
+ require 'codeclimate-test-reporter'
7
+ CodeClimate::TestReporter.start
8
+
6
9
 
7
10
  FIR.logger = Logger.new(STDOUT)
8
11
 
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.1.8
4
+ version: 1.1.9
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-08-06 00:00:00.000000000 Z
12
+ date: 2015-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -181,7 +181,7 @@ metadata: {}
181
181
  post_install_message: "\n ______________ ________ ____\n /
182
182
  ____/ _/ __ \\ / ____/ / / _/\n / /_ / // /_/ /_____/ / / / /
183
183
  /\n / __/ _/ // _, _/_____/ /___/ /____/ /\n /_/ /___/_/ |_| \\____/_____/___/\n\n
184
- \ ## 更新记录\n ### FIR-CLI 1.1.8\n - 完全兼容新版 API ✔\n - 请使用新版 API Token\n - 新版 API
184
+ \ ## 更新记录\n ### FIR-CLI 1.1.9\n - 完全兼容新版 API ✔\n - 请使用新版 API Token\n - 新版 API
185
185
  Token 查看地址: `http://fir.im/user/info`\n - 增加符号表上传指令, `fir mapping(alias m)`\n -
186
186
  有以下三种方式上传符号表(目前已经支持 dSYM 和 txt 两种格式的符号表文件上传)\n - 1. 指定 version 和 build 上传: `fir
187
187
  m <mapping file path> -P <bughd project id> -v <app version> -b <app build> -T <your