ocean_package 0.1.0 → 0.6.0

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
  SHA256:
3
- metadata.gz: f5db61be1518b5da4f3ef4c45e633dd297b100e764f727b6383dab1184d7785f
4
- data.tar.gz: e6033bd98e8e7c77040f6d718a0276d110621fee1c5761ac8bf977e6818b95cd
3
+ metadata.gz: 278a62419d25e625a28732bf86bf529dc840f3720733f550e1bc135e260c5289
4
+ data.tar.gz: a7852fbf63ee4f5b54e3ba8406f8e30618690e5c60e97f189bbc57b54e8dcf08
5
5
  SHA512:
6
- metadata.gz: 5c0a50632aff577c7afd3a1de8526a0a71e91c24e0401bb9f443a1fd1b8a24911dde8dff71f5dc82b5a9e939bfbc65119a81c22545a0a2faa61e4b121a40b76c
7
- data.tar.gz: 2831507550cb19d8778094f0a035ff7d230f3f9775874824f349ccb689c4bf044c889acdaf52cfc06826aec291a46ef4b497c246ac4509c5c7ca09ba278ffe91
6
+ metadata.gz: e4cd1de69f766edfae7040fc5c2e3f4536e07987efafc5ec4d7e78228ae58283a3fe4b2df306777518aebd5edd10aa7f4b1cab61a74079137d1742675e9fdf6a
7
+ data.tar.gz: 2f1d0110f5a0ba8fa7f0de52ea2c4b64eda35c42803ffa21f8a3f7e90f15ef260aa38042c42da3088765da8586bc21b03599214a8d748fa5ebe16287d47931f3
@@ -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
+ release_id = 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.1.0"
2
+ VERSION = "0.6.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.1.0
4
+ version: 0.6.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