fastlane-plugin-pgyer_jvtd 0.1.9 → 0.2.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: 7f8c587ccbfc7dcee745819c50522cb8e737ba7542215a463f9f4f8d8c183725
4
- data.tar.gz: 31a78ee038877db925778cae0bf38277dd06e912e3194c043f99169238316cd3
3
+ metadata.gz: 46c1860890a0a9b95e9244dfd105dcfd0ba618117050f6504ca96b318d6e9d13
4
+ data.tar.gz: 9534c55c8abaf7b7239450b66026700ed9a54a5dc24a775b781820829ba5dfb9
5
5
  SHA512:
6
- metadata.gz: bae10a3f5e5241dd9da70e6b4a55d3c92a588fdef728148878a553c4af2ae9192f23b83846469e834f91c963f26d505b9072d294418c01b41b94a5da91aae9c9
7
- data.tar.gz: 7b03d02f7f18b23ca85b80b06e19947e6f23425bfbcc7f81666eff28dd831fb7765fe71c1de8097c6f9c4c29cf12f2754d6bc8a69fc5936152e89589cf79a0e8
6
+ metadata.gz: b859df1e456ae380e4749a6894c82ea011c57668916d45de35621bcd41f951da8ea0c6da2e6cfd59c105782c24c5cb1e7f114d990f68013fbd0d0c526c31990c
7
+ data.tar.gz: 40ad9e907d84af31a1b65300c46753e4d35f4087e81b7549465a7390825b0e22f18020dbc3758a78be40f77dea37154e7fd727ca96335dff8562a11ae6572328
@@ -17,75 +17,78 @@ module Fastlane
17
17
  is_at_all = "0"
18
18
  end
19
19
 
20
- build_file = [
21
- params[:ipa],
22
- params[:apk]
23
- ].detect { |e| !e.to_s.empty? }
20
+ info = nil
24
21
 
25
- if build_file.nil?
26
- UI.user_error!("You have to provide a build file")
27
- end
22
+ if api_key.nil?
23
+ build_file = [
24
+ params[:ipa],
25
+ params[:apk]
26
+ ].detect { |e| !e.to_s.empty? }
28
27
 
29
- UI.message "build_file: #{build_file}"
28
+ if build_file.nil?
29
+ UI.user_error!("You have to provide a build file")
30
+ end
30
31
 
31
- password = params[:password]
32
- if password.nil?
33
- password = ""
34
- end
32
+ UI.message "build_file: #{build_file}"
35
33
 
36
- update_description = params[:update_description]
37
- if update_description.nil?
38
- update_description = ""
39
- end
34
+ password = params[:password]
35
+ if password.nil?
36
+ password = ""
37
+ end
40
38
 
41
- install_type = params[:install_type]
42
- if install_type.nil?
43
- install_type = "1"
44
- end
39
+ update_description = params[:update_description]
40
+ if update_description.nil?
41
+ update_description = ""
42
+ end
45
43
 
46
- channel_shortcut = params[:channel_shortcut]
47
- if channel_shortcut.nil?
48
- channel_shortcut = ""
49
- end
44
+ install_type = params[:install_type]
45
+ if install_type.nil?
46
+ install_type = "1"
47
+ end
50
48
 
51
- # start upload
52
- conn_options = {
53
- request: {
54
- timeout: 1000,
55
- open_timeout: 300
56
- }
57
- }
58
-
59
- pgyer_client = Faraday.new(nil, conn_options) do |c|
60
- c.request :multipart
61
- c.request :url_encoded
62
- c.response :json, content_type: /\bjson$/
63
- c.adapter :net_http
64
- end
49
+ channel_shortcut = params[:channel_shortcut]
50
+ if channel_shortcut.nil?
51
+ channel_shortcut = ""
52
+ end
65
53
 
66
- params = {
67
- '_api_key' => api_key,
68
- 'uKey' => user_key,
69
- 'password' => password,
70
- 'updateDescription' => update_description,
71
- 'installType' => install_type,
72
- 'channelShortcut' => channel_shortcut,
73
- 'file' => Faraday::UploadIO.new(build_file, 'application/octet-stream')
74
- }
54
+ # start upload
55
+ conn_options = {
56
+ request: {
57
+ timeout: 1000,
58
+ open_timeout: 300
59
+ }
60
+ }
75
61
 
76
- UI.message "Start upload #{build_file} to pgyer..."
62
+ pgyer_client = Faraday.new(nil, conn_options) do |c|
63
+ c.request :multipart
64
+ c.request :url_encoded
65
+ c.response :json, content_type: /\bjson$/
66
+ c.adapter :net_http
67
+ end
77
68
 
78
- response = pgyer_client.post api_host, params
79
- info = response.body
69
+ params = {
70
+ '_api_key' => api_key,
71
+ 'uKey' => user_key,
72
+ 'password' => password,
73
+ 'updateDescription' => update_description,
74
+ 'installType' => install_type,
75
+ 'channelShortcut' => channel_shortcut,
76
+ 'file' => Faraday::UploadIO.new(build_file, 'application/octet-stream')
77
+ }
80
78
 
81
- if info['code'] != 0
82
- UI.user_error!("PGYER Plugin Error: #{info['message']}")
83
- return
84
- end
79
+ UI.message "Start upload #{build_file} to pgyer..."
85
80
 
86
- UI.success "Upload success. Visit this URL to see: https://www.pgyer.com/#{info['data']['appShortcutUrl']}"
81
+ response = pgyer_client.post api_host, params
82
+ info = response.body
87
83
 
84
+ if info['code'] != 0
85
+ UI.user_error!("PGYER Plugin Error: #{info['message']}")
86
+ return
87
+ end
88
88
 
89
+ UI.success "Upload success. Visit this URL to see: https://www.pgyer.com/#{info['data']['appShortcutUrl']}"
90
+ else
91
+ end
89
92
  # 应用类型
90
93
  appType = "Android";
91
94
  if info['data']['appType'] == 1
@@ -94,22 +97,37 @@ module Fastlane
94
97
 
95
98
  # 应用名称
96
99
  appName = info['data']['appName']
100
+ if appName.nil?
101
+ appName = "测试应用"
102
+ end
97
103
  # 应用版本信息
98
104
  appVersion = info['data']['appVersion']
105
+ if appVersion.nil?
106
+ appVersion = "1.0.0"
107
+ end
99
108
  # 应用蒲公英版本
100
109
  appBuildVersion = info['data']['appBuildVersion']
110
+ if appBuildVersion.nil?
111
+ appBuildVersion = 1
112
+ end
101
113
  # 图标
102
114
  appIcon = "https://appicon.pgyer.com/image/view/app_icons/#{info['data']['appIcon']}"
115
+ if appIcon.nil?
116
+ appIcon = ""
117
+ end
103
118
  # 地址
104
119
  appUrl = "https://www.pgyer.com/#{info['data']['appShortcutUrl']}"
120
+ if appUrl.nil?
121
+ appUrl = "https://www.pgyer.com"
122
+ end
105
123
 
106
124
  unless access_token.nil?
107
- uri = URI.parse("https://oapi.dingtalk.com/robot/send?access_token=#{access_token}")
108
- #https://oapi.dingtalk.com/robot/send?access_token=e3a3fc0e5a8c95bcc4e910b8939beb100db190752fef3756e86efa46578cd869
125
+ uriStr = "https://oapi.dingtalk.com/robot/send?access_token=#{access_token}";
126
+ uri = URI.parse(uriStr)
127
+ UI.success uriStr
109
128
  dingtalk_client = Faraday.new(nil, conn_options) do |c|
110
129
  c.request :url_encoded
111
130
  c.response :json, content_type: /\bjson$/
112
- c.adapter :net_http
113
131
  end
114
132
 
115
133
  params = {
@@ -132,7 +150,6 @@ module Fastlane
132
150
  dingtalk2_client = Faraday.new(nil, conn_options) do |c|
133
151
  c.request :url_encoded
134
152
  c.response :json, content_type: /\bjson$/
135
- c.adapter :net_http
136
153
  end
137
154
 
138
155
  params = {
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module PgyerJvtd
3
- VERSION = "0.1.9"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-pgyer_jvtd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 陈磊的MacBook Pro