fastlane-plugin-pgyer_v2 0.2.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 117c76ebaccaea4c3448dc02ed4c3bdb634ea8e8be7e8dfc6a7ff7e1790cdd45
4
+ data.tar.gz: '00580686b7532bb98a52185cc2ddd0229b6707922718877c883e978111703370'
5
+ SHA512:
6
+ metadata.gz: dbf54ba0800492fff9d8a3ad79d83f3ddc08db2016cb4e79758af3e8df349f067d912afa0d18869f640b86aaca3a089860882f44cb41c71450a646a9e40c83b5
7
+ data.tar.gz: 0d39de7c795f28a315e8abeab703ce52e2c88c10ee8cd8a79d03a4a2737616003e8840729c9d0a61348a1ece25592911acbbc382ffa908a3d61993798d1d581c
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 nice2m <ntm_xyz@163.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # pgyer_v2 plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-pgyer_v2)
4
+
5
+
6
+ ## 感谢[shishirui](https://github.com/shishirui),实现[pgyer 0.1.0](https://github.com/shishirui/fastlane-plugin-pgyer)
7
+
8
+ ## 开始集成
9
+
10
+ #### 第一步:
11
+
12
+ 覆盖以下内容到`fastlane\Pluginfile`文件内;
13
+
14
+ ```bash
15
+ gem 'fastlane-plugin-pgyer_v2',git: 'https://github.com/nice2m/fastlane-plugin-pgyer_v2'
16
+
17
+ ```
18
+
19
+
20
+ #### 第二步:
21
+ ```bash
22
+ cd [项目根目录下]
23
+
24
+ bundle update
25
+ ```
26
+
27
+
28
+ ## 关于 pgyer_v2
29
+
30
+
31
+ ### 原有实现 &问题
32
+
33
+ [原有实现](https://github.com/shishirui/fastlane-plugin-pgyer)
34
+
35
+ 原有插件未能获取类似于releaseId 的字段,一旦测试需要特殊的历史版本,需要每次到蒲公英控制台去获取下载地址;不是很方便;
36
+
37
+ #### 新版本
38
+ pgyer_v2,ipa 文件成功后的,解析类似于releaseId 字段,appIcon 哈希字段到
39
+ `fastlane\pgyer_upload_note_file.txt`中,以空格分隔;
40
+
41
+
42
+ iap上传完成服务器返回json
43
+
44
+ ```
45
+ {"code"=>0, "message"=>"", "data"=>{"appKey"=>"177d2bd5e3803dec08f36019d111034c", "userKey"=>"192ef1e7f5aafe7c5dfcfef44e3bcc", "appType"=>"1", "appIsLastest"=>"1", "appFileSize"=>"11331563", "appName"=>"美团", "appVersion"=>"1.1.12", "appVersionNo"=>"7", "appBuildVersion"=>"23", "appIdentifier"=>"com.tck.kidian", "appIcon"=>"f84c225a92edea360e837eb0decd8fe2", "appDescription"=>"美团是一款基于餐饮服务商和业务员的服务平台,以即时沟通为切入点,以专业服务作为产品特色和卖点,为餐饮服务商和业务员提供全面的服务和管理,包括:业务拓展、订单跟踪、客户拜访、个人信息等;", "appUpdateDescription"=>"测试服", "appScreenshots"=>"c9de904652e53a17ca47441344a37f6,ac61a777e6907466f054aa015c4d24e5,a2315a507bbe2e4598803327353bd6", "appShortcutUrl"=>"JfsN", "appCreated"=>"2020-06-22 18:45:34", "appUpdated"=>"2020-06-22 18:45:34", "appQRCodeURL"=>"http://www.pgyer.com/app/qrcodeHistory/9745d846808cf47eec73459135c65a0201158f01bc7f458f8f7304e208594"}}
46
+
47
+ ```
48
+
49
+
50
+ ## Fastfile配置参考
51
+ ```ruby
52
+ lane :beta do
53
+ gym
54
+ pgyer(
55
+ api_key: <pgy_api_key>,
56
+ user_key: <pgy_user_key>,
57
+ update_description: [pgy_release_note]
58
+ )
59
+
60
+ # pgyer_v2 插件生成的txt文件,获取到图标,下载地址
61
+ pgyer_upload_note_file_name = "./pgyer_upload_note_file.txt"
62
+ pgyer_note_content = IO.read(pgyer_upload_note_file_name)
63
+ notes_info_list = pgyer_note_content.split(" ")
64
+
65
+ # 带releaseId 的app下载链接
66
+ app_down_load_url = notes_info_list[0]
67
+ # app下载地址二维码链接
68
+ app_qr_code_img_url = notes_info_list[1]
69
+ # 带hash 的appIcon 图片链接
70
+ app_icon_url = notes_info_list[2]
71
+
72
+ puts app_down_load_url
73
+ puts app_qr_code_img_url
74
+ puts app_icon_url
75
+ end
76
+
77
+ ```
78
+
79
+
80
+ ## 问题反馈
81
+
82
+ 请直接提issue
83
+
84
+ [官网文档参考](https://docs.fastlane.tools/plugins/plugins-troubleshooting/)
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/pgyer_v2/version'
2
+
3
+ module Fastlane
4
+ module PgyerV2
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::PgyerV2.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,177 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class PgyerAction < Action
7
+ def self.run(params)
8
+ UI.message("The pgyer plugin is working.")
9
+
10
+ api_host = "http://qiniu-storage.pgyer.com/apiv1/app/upload"
11
+ pgyer_upload_note_file_name = "./fastlane/pgyer_upload_note_file.txt"
12
+ api_key = params[:api_key]
13
+ user_key = params[:user_key]
14
+
15
+ build_file = [
16
+ params[:ipa],
17
+ params[:apk]
18
+ ].detect { |e| !e.to_s.empty? }
19
+
20
+ if build_file.nil?
21
+ UI.user_error!("You have to provide a build file")
22
+ end
23
+
24
+ UI.message "build_file: #{build_file}"
25
+
26
+ password = params[:password]
27
+ if password.nil?
28
+ password = ""
29
+ end
30
+
31
+ update_description = params[:update_description]
32
+ if update_description.nil?
33
+ update_description = ""
34
+ end
35
+
36
+ install_type = params[:install_type]
37
+ if install_type.nil?
38
+ install_type = "1"
39
+ end
40
+
41
+ # start upload
42
+ conn_options = {
43
+ request: {
44
+ timeout: 1000,
45
+ open_timeout: 300
46
+ }
47
+ }
48
+
49
+ pgyer_client = Faraday.new(nil, conn_options) do |c|
50
+ c.request :multipart
51
+ c.request :url_encoded
52
+ c.response :json, content_type: /\bjson$/
53
+ c.adapter :net_http
54
+ end
55
+
56
+ params = {
57
+ '_api_key' => api_key,
58
+ 'uKey' => user_key,
59
+ 'password' => password,
60
+ 'updateDescription' => update_description,
61
+ 'installType' => install_type,
62
+ 'file' => Faraday::UploadIO.new(build_file, 'application/octet-stream')
63
+ }
64
+
65
+ UI.message "Start upload #{build_file} to pgyer..."
66
+
67
+ response = pgyer_client.post api_host, params
68
+ info = response.body
69
+
70
+ if info['code'] != 0
71
+ UI.user_error!("PGYER Plugin Error: #{info['message']}")
72
+ end
73
+
74
+ # test_begin
75
+ # puts "#{info}"
76
+ # test_end
77
+
78
+ # 下载地址唯一hash
79
+ # https://www.pgyer.com/<hash>
80
+ appKeyStr = info['data']['appKey']
81
+ appReleaseDownLoadURL = "https://www.pgyer.com/#{appKeyStr}"
82
+
83
+ # 下载地址二维码
84
+ # eg: http://www.pgyer.com/app/qrcodeHistory/08d70464a896f7ba38ef28daf54b018756a466efb6a6d268d07a404c55490614
85
+ appQRCodeURL = info['data']['appQRCodeURL']
86
+
87
+ # app 图标 唯一hash
88
+ # https://appicon.pgyer.com/image/view/app_icons/<hash>
89
+ appIconURLStr = "https://appicon.pgyer.com/image/view/app_icons/#{info['data']['appIcon']}"
90
+
91
+ writingContents = "#{appReleaseDownLoadURL}" + " #{appQRCodeURL}" + " #{appIconURLStr}"
92
+ File.open(pgyer_upload_note_file_name, 'w') {|f| f.write("#{writingContents}") }
93
+
94
+ UI.success "Upload success. Visit this URL to see: #{appReleaseDownLoadURL}"
95
+ end
96
+
97
+ def self.description
98
+ "distribute app to pgyer beta testing service"
99
+ end
100
+
101
+ def self.authors
102
+ ["nice2m"]
103
+ end
104
+
105
+ def self.return_value
106
+ # If your method provides a return value, you can describe here what it does
107
+ end
108
+
109
+ def self.details
110
+ # Optional:
111
+ "distribute app to pgyer beta testing service"
112
+ end
113
+
114
+ def self.available_options
115
+ [
116
+ FastlaneCore::ConfigItem.new(key: :api_key,
117
+ env_name: "PGYER_API_KEY",
118
+ description: "api_key in your pgyer account",
119
+ optional: false,
120
+ type: String),
121
+ FastlaneCore::ConfigItem.new(key: :user_key,
122
+ env_name: "PGYER_USER_KEY",
123
+ description: "user_key in your pgyer account",
124
+ optional: false,
125
+ type: String),
126
+ FastlaneCore::ConfigItem.new(key: :apk,
127
+ env_name: "PGYER_APK",
128
+ description: "Path to your APK file",
129
+ default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
130
+ optional: true,
131
+ verify_block: proc do |value|
132
+ UI.user_error!("Couldn't find apk file at path '#{value}'") unless File.exist?(value)
133
+ end,
134
+ conflicting_options: [:ipa],
135
+ conflict_block: proc do |value|
136
+ UI.user_error!("You can't use 'apk' and '#{value.key}' options in one run")
137
+ end),
138
+ FastlaneCore::ConfigItem.new(key: :ipa,
139
+ env_name: "PGYER_IPA",
140
+ description: "Path to your IPA file. Optional if you use the _gym_ or _xcodebuild_ action. For Mac zip the .app. For Android provide path to .apk file",
141
+ default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
142
+ optional: true,
143
+ verify_block: proc do |value|
144
+ UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value)
145
+ end,
146
+ conflicting_options: [:apk],
147
+ conflict_block: proc do |value|
148
+ UI.user_error!("You can't use 'ipa' and '#{value.key}' options in one run")
149
+ end),
150
+ FastlaneCore::ConfigItem.new(key: :password,
151
+ env_name: "PGYER_PASSWORD",
152
+ description: "set password to protect app",
153
+ optional: true,
154
+ type: String),
155
+ FastlaneCore::ConfigItem.new(key: :update_description,
156
+ env_name: "PGYER_UPDATE_DESCRIPTION",
157
+ description: "set update description for app",
158
+ optional: true,
159
+ type: String),
160
+ FastlaneCore::ConfigItem.new(key: :install_type,
161
+ env_name: "PGYER_INSTALL_TYPE",
162
+ description: "set install type for app (1=public, 2=password, 3=invite). Please set as a string",
163
+ optional: true,
164
+ type: String)
165
+ ]
166
+ end
167
+
168
+ def self.is_supported?(platform)
169
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
170
+ # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
171
+ #
172
+ [:ios, :mac, :android].include?(platform)
173
+ true
174
+ end
175
+ end
176
+ end
177
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
5
+
6
+ module Helper
7
+ class PgyerV2Helper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::PgyerV2Helper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the pgyer_v2 plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module PgyerV2
3
+ VERSION = "0.2.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-pgyer_v2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - nice2m
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-02-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pry
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
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: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
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: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
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: rspec_junit_formatter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
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: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 0.49.1
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 0.49.1
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-require_tools
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: simplecov
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: fastlane
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 2.146.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.146.1
139
+ description:
140
+ email: ntm_xyz@163.com
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/pgyer_v2.rb
148
+ - lib/fastlane/plugin/pgyer_v2/actions/pgyer_v2_action.rb
149
+ - lib/fastlane/plugin/pgyer_v2/helper/pgyer_v2_helper.rb
150
+ - lib/fastlane/plugin/pgyer_v2/version.rb
151
+ homepage: https://github.com/nice2m/fastlane-plugin-pgyer_v2
152
+ licenses:
153
+ - MIT
154
+ metadata: {}
155
+ post_install_message:
156
+ rdoc_options: []
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ requirements: []
170
+ rubygems_version: 3.0.6
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: pgyer for v2 suppor
174
+ test_files: []