ocean_package 0.4.0 → 0.10.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: 2a1ee274ecb771e9c45ab41f1ec4ead390df13079fc2cadfa7998f628cb07cb3
4
- data.tar.gz: 753c2c82aa31a8cdbd167d2fbe3ba7e39af3e92394e0bbb4db5403032dac5d9b
3
+ metadata.gz: b1cc955eed6aa74ce48c6a3cc59c5bda438162073b8e86f04ec75261badf3e10
4
+ data.tar.gz: 5bfbf7f168a9436e6c07245c9ec2455ab66e3e4b5df4e517d52202a599afb778
5
5
  SHA512:
6
- metadata.gz: 55c79b7bf1ccf7977526afbc04aa7507aa7f624e7175d3d6e1e56389ee28e25785e7cbe3230b0672eb71a68eb64b2bd07d74ba714e52c1c14c4b36fa6241364e
7
- data.tar.gz: 269aa4fa4cb5451b2fbe93538d7caa3f2d398d4c69762f30616909d7beb041dac08022a5a0f4093187533185a0b57012b1f91a897574474e6f367ba1a062df42
6
+ metadata.gz: 10f73f3b8c22d9551656918c397475cc82ddc2bedaac49bb6b57164b38033166a65d4e81cb7815ab589ecb3b2a38ca1fe52d84da41084cd66b7364a1f420fa74
7
+ data.tar.gz: c6af45c8b814831a267e29a43c6f89ba328b6bc7d0784a11e676328bc74c631152cea7b693438bf4124e06514eafae39761b362e758a019f8d545ffc3b321aa4
@@ -16,11 +16,13 @@
16
16
  <orderEntry type="library" scope="PROVIDED" name="claide (v1.0.3, ruby-2.6.3-p62) [gem]" level="application" />
17
17
  <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.1.6, ruby-2.6.3-p62) [gem]" level="application" />
18
18
  <orderEntry type="library" scope="PROVIDED" name="dingbot (v0.2.3, ruby-2.6.3-p62) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="faraday (v1.0.1, ruby-2.6.3-p62) [gem]" level="application" />
19
20
  <orderEntry type="library" scope="PROVIDED" name="httparty (v0.18.1, ruby-2.6.3-p62) [gem]" level="application" />
20
21
  <orderEntry type="library" scope="PROVIDED" name="mime-types (v3.3.1, ruby-2.6.3-p62) [gem]" level="application" />
21
22
  <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2020.0512, ruby-2.6.3-p62) [gem]" level="application" />
22
23
  <orderEntry type="library" scope="PROVIDED" name="minitest (v5.11.3, ruby-2.6.3-p62) [gem]" level="application" />
23
24
  <orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, ruby-2.6.3-p62) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="multipart-post (v2.1.1, ruby-2.6.3-p62) [gem]" level="application" />
24
26
  <orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, ruby-2.6.3-p62) [gem]" level="application" />
25
27
  <orderEntry type="library" scope="PROVIDED" name="semantic_logger (v4.7.1, ruby-2.6.3-p62) [gem]" level="application" />
26
28
  </component>
data/Gemfile CHANGED
@@ -9,3 +9,4 @@ gem 'claide', '~> 1.0', '>= 1.0.3'
9
9
  gem 'dingbot'
10
10
  gem 'CFPropertyList'
11
11
  gem 'semantic_logger'
12
+ gem 'faraday'
@@ -1,7 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ocean_package (0.3.0)
4
+ ocean_package (0.9.0)
5
+ CFPropertyList
6
+ dingbot
7
+ faraday
8
+ multipart-post
9
+ semantic_logger
5
10
 
6
11
  GEM
7
12
  remote: https://rubygems.org/
@@ -11,6 +16,8 @@ GEM
11
16
  concurrent-ruby (1.1.6)
12
17
  dingbot (0.2.3)
13
18
  httparty
19
+ faraday (1.0.1)
20
+ multipart-post (>= 1.2, < 3)
14
21
  httparty (0.18.1)
15
22
  mime-types (~> 3.0)
16
23
  multi_xml (>= 0.5.2)
@@ -19,6 +26,7 @@ GEM
19
26
  mime-types-data (3.2020.0512)
20
27
  minitest (5.11.3)
21
28
  multi_xml (0.6.0)
29
+ multipart-post (2.1.1)
22
30
  rake (10.5.0)
23
31
  semantic_logger (4.7.1)
24
32
  concurrent-ruby (~> 1.0)
@@ -31,6 +39,7 @@ DEPENDENCIES
31
39
  bundler (~> 1.17.2)
32
40
  claide (~> 1.0, >= 1.0.3)
33
41
  dingbot
42
+ faraday
34
43
  minitest (~> 5.0)
35
44
  ocean_package!
36
45
  rake (~> 10.0)
data/README.md CHANGED
@@ -24,24 +24,38 @@ or
24
24
 
25
25
  $ sudo gem install ocean_package
26
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
+
33
+ ```
34
+ sudo gem install dingbot
35
+ sudo gem install semantic_logger
36
+ sudo gem install multipart-post
37
+ ```
38
+
39
+
27
40
  ## Usage
28
41
 
29
42
  ```
30
- 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=需要@的人手机号
43
+ 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 --pgy-api-key=蒲公英平台的apikey --change-log=测试一下 --oss-bucket-name=bucket名称 --oss-bucket-path=bucket路径 --oss-endpoint=oss的endpoint --ding-token=钉钉群机器人token --at-mobiles=需要@的人手机号
31
44
  ```
32
45
 
33
46
  - `--workspace-path`: `.xcworkspace` 文件路径
34
47
  - `--scheme`: `scheme`
35
- - `--configuration`: Debug 和 Release
48
+ - `--configuration`: `Debug``Release`
36
49
  - `--archive-path`: 生成的 `.xcarchive` 文件目录
37
50
  - `--export-options-plist`: 打包用到的 `export-options` plist 文件路径
38
51
  - `--company-name`: 公司名称,可以不填
39
52
  - `--fir-token`: fir 平台的 token
53
+ - `--pgy-api-key`: 蒲公英平台的 api key
40
54
  - `--change-log`: 更新描述
41
- - `--oss-bucket-name`: oss bucket 名称
42
- - `--oss-bucket-path`: oss bucket 路径
43
- - `--oss-endpoint`: oss 的 endpoint
44
- - `--ding-token`: 钉钉群机器人的token
55
+ - `--oss-bucket-name`: `oss bucket` 名称
56
+ - `--oss-bucket-path`: `oss bucket` 路径
57
+ - `--oss-endpoint`: `oss``endpoint`
58
+ - `--ding-token`: 钉钉群机器人的`token`
45
59
  - `--at-mobiles`: 钉钉群需要 @ 的人手机号,多个用 `,` 拼接
46
60
 
47
61
 
@@ -2,6 +2,9 @@ require 'fileutils'
2
2
  require 'dingbot'
3
3
  require 'cfpropertylist'
4
4
  require 'semantic_logger'
5
+ require 'multipart_post'
6
+ require 'net/http/post/multipart'
7
+ require 'json'
5
8
 
6
9
  # 注意:这里使用 require_relative 来引用文件
7
10
  require_relative 'ocean_package/version'
@@ -14,6 +17,7 @@ require_relative 'ocean_package/dingtalk'
14
17
  require_relative 'ocean_package/ipa'
15
18
  require_relative 'ocean_package/logger'
16
19
  require_relative 'ocean_package/package'
20
+ require_relative 'ocean_package/pgy'
17
21
 
18
22
  module OceanPackage
19
23
  require 'claide'
@@ -26,16 +30,6 @@ module OceanPackage
26
30
  command = OceanPackage::Command.new(argvs)
27
31
  command.run
28
32
 
29
-
30
- # # command = OceanPackage::Command.new(config)
31
- #
32
- # argv = CLAide::ARGV.new(ARGV)
33
- # if !argv.arguments.include?("oceanpackage")
34
- # puts "不包含命令 oceanpackage"
35
- # exit 1
36
- # end
37
- #
38
- # puts "包含命令 oceanpackage"
39
33
  end
40
34
 
41
35
  end
@@ -6,6 +6,8 @@ module OceanPackage
6
6
  attr_accessor :package
7
7
  # fir 平台
8
8
  attr_accessor :fir
9
+ # 蒲公英平台
10
+ attr_accessor :pgy
9
11
  # oss 对象
10
12
  attr_accessor :oss
11
13
  # ding ding
@@ -20,6 +22,9 @@ module OceanPackage
20
22
  # @ 的手机号
21
23
  attr_accessor :at_mobiles
22
24
 
25
+ # 自定义的ipa文件路径
26
+ attr_accessor :custom_ipa_file_path
27
+
23
28
  def initialize(params = [])
24
29
  argv = CLAide::ARGV.new(params)
25
30
 
@@ -44,7 +49,15 @@ module OceanPackage
44
49
  export_options_plist = argv.option("export-options-plist", "")
45
50
  Log.info("export_options_plist: #{export_options_plist}")
46
51
 
47
- @package = OceanPackage::Package.new(workspace_path, scheme, configuration, archive_path, company_name, export_options_plist)
52
+ ##### 自定义的 ipa 文件 #####
53
+ ipa_file_path = argv.option("ipa-file-path", "")
54
+ Log.info("ipa_file_path: #{ipa_file_path}")
55
+ @custom_ipa_file_path = ipa_file_path
56
+
57
+ # 自定义ipa文件,使用该文件作为 archive path
58
+ tmp_archive_path = has_custom_ipa_file ? File.dirname("#{ipa_file_path}") : archive_path
59
+ Log.info("tmp_archive_path: #{tmp_archive_path}")
60
+ @package = OceanPackage::Package.new(workspace_path, scheme, configuration, tmp_archive_path, company_name, export_options_plist)
48
61
 
49
62
  fir_token = argv.option("fir-token", "")
50
63
  Log.info("fir_token: #{fir_token}")
@@ -54,7 +67,12 @@ module OceanPackage
54
67
  Log.info("change_log: #{change_log}")
55
68
 
56
69
  fir_log_path = @package.final_archive_path + 'fir.log'
57
- @fir = OceanPackage::Fir.new(fir_token, final_change_log, @package.ipa_file_path, fir_log_path)
70
+ @fir = OceanPackage::Fir.new(fir_token, final_change_log, final_ipa_file_path, fir_log_path)
71
+
72
+ ##### 蒲公英 #####
73
+ pgy_api_key = argv.option("pgy-api-key", "")
74
+ @pgy = OceanPackage::Pgy.new(pgy_api_key, final_change_log, final_ipa_file_path)
75
+ Log.info("pgy_api_key: #{pgy_api_key}")
58
76
 
59
77
  ##### oss #####
60
78
  oss_bucket_name = argv.option("oss-bucket-name", "")
@@ -87,8 +105,22 @@ module OceanPackage
87
105
  end
88
106
  end
89
107
 
108
+ # 是否设置了自定义的ipa文件
109
+ def has_custom_ipa_file
110
+ "#{@custom_ipa_file_path}".empty? ? false : true
111
+ end
112
+
113
+ # 最终的ipa文件路径
114
+ def final_ipa_file_path
115
+ has_custom_ipa_file ? "#{@custom_ipa_file_path}" : @package.ipa_file_path
116
+ end
117
+
118
+ # 运行
90
119
  def run
91
- package.run
120
+ # 没有自定义ipa文件,需要执行打包命令
121
+ unless has_custom_ipa_file
122
+ package.run
123
+ end
92
124
  upload
93
125
  send_ding_talk_msg
94
126
  finished
@@ -96,9 +128,22 @@ module OceanPackage
96
128
 
97
129
  # 上传 ipa 文件
98
130
  def upload
99
- upload_to_fir
131
+ can_fir = fir.check
132
+ can_pgy = pgy.check
133
+ if can_fir
134
+ Log.info("publish platform: fir")
135
+ upload_to_fir
136
+ elsif can_pgy
137
+ Log.info("publish platform: pgy")
138
+ upload_to_pgy
139
+ else
140
+ Log.info("publish platform: none, exit")
141
+ exit(1)
142
+ end
100
143
  end
101
144
 
145
+ # ------ fir 平台 -------
146
+
102
147
  # 上传到 fir 平台
103
148
  def upload_to_fir
104
149
  fir.run
@@ -112,6 +157,13 @@ module OceanPackage
112
157
  @qr_code_url = oss.upload(path, name)
113
158
  end
114
159
 
160
+ # ------ pgy 平台 -------
161
+ def upload_to_pgy
162
+ pgy.run
163
+ @qr_code_url = pgy.get_qr_code_url
164
+ @ipa_download_link = pgy.get_download_url
165
+ end
166
+
115
167
  # 总共时间,单位 秒 s
116
168
  def compute_total_time
117
169
  time1 = package.start_time
@@ -130,7 +182,7 @@ module OceanPackage
130
182
 
131
183
  # web hook 消息内容
132
184
  def make_web_hook_message
133
- ipa = OceanPackage::Ipa.new(package.ipa_file_path)
185
+ ipa = OceanPackage::Ipa.new(final_ipa_file_path)
134
186
  ipa.run
135
187
 
136
188
  # markdown 格式
@@ -145,7 +197,9 @@ module OceanPackage
145
197
  content += "下载链接: [点我](#{@ipa_download_link})" + "\n\n"
146
198
  content += "![二维码](#{@qr_code_url})"
147
199
 
200
+ Log.divider
148
201
  Log.info("web hook message: \n#{content}")
202
+ Log.divider
149
203
 
150
204
  content
151
205
  end
@@ -37,11 +37,12 @@ module OceanPackage
37
37
 
38
38
  # 命令:上传ipa文件到fir平台
39
39
  def publish_cmd
40
- cmd = 'fir publish'
41
- cmd += ' ' + @ipa_file_path
42
- cmd += ' -c ' + @change_log
43
- cmd += ' -Q'
44
- cmd += ' | tee ' + @log_path
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}'"
45
46
 
46
47
  Log.divider
47
48
  Log.info("fir publish command: #{cmd}")
@@ -109,14 +110,18 @@ module OceanPackage
109
110
  # 正则表达式匹配
110
111
  pattern = /.*Release id is.*/
111
112
  release_id = ''
112
- File.open(@log_path, "r") do |f|
113
- f.each_line do |line|
114
- line_s = "#{line}"
115
- if line_s =~ pattern
116
- release_id = line_s.split(' ').last
117
- 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
118
121
  end
119
122
  end
123
+ else
124
+ Log.info("fir log path not exist !!!")
120
125
  end
121
126
  Log.info("fir release id value: #{release_id}")
122
127
  release_id
@@ -127,14 +132,18 @@ module OceanPackage
127
132
  # 正则表达式匹配
128
133
  pattern = /.*Published succeed:.*/
129
134
  link = ''
130
- File.open(@log_path, "r") do |f|
131
- f.each_line do |line|
132
- line_s = "#{line}"
133
- if line_s =~ pattern
134
- link = line_s.split(' ').last
135
- 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
136
143
  end
137
144
  end
145
+ else
146
+ Log.info("fir log path not exist !!!")
138
147
  end
139
148
  Log.info("fir link value: #{link}")
140
149
  link
@@ -156,14 +165,18 @@ module OceanPackage
156
165
  # 正则表达式匹配
157
166
  pattern = /.*Local qrcode file:.*/
158
167
  path = ''
159
- File.open(@log_path, "r") do |f|
160
- f.each_line do |line|
161
- line_s = "#{line}"
162
- if line_s =~ pattern
163
- path = line_s.split(' ').last
164
- 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
165
176
  end
166
177
  end
178
+ else
179
+ Log.info("fir log path not exist !!!")
167
180
  end
168
181
  Log.info("fir qr code path value: #{path}")
169
182
  path
@@ -17,6 +17,12 @@ module OceanPackage
17
17
  logger = Logger.new(STDOUT)
18
18
  logger.info("=========")
19
19
  end
20
+
21
+ # 换行
22
+ def Log.new_line
23
+ logger = Logger.new(STDOUT)
24
+ logger.info("\n")
25
+ end
20
26
  end
21
27
  end
22
28
 
@@ -33,6 +33,9 @@ module OceanPackage
33
33
  @company_name = company_name
34
34
  @date_time = Time.new.strftime("%Y-%m-%d_%H-%M-%S")
35
35
  @export_options_plist = export_options_plist
36
+
37
+ # 预设置开始时间
38
+ @start_time = Time.now
36
39
  end
37
40
 
38
41
  # workspace 的路径
@@ -60,6 +63,7 @@ module OceanPackage
60
63
  @end_time = Time.now
61
64
  # 返回打包成功的 ipa 文件路径
62
65
  ipa_file_path
66
+ open_ipa_file_path
63
67
  end
64
68
 
65
69
  # 一些校验
@@ -144,12 +148,19 @@ module OceanPackage
144
148
  # 最终的打包路径
145
149
  def final_archive_path
146
150
  path = processed_archive_path
147
- path += @company_name + '/'
148
- path += project_name + '/'
151
+ unless "#{@company_name}".empty?
152
+ path += @company_name + '/'
153
+ end
154
+ unless "#{project_name}".empty?
155
+ path += project_name + '/'
156
+ end
149
157
  path += @date_time + '/'
150
158
 
151
159
  Log.info("final archive path: #{path}")
152
160
 
161
+ # 不存在,需要进行创建,外部传入了 ipa 文件的情况
162
+ FileUtils.mkdir_p(path)
163
+
153
164
  path
154
165
  end
155
166
 
@@ -239,6 +250,13 @@ module OceanPackage
239
250
  # 也可以在该目录下查找 ipa 后缀的文件
240
251
  end
241
252
 
253
+ # 打开所在目录
254
+ def open_ipa_file_path
255
+ path = final_archive_path
256
+ open_cmd = "open #{path}"
257
+ system(open_cmd)
258
+ end
259
+
242
260
  end
243
261
 
244
262
  end
@@ -0,0 +1,148 @@
1
+
2
+ module OceanPackage
3
+ class Pgy
4
+ require 'multipart_post'
5
+ require 'net/http/post/multipart'
6
+ require 'json'
7
+
8
+ # # 用户Key,用来标识当前用户的身份
9
+ # attr_accessor :user_key
10
+ # API Key,用来识别API调用者的身份,如不特别说明,每个接口中都需要含有此参数。
11
+ attr_accessor :api_key
12
+ # # 表示一个App组的唯一Key。
13
+ # attr_accessor :app_key
14
+ # 更新日志
15
+ attr_accessor :change_log
16
+ # ipa文件包路径
17
+ attr_accessor :ipa_file_path
18
+
19
+ # 短链接
20
+ attr_accessor :short_url
21
+ # 二维码链接
22
+ attr_accessor :qr_code_url
23
+
24
+ # 初始化
25
+ def initialize(api_key, change_log, ipa_file_path)
26
+ @api_key = api_key
27
+ @change_log = change_log
28
+ @ipa_file_path = ipa_file_path
29
+ @short_url = ""
30
+ @qr_code_url = ""
31
+ end
32
+
33
+ # 校验
34
+ def check
35
+
36
+ # user_key_value = "#{@user_key}"
37
+ # if user_key_value.empty?
38
+ # Log.error("pgy user key is empty, please check !!!")
39
+ # return false
40
+ # end
41
+
42
+ api_key_value = "#{@api_key}"
43
+ if api_key_value.empty?
44
+ Log.error("pgy api key is empty, please check !!!")
45
+ return false
46
+ end
47
+
48
+ # app_key_value = "#{@app_key}"
49
+ # if app_key_value.empty?
50
+ # Log.error("pgy app key is empty, please check !!!")
51
+ # return false
52
+ # end
53
+
54
+ ipa_file_path_value = "#{@ipa_file_path}"
55
+ if ipa_file_path_value.empty?
56
+ Log.error("ipa file path is empty, please check !!!")
57
+ return false
58
+ end
59
+
60
+ return true
61
+ end
62
+
63
+ # 运行
64
+ def run
65
+ unless check
66
+ return
67
+ end
68
+ publish
69
+ end
70
+
71
+ # 上传
72
+ def publish
73
+ url = URI.parse('https://www.pgyer.com/apiv2/app/upload')
74
+ File.open("#{@ipa_file_path}") do |ipa|
75
+
76
+ # 构建必要的参数
77
+ ipa_file_name = Time.new.strftime("%Y-%m-%d_%H-%M-%S") + ".ipa"
78
+ require_params = {
79
+ "file" => UploadIO.new(ipa, "multipart/form-data", ipa_file_name),
80
+ "_api_key" => "#{@api_key}",
81
+ "buildUpdateDescription" => "#{@change_log}",
82
+ }
83
+
84
+ # 构造请求
85
+ req = Net::HTTP::Post::Multipart.new(url.path, require_params)
86
+
87
+ # 网络http
88
+ net = Net::HTTP.new(url.host, url.port)
89
+ # 这里需要设置,否则会有 EPIPE: Broken pipe 错误
90
+ net.use_ssl = true
91
+ net.verify_mode = OpenSSL::SSL::VERIFY_NONE
92
+ net.set_debug_output($stdout)
93
+
94
+ # 发起请求
95
+ res = net.start do |http|
96
+ http.use_ssl = true
97
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
98
+ http.request(req)
99
+ end
100
+
101
+ Log.divider
102
+ Log.info(res)
103
+
104
+ # 具体参考 https://www.pgyer.com/doc/view/api#paramInfo
105
+ case res
106
+ when Net::HTTPSuccess
107
+ # 响应是字符串类型,需要转为json进行处理
108
+ json_value = JSON.parse(res.body)
109
+ Log.divider
110
+ Log.info(json_value)
111
+ # 成功
112
+ data = json_value["data"]
113
+ short_url = data["buildShortcutUrl"]
114
+ qr_code_url = data["buildQRCodeURL"]
115
+ @short_url = short_url
116
+ @qr_code_url = qr_code_url
117
+ Log.error(@short_url)
118
+ Log.error(@qr_code_url)
119
+ else
120
+ # 失败
121
+ Log.error("pgy publish fail, please check !!!")
122
+ exit(1)
123
+ end
124
+ end
125
+ end
126
+
127
+ # 获取下载链接
128
+ def get_download_url
129
+ # 需要有固定的前缀
130
+ url = "https://www.pgyer.com/" + @short_url
131
+
132
+ Log.divider
133
+ Log.info(url)
134
+
135
+ url
136
+ end
137
+
138
+ # 获取二维码链接
139
+ def get_qr_code_url
140
+ url = "#{@qr_code_url}"
141
+
142
+ Log.divider
143
+ Log.info(url)
144
+
145
+ url
146
+ end
147
+ end
148
+ end
@@ -1,3 +1,3 @@
1
1
  module OceanPackage
2
- VERSION = "0.4.0"
2
+ VERSION = "0.10.0"
3
3
  end
@@ -37,6 +37,12 @@ Gem::Specification.new do |spec|
37
37
  spec.executables << 'oceanpackage'
38
38
  spec.require_paths = ["lib"]
39
39
 
40
+ spec.add_dependency 'dingbot'
41
+ spec.add_dependency 'CFPropertyList'
42
+ spec.add_dependency 'semantic_logger'
43
+ spec.add_dependency 'faraday'
44
+ spec.add_dependency 'multipart-post'
45
+
40
46
  spec.add_development_dependency "bundler", "~> 1.17.2"
41
47
  spec.add_development_dependency "rake", "~> 10.0"
42
48
  spec.add_development_dependency "minitest", "~> 5.0"
metadata CHANGED
@@ -1,15 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean_package
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.10.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-06 00:00:00.000000000 Z
11
+ date: 2020-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dingbot
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: CFPropertyList
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: semantic_logger
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: faraday
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: multipart-post
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
13
83
  - !ruby/object:Gem::Dependency
14
84
  name: bundler
15
85
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +159,7 @@ files:
89
159
  - lib/ocean_package/logger.rb
90
160
  - lib/ocean_package/oss.rb
91
161
  - lib/ocean_package/package.rb
162
+ - lib/ocean_package/pgy.rb
92
163
  - lib/ocean_package/version.rb
93
164
  - ocean_package.gemspec
94
165
  homepage: https://github.com/oceanfive/ocean_package