ocean_package 0.2.0 → 0.7.0

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
  SHA256:
3
- metadata.gz: 05b74d8479d857de4835fa2ac408ac568252d1301f7167dfa104548b4f0a0358
4
- data.tar.gz: e8108d6392ae665c9d48e61d9d77c22b66c7a441239e68538cf3ecf72716d685
3
+ metadata.gz: e28f7f81431f3e160d1063694c6e2fcba7cffffdd9f5bb7fae4e7f9c54acb5d1
4
+ data.tar.gz: 842dae0c668d80d20ad80d4b5b6fe1e3d0316d75b04ac5fbcb17cdb45afbdacf
5
5
  SHA512:
6
- metadata.gz: 9c9d602cf960e3d6e33e8092b71b5a45b398121b5882e445c87b652522a4d3ef46cab3654b02000a548aa45f370743d0787aa4d3a3f19b7273f2dd03924c65dc
7
- data.tar.gz: 447d78d6e62b2fb70fac83bd3918c550bf8b2c42e11d9ce985863e5c2b6e6d9e6424f606ec38348d70d8921333d2ac4c2d6e4b42833600b4a1327da0019923f5
6
+ metadata.gz: 2cc5adbe418c1827987f9db8273242ac486ae86f53cbcbc63d06d644067a7a69747d5e8854da81e49232f121842ae95efc5dcd1184ef05f5a560b026bde88678
7
+ data.tar.gz: 2e46cd86d32aeeea542c4e9f4122121c70a4386eed5a3a23b097aae00146d846262b39229a2b30f5c4cb3670dc955c9ac888ba1e76c5bea9e2e4b361e3e371af
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ocean_package (0.1.0)
4
+ ocean_package (0.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -19,10 +19,38 @@ And then execute:
19
19
  Or install it yourself as:
20
20
 
21
21
  $ gem install ocean_package
22
+
23
+ or
24
+
25
+ $ sudo gem install ocean_package
26
+
27
+ 其他需要安装的依赖
28
+
29
+ - `fir-cli`, [链接](https://github.com/FIRHQ/fir-cli)
30
+ - `ossutil`, [链接](https://help.aliyun.com/document_detail/120075.html?spm=a2c4g.11186623.2.45.6e491c7akyZ5HE)
31
+
32
+
22
33
 
23
34
  ## Usage
24
35
 
25
- TODO: Write usage instructions here
36
+ ```
37
+ oceanpackage --workspace-path=/Users/ocean/Desktop/code/iOS/MyApp.xcworkspace --scheme=MyApp --configuration=Debug --archive-path=/Users/ocean/Documents/myipas --export-options-plist=/Users/ocean/Desktop/code/iOS/Company/MyApp/AdHocExportOptions.plist --company-name=MyCompany --fir-token=fir平台的token --change-log=测试一下 --oss-bucket-name=bucket名称 --oss-bucket-path=bucket路径 --oss-endpoint=oss的endpoint --ding-token=钉钉群机器人token --at-mobiles=需要@的人手机号
38
+ ```
39
+
40
+ - `--workspace-path`: `.xcworkspace` 文件路径
41
+ - `--scheme`: `scheme`
42
+ - `--configuration`: `Debug` 和 `Release`
43
+ - `--archive-path`: 生成的 `.xcarchive` 文件目录
44
+ - `--export-options-plist`: 打包用到的 `export-options` plist 文件路径
45
+ - `--company-name`: 公司名称,可以不填
46
+ - `--fir-token`: fir 平台的 token
47
+ - `--change-log`: 更新描述
48
+ - `--oss-bucket-name`: `oss bucket` 名称
49
+ - `--oss-bucket-path`: `oss bucket` 路径
50
+ - `--oss-endpoint`: `oss` 的 `endpoint`
51
+ - `--ding-token`: 钉钉群机器人的`token`
52
+ - `--at-mobiles`: 钉钉群需要 @ 的人手机号,多个用 `,` 拼接
53
+
26
54
 
27
55
  ## Development
28
56
 
@@ -91,6 +91,7 @@ module OceanPackage
91
91
  package.run
92
92
  upload
93
93
  send_ding_talk_msg
94
+ finished
94
95
  end
95
96
 
96
97
  # 上传 ipa 文件
@@ -106,6 +107,7 @@ module OceanPackage
106
107
  end
107
108
 
108
109
  # 上传 二维码 QRCode 图片到 oss
110
+ # 后续其他平台,比如蒲公英也是需要类似的逻辑
109
111
  def upload_qr_code(path, name)
110
112
  @qr_code_url = oss.upload(path, name)
111
113
  end
@@ -136,10 +138,10 @@ module OceanPackage
136
138
  content += "当前平台: iOS \n\n"
137
139
  content += "APP名称: " + ipa.display_name + "\n\n"
138
140
  content += "当前版本: " + ipa.version + "(#{ipa.build_version})" + "\n\n"
139
- content += "打包耗时: " + "#{compute_total_time}" + "\n\n"
141
+ content += "打包耗时: " + "#{compute_total_time}" + "s" + "\n\n"
140
142
  content += "发布环境: " + "#{package.configuration}" + "\n\n"
141
143
  content += "更新描述: " + final_change_log + "\n\n"
142
- content += "发布时间: " + Time.new.strftime("%Y-%m-%d_%H-%M-%S") + "\n\n"
144
+ content += "发布时间: " + Time.new.strftime("%Y年%m月%d日 %H时%M分%S") + "\n\n"
143
145
  content += "下载链接: [点我](#{@ipa_download_link})" + "\n\n"
144
146
  content += "![二维码](#{@qr_code_url})"
145
147
 
@@ -148,6 +150,7 @@ module OceanPackage
148
150
  content
149
151
  end
150
152
 
153
+ # 发送打包信息到钉钉
151
154
  def send_ding_talk_msg
152
155
  # 消息卡片,富文本
153
156
  title = make_web_hook_message_title
@@ -157,6 +160,13 @@ module OceanPackage
157
160
  ding.send_text_message(title, @at_mobiles)
158
161
  end
159
162
 
163
+ # 打包完成
164
+ def finished
165
+ Log.divider
166
+ Log.info("package finished")
167
+ Log.divider
168
+ end
169
+
160
170
  end
161
171
 
162
172
  end
@@ -5,9 +5,9 @@ module OceanPackage
5
5
 
6
6
  # 有效的 CONFIGURATION 值
7
7
  AVAILABLE_CONFIGURATIONS = %w(Debug Release)
8
- DEFAULT_CONFIGURATION = 'Debug'
9
- DEFAULT_COMPANY_NAME = 'YourCompanyName'
10
- DEFAULT_ARCHIVE_PATH = '$HOME/Documents/Ipas/'
8
+ DEFAULT_CONFIGURATION = "Debug"
9
+ DEFAULT_COMPANY_NAME = "YourCompanyName"
10
+ DEFAULT_ARCHIVE_PATH = "#{Dir.home}/Documents/Ipas/"
11
11
 
12
12
  end
13
13
 
@@ -28,20 +28,25 @@ module OceanPackage
28
28
  cmd = 'fir login'
29
29
  cmd += ' -T ' + @token
30
30
 
31
+ Log.divider
31
32
  Log.info("fir login command: #{cmd}")
33
+ Log.divider
32
34
 
33
35
  cmd
34
36
  end
35
37
 
36
38
  # 命令:上传ipa文件到fir平台
37
39
  def publish_cmd
38
- cmd = 'fir publish'
39
- cmd += ' ' + @ipa_file_path
40
- cmd += ' -c ' + @change_log
41
- cmd += ' -Q'
42
- cmd += ' | tee ' + @log_path
43
-
40
+ # @ipa_file_path @change_log @log_path 需要是字符串值!!!!!
41
+ cmd = "fir publish"
42
+ cmd += " " + "'#{@ipa_file_path}'"
43
+ cmd += " -c " + "'#{@change_log}'"
44
+ cmd += " -Q"
45
+ cmd += " | tee " + "'#{@log_path}'"
46
+
47
+ Log.divider
44
48
  Log.info("fir publish command: #{cmd}")
49
+ Log.divider
45
50
 
46
51
  cmd
47
52
  end
@@ -49,6 +54,7 @@ module OceanPackage
49
54
  # 运行
50
55
  def run
51
56
  unless check
57
+ # 后续会接入蒲公英分发平台,这里不退出程序 exit
52
58
  return
53
59
  end
54
60
  login
@@ -104,14 +110,18 @@ module OceanPackage
104
110
  # 正则表达式匹配
105
111
  pattern = /.*Release id is.*/
106
112
  release_id = ''
107
- File.open(@log_path, "r") do |f|
108
- f.each_line do |line|
109
- line_s = "#{line}"
110
- if line_s =~ pattern
111
- release_id = line_s.split(' ').last
112
- break
113
+ if File.exist?("#{@log_path}")
114
+ File.open(@log_path, "r") do |f|
115
+ f.each_line do |line|
116
+ line_s = "#{line}"
117
+ if line_s =~ pattern
118
+ release_id = line_s.split(' ').last
119
+ break
120
+ end
113
121
  end
114
122
  end
123
+ else
124
+ Log.info("fir log path not exist !!!")
115
125
  end
116
126
  Log.info("fir release id value: #{release_id}")
117
127
  release_id
@@ -122,14 +132,18 @@ module OceanPackage
122
132
  # 正则表达式匹配
123
133
  pattern = /.*Published succeed:.*/
124
134
  link = ''
125
- File.open(@log_path, "r") do |f|
126
- f.each_line do |line|
127
- line_s = "#{line}"
128
- if line_s =~ pattern
129
- link = line_s.split(' ').last
130
- break
135
+ if File.exist?("#{@log_path}")
136
+ File.open(@log_path, "r") do |f|
137
+ f.each_line do |line|
138
+ line_s = "#{line}"
139
+ if line_s =~ pattern
140
+ link = line_s.split(' ').last
141
+ break
142
+ end
131
143
  end
132
144
  end
145
+ else
146
+ Log.info("fir log path not exist !!!")
133
147
  end
134
148
  Log.info("fir link value: #{link}")
135
149
  link
@@ -151,14 +165,18 @@ module OceanPackage
151
165
  # 正则表达式匹配
152
166
  pattern = /.*Local qrcode file:.*/
153
167
  path = ''
154
- File.open(@log_path, "r") do |f|
155
- f.each_line do |line|
156
- line_s = "#{line}"
157
- if line_s =~ pattern
158
- path = line_s.split(' ').last
159
- break
168
+ if File.exist?("#{@log_path}")
169
+ File.open(@log_path, "r") do |f|
170
+ f.each_line do |line|
171
+ line_s = "#{line}"
172
+ if line_s =~ pattern
173
+ path = line_s.split(' ').last
174
+ break
175
+ end
160
176
  end
161
177
  end
178
+ else
179
+ Log.info("fir log path not exist !!!")
162
180
  end
163
181
  Log.info("fir qr code path value: #{path}")
164
182
  path
@@ -47,7 +47,9 @@ module OceanPackage
47
47
  cmd += ' '
48
48
  cmd += 'oss://' + @oss_bucket_name + oss_file_path(name)
49
49
 
50
+ Log.divider
50
51
  Log.info("oss upload_cmd: #{cmd}")
52
+ Log.divider
51
53
 
52
54
  cmd
53
55
  end
@@ -123,7 +123,7 @@ module OceanPackage
123
123
  Log.info("clean result: #{res}")
124
124
 
125
125
  unless res == true
126
- Log.error("clean fail, please check!!!")
126
+ Log.error("clean fail, please check !!!")
127
127
  exit(1)
128
128
  end
129
129
  end
@@ -235,6 +235,8 @@ module OceanPackage
235
235
  Log.info("ipa file path: #{path}")
236
236
 
237
237
  path
238
+
239
+ # 也可以在该目录下查找 ipa 后缀的文件
238
240
  end
239
241
 
240
242
  end
@@ -1,3 +1,3 @@
1
1
  module OceanPackage
2
- VERSION = "0.2.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean_package
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ocean
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-02 00:00:00.000000000 Z
11
+ date: 2020-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler