fastlane-plugin-upload_dsym_to_bugly 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/fastlane/plugin/upload_dsym_to_bugly/actions/upload_app_to_bugly_action.rb +201 -0
- data/lib/fastlane/plugin/upload_dsym_to_bugly/actions/upload_dsym_to_bugly_action.rb +79 -66
- data/lib/fastlane/plugin/upload_dsym_to_bugly/version.rb +1 -1
- metadata +4 -5
- data/lib/fastlane/plugin/upload_dsym_to_bugly/actions/upload_ipa_to_bugly_action.rb +0 -186
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 548083004333712175e0d6cf6a5b4f5a7ba2f141aa74dea2b9fd7af43def3408
|
4
|
+
data.tar.gz: 45734057d3fdeb56cddfc0175714d2da775b68f453b1d805982ec7d42a03966b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9a5115b828e61939b08be35f161a0949308ffb26662cb148a57fc5027f879ecd315cb479a93bc80dfc4e8ef0b7625b33255be0fca0bf5057178d4ffec95f1f4
|
7
|
+
data.tar.gz: 3bf38946476d3001d677a19e4bb0423311ae169a72e09c5b75b1ccaf9d8af45e1d4c712c17233644c66fc299502036bf995576dff8ee7d4af593bebd7edbd0b0
|
data/README.md
CHANGED
@@ -14,21 +14,21 @@ add the following to your `fastfile`
|
|
14
14
|
```ruby
|
15
15
|
lane :upload_dysm do
|
16
16
|
upload_dsym_to_bugly(
|
17
|
-
file_path: "<your dSYM.zip path>",
|
17
|
+
file_path: "<your dSYM.zip path>/<your dSYM.zip name>",
|
18
18
|
file_name: "<your dSYM.zip name>",
|
19
19
|
app_key: "<your app_key>",
|
20
20
|
app_id:"<your app_id>",
|
21
21
|
api_version: 1,
|
22
22
|
symbol_type: 2, # iOS => 2, Android => 1
|
23
23
|
bundle_id: '<your bundle id>',
|
24
|
-
product_version:
|
24
|
+
product_version: get_version_number
|
25
25
|
)
|
26
26
|
end
|
27
27
|
```
|
28
28
|
|
29
29
|
if you want to upload your ipa to bugly, add the following to your `fastfile`
|
30
30
|
```ruby
|
31
|
-
lane :
|
31
|
+
lane :upload_app do
|
32
32
|
upload_app_to_bugly(
|
33
33
|
file_path:"<your *.ipa filepath>",
|
34
34
|
app_key:"<your app_key>",
|
@@ -0,0 +1,201 @@
|
|
1
|
+
require "fastlane/action"
|
2
|
+
require_relative "../helper/upload_dsym_to_bugly_helper"
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
UPLOAD_APP_TO_BUGLY_DOWNLOAD_URL = :UPLOAD_APP_TO_BUGLY_DOWNLOAD_URL
|
8
|
+
end
|
9
|
+
|
10
|
+
# To share this integration with the other fastlane users:
|
11
|
+
# - Fork https://github.com/fastlane/fastlane/tree/master/fastlane
|
12
|
+
# - Clone the forked repository
|
13
|
+
# - Move this integration into lib/fastlane/actions
|
14
|
+
# - Commit, push and submit the pull request
|
15
|
+
|
16
|
+
class UploadAppToBuglyAction < Action
|
17
|
+
def self.run(params)
|
18
|
+
require "json"
|
19
|
+
# fastlane will take care of reading in the parameter and fetching the environment variable:
|
20
|
+
UI.message "file path: #{params[:file_path]}"
|
21
|
+
|
22
|
+
json_file = "upload_app_to_bugly_result.json"
|
23
|
+
|
24
|
+
begin
|
25
|
+
secret = ""
|
26
|
+
if !params[:secret].to_s.nil? && !params[:secret].empty?
|
27
|
+
secret = " -F \"secret=#{params[:secret]}\" "
|
28
|
+
UI.message "secret:#{secret}"
|
29
|
+
end
|
30
|
+
rescue Exception => e
|
31
|
+
UI.message "error at checking secret,caused by #{e}"
|
32
|
+
return
|
33
|
+
end
|
34
|
+
|
35
|
+
begin
|
36
|
+
users = ""
|
37
|
+
if !params[:users].nil? && !params[:users].empty?
|
38
|
+
users = " -F \"users=#{params[:users]}\" "
|
39
|
+
UI.message "users:#{users}"
|
40
|
+
end
|
41
|
+
rescue Exception => e
|
42
|
+
UI.message "error at checking users,caused by #{e}"
|
43
|
+
return
|
44
|
+
end
|
45
|
+
|
46
|
+
begin
|
47
|
+
password = ""
|
48
|
+
if !params[:password].nil? && !params[:password].empty?
|
49
|
+
password = " -F \"password=#{params[:password]}\" "
|
50
|
+
UI.message "password:#{password}"
|
51
|
+
end
|
52
|
+
rescue Exception => e
|
53
|
+
UI.message "error at checking password,caused by #{e}"
|
54
|
+
return
|
55
|
+
end
|
56
|
+
|
57
|
+
begin
|
58
|
+
download_limit = ""
|
59
|
+
if !params[:download_limit].nil? && params[:download_limit] > 0
|
60
|
+
download_limit = " -F \"download_limit=#{params[:download_limit]}\" "
|
61
|
+
UI.message "download_limit:#{download_limit}"
|
62
|
+
end
|
63
|
+
rescue Exception => e
|
64
|
+
UI.message "error at checking download_limit,caused by #{e}"
|
65
|
+
return
|
66
|
+
end
|
67
|
+
|
68
|
+
cmd = "curl --insecure -F \"file=@#{params[:file_path]}\" -F \"app_id=#{params[:app_id]}\" -F \"pid=#{params[:pid]}\" -F \"title=#{params[:title]}\" -F \"description=#{params[:desc]}\"" + secret + users + password + download_limit + " https://api.bugly.qq.com/beta/apiv1/exp?app_key=#{params[:app_key]} -o " + json_file
|
69
|
+
begin
|
70
|
+
sh(cmd)
|
71
|
+
obj = JSON.parse(File.read(json_file))
|
72
|
+
`rm upload_dsym_to_bugly_result.json`
|
73
|
+
ret = obj["rtcode"]
|
74
|
+
if ret == 0
|
75
|
+
UI.message "upload success"
|
76
|
+
url = obj["data"]["url"]
|
77
|
+
Actions.lane_context[SharedValues::UPLOAD_APP_TO_BUGLY_DOWNLOAD_URL] = url
|
78
|
+
UI.message "upload success, link: #{url}"
|
79
|
+
else
|
80
|
+
UI.message "upload failed,result is #{obj}"
|
81
|
+
raise if params[:raise_if_error]
|
82
|
+
end
|
83
|
+
rescue
|
84
|
+
UI.message "upload failed"
|
85
|
+
raise if params[:raise_if_error]
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
#####################################################
|
90
|
+
# @!group Documentation
|
91
|
+
#####################################################
|
92
|
+
|
93
|
+
def self.description
|
94
|
+
"upload_app_to_bugly"
|
95
|
+
end
|
96
|
+
|
97
|
+
def self.details
|
98
|
+
# Optional:
|
99
|
+
# this is your chance to provide a more detailed description of this action
|
100
|
+
"You can use this action to do cool things..."
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.available_options
|
104
|
+
# Define all options your action supports.
|
105
|
+
|
106
|
+
# Below a few examples
|
107
|
+
[
|
108
|
+
FastlaneCore::ConfigItem.new(key: :file_path,
|
109
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_FILE_PATH",
|
110
|
+
description: "file path for UploadAppToBuglyAction",
|
111
|
+
is_string: true,
|
112
|
+
verify_block: proc do |value|
|
113
|
+
UI.user_error!("No file path for UploadAppToBuglyAction given, pass using `file_path: 'path'`") unless value && !value.empty?
|
114
|
+
UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
|
115
|
+
end),
|
116
|
+
FastlaneCore::ConfigItem.new(key: :app_key,
|
117
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_APP_KEY",
|
118
|
+
description: "app key for UploadAppToBuglyAction",
|
119
|
+
is_string: true,
|
120
|
+
verify_block: proc do |value|
|
121
|
+
UI.user_error!("NO app_key for UploadAppToBuglyAction given, pass using `app_key: 'app_key'`") unless value && !value.empty?
|
122
|
+
end),
|
123
|
+
FastlaneCore::ConfigItem.new(key: :app_id,
|
124
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_APP_ID",
|
125
|
+
description: "app id for UploadAppToBuglyAction",
|
126
|
+
is_string: true,
|
127
|
+
verify_block: proc do |value|
|
128
|
+
UI.user_error!("No app_id for UploadAppToBuglyAction given, pass using `app_id: 'app_id'`") unless value && !value.empty?
|
129
|
+
end),
|
130
|
+
FastlaneCore::ConfigItem.new(key: :pid,
|
131
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_PID",
|
132
|
+
description: "pid for UploadToBuglyAction",
|
133
|
+
is_string: true,
|
134
|
+
verify_block: proc do |value|
|
135
|
+
UI.user_error!("No pid for UploadAppToBuglyAction given, pass using `pid: 'pid'`") unless value && !value.empty?
|
136
|
+
end),
|
137
|
+
FastlaneCore::ConfigItem.new(key: :title,
|
138
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_TITLE",
|
139
|
+
description: "title for UploadAppToBuglyAction",
|
140
|
+
is_string: true,
|
141
|
+
default_value: "title",
|
142
|
+
verify_block: proc do |value|
|
143
|
+
UI.user_error!("No title for UploadAppToBuglyAction given, pass using `title: 'title'`") unless value && !value.empty?
|
144
|
+
end),
|
145
|
+
FastlaneCore::ConfigItem.new(key: :desc,
|
146
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_DESC",
|
147
|
+
description: "desc for UploadAppToBuglyAction",
|
148
|
+
is_string: true,
|
149
|
+
default_value: "desc"),
|
150
|
+
FastlaneCore::ConfigItem.new(key: :secret,
|
151
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_SECRET",
|
152
|
+
description: "secret for UploadAppToBuglyAction",
|
153
|
+
is_string: true,
|
154
|
+
default_value: ""),
|
155
|
+
FastlaneCore::ConfigItem.new(key: :users,
|
156
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_USERS",
|
157
|
+
description: "users for UploadAppToBuglyAction",
|
158
|
+
is_string: true,
|
159
|
+
default_value: ""),
|
160
|
+
FastlaneCore::ConfigItem.new(key: :password,
|
161
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_PASSWORD",
|
162
|
+
description: "password for UploadAppToBuglyAction",
|
163
|
+
is_string: true,
|
164
|
+
default_value: ""),
|
165
|
+
FastlaneCore::ConfigItem.new(key: :download_limit,
|
166
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_DOWNLOAD_LIMIT",
|
167
|
+
description: "download_limit for UploadAppToBuglyAction",
|
168
|
+
is_string: false, # true: verifies the input is a string, false: every kind of value
|
169
|
+
default_value: 10_000),
|
170
|
+
FastlaneCore::ConfigItem.new(key: :raise_if_error,
|
171
|
+
env_name: "FL_UPLOAD_APP_TO_BUGLY_RAISE_IF_ERROR",
|
172
|
+
description: "Raises an error if fails, so you can fail CI/CD jobs if necessary \(true/false)",
|
173
|
+
default_value: true,
|
174
|
+
is_string: false,
|
175
|
+
type: Boolean,
|
176
|
+
optional: false),
|
177
|
+
]
|
178
|
+
end
|
179
|
+
|
180
|
+
def self.output
|
181
|
+
# Define the shared values you are going to provide
|
182
|
+
[
|
183
|
+
["UPLOAD_APP_TO_BUGLY_DOWNLOAD_URL", "download url"],
|
184
|
+
]
|
185
|
+
end
|
186
|
+
|
187
|
+
def self.return_value
|
188
|
+
# If you method provides a return value, you can describe here what it does
|
189
|
+
end
|
190
|
+
|
191
|
+
def self.authors
|
192
|
+
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
|
193
|
+
["liubo"]
|
194
|
+
end
|
195
|
+
|
196
|
+
def self.is_supported?(platform)
|
197
|
+
platform == :ios
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require_relative
|
1
|
+
require "fastlane/action"
|
2
|
+
require_relative "../helper/upload_dsym_to_bugly_helper"
|
3
3
|
|
4
4
|
module Fastlane
|
5
5
|
module Actions
|
6
6
|
class UploadDsymToBuglyAction < Action
|
7
7
|
def self.run(params)
|
8
|
-
require
|
8
|
+
require "json"
|
9
9
|
# fastlane will take care of reading in the parameter and fetching the environment variable:
|
10
10
|
UI.message "file path: #{params[:file_path]}"
|
11
11
|
|
12
|
-
json_file =
|
12
|
+
json_file = "upload_dsym_to_bugly_result.json"
|
13
13
|
|
14
14
|
begin
|
15
|
-
api_version =
|
15
|
+
api_version = ""
|
16
16
|
if !params[:api_version].nil? && params[:api_version] > 0
|
17
17
|
api_version = " --form \"api_version=#{params[:api_version]}\" "
|
18
18
|
UI.message "api_version: #{api_version}"
|
@@ -20,9 +20,9 @@ module Fastlane
|
|
20
20
|
rescue Exception => e
|
21
21
|
UI.message "error at checking api version, caused by #{e}"
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
begin
|
25
|
-
channel =
|
25
|
+
channel = ""
|
26
26
|
if !params[:channel].nil? && !params[:channel].empty?
|
27
27
|
channel = " --form \"channel=#{params[:channel]}\" "
|
28
28
|
UI.message "channel: #{channel}"
|
@@ -31,16 +31,22 @@ module Fastlane
|
|
31
31
|
UI.message "error at checking api version, caused by #{e}"
|
32
32
|
end
|
33
33
|
|
34
|
-
cmd = "curl -k \"https://api.bugly.qq.com/openapi/file/upload/symbol?app_key=#{params[:app_key]}&app_id=#{params[:app_id]}\"" +
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
34
|
+
cmd = "curl -k \"https://api.bugly.qq.com/openapi/file/upload/symbol?app_key=#{params[:app_key]}&app_id=#{params[:app_id]}\"" + api_version + " --form \"app_id=#{params[:app_id]}\"" + " --form \"app_key=#{params[:app_key]}\"" + " --form \"symbolType=#{params[:symbol_type]}\"" + " --form \"bundleId=#{params[:bundle_id]}\"" + " --form \"productVersion=#{params[:product_version]}\"" + channel + " --form \"fileName=#{params[:file_name]}\"" + " --form \"file=@#{params[:file_path]}\"" + " -o " + json_file
|
35
|
+
begin
|
36
|
+
sh(cmd)
|
37
|
+
obj = JSON.parse(File.read(json_file))
|
38
|
+
`rm upload_dsym_to_bugly_result.json`
|
39
|
+
ret = obj["rtcode"]
|
40
|
+
if ret == 0
|
41
|
+
UI.message "dSYM upload success"
|
42
|
+
else
|
43
|
+
UI.message "dSYM upload failed, result is #{obj}"
|
44
|
+
raise if params[:raise_if_error]
|
45
|
+
end
|
46
|
+
rescue
|
47
|
+
UI.message "dSYM upload failed"
|
48
|
+
raise if params[:raise_if_error]
|
42
49
|
end
|
43
|
-
`rm upload_dsym_to_bugly_result.json`
|
44
50
|
end
|
45
51
|
|
46
52
|
def self.description
|
@@ -63,64 +69,71 @@ module Fastlane
|
|
63
69
|
def self.available_options
|
64
70
|
[
|
65
71
|
FastlaneCore::ConfigItem.new(key: :api_version,
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
72
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_API_VERSION",
|
73
|
+
description: "api version for UploadDsymToBuglyAction",
|
74
|
+
is_string: false,
|
75
|
+
default_value: 1),
|
70
76
|
FastlaneCore::ConfigItem.new(key: :app_id,
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_APP_ID",
|
78
|
+
description: "app id for UploadDsymToBuglyAction",
|
79
|
+
is_string: true,
|
80
|
+
verify_block: proc do |value|
|
81
|
+
UI.user_error!("No APP id for UploadDsymToBuglyAction given, pass using `app_id: 'app_id'`") unless (value and not value.empty?)
|
82
|
+
end),
|
77
83
|
FastlaneCore::ConfigItem.new(key: :app_key,
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_APP_KEY",
|
85
|
+
description: "app key for UploadDsymToBuglyAction",
|
86
|
+
is_string: true,
|
87
|
+
verify_block: proc do |value|
|
88
|
+
UI.user_error!("No APP key for UploadDsymToBuglyAction given, pass using `api_key: 'app_key'`") unless (value and not value.empty?)
|
89
|
+
end),
|
84
90
|
FastlaneCore::ConfigItem.new(key: :symbol_type,
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_SYMBOL_TYPE",
|
92
|
+
description: "symbol type for UploadDsymToBuglyAction",
|
93
|
+
is_string: false,
|
94
|
+
verify_block: proc do |value|
|
95
|
+
UI.user_error!("No symbol type for UploadDsymToBuglyAction given, pass using `symbol_type: 'symbol_type'`") unless (value and not value.to_s.empty?)
|
96
|
+
end),
|
91
97
|
FastlaneCore::ConfigItem.new(key: :bundle_id,
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_BUNDLE_ID",
|
99
|
+
description: "bundle id for UploadDsymToBuglyAction",
|
100
|
+
is_string: true,
|
101
|
+
verify_block: proc do |value|
|
102
|
+
UI.user_error!("No symbol type for UploadDsymToBuglyAction given, pass using `bundle_id: 'bundle_id'`") unless (value and not value.empty?)
|
103
|
+
end),
|
98
104
|
FastlaneCore::ConfigItem.new(key: :product_version,
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_PRODEUCT_VERSION",
|
106
|
+
description: "product version for UploadDsymToBuglyAction",
|
107
|
+
is_string: true,
|
108
|
+
verify_block: proc do |value|
|
109
|
+
UI.user_error!("No symbol type for UploadDsymToBuglyAction given, pass using `product_version: 'product_version'`") unless (value and not value.empty?)
|
110
|
+
end),
|
105
111
|
FastlaneCore::ConfigItem.new(key: :channel,
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
112
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_CHANNEL",
|
113
|
+
description: "channel for UploadDsymToBuglyAction",
|
114
|
+
is_string: true,
|
115
|
+
default_value: "fastlane"),
|
110
116
|
FastlaneCore::ConfigItem.new(key: :file_name,
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_FILE_NAME",
|
118
|
+
description: "file name for UploadDsymToBuglyAction",
|
119
|
+
is_string: true,
|
120
|
+
verify_block: proc do |value|
|
121
|
+
UI.user_error!("No symbol type for UploadDsymToBuglyAction given, pass using `file_name: 'file_name'`") unless (value and not value.empty?)
|
122
|
+
end),
|
117
123
|
FastlaneCore::ConfigItem.new(key: :file_path,
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_FILE",
|
125
|
+
description: "file for UploadDsymToBuglyAction",
|
126
|
+
is_string: true,
|
127
|
+
verify_block: proc do |value|
|
128
|
+
UI.user_error!("No symbol type for UploadDsymToBuglyAction given, pass using `file_path: 'file_path'`") unless (value and not value.empty?)
|
129
|
+
end),
|
130
|
+
FastlaneCore::ConfigItem.new(key: :raise_if_error,
|
131
|
+
env_name: "FL_UPLOAD_DSYM_TO_BUGLY_RAISE_IF_ERROR",
|
132
|
+
description: "Raises an error if fails, so you can fail CI/CD jobs if necessary \(true/false)",
|
133
|
+
default_value: true,
|
134
|
+
is_string: false,
|
135
|
+
type: Boolean,
|
136
|
+
optional: false),
|
124
137
|
]
|
125
138
|
end
|
126
139
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-upload_dsym_to_bugly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- liubo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -145,8 +145,8 @@ files:
|
|
145
145
|
- LICENSE
|
146
146
|
- README.md
|
147
147
|
- lib/fastlane/plugin/upload_dsym_to_bugly.rb
|
148
|
+
- lib/fastlane/plugin/upload_dsym_to_bugly/actions/upload_app_to_bugly_action.rb
|
148
149
|
- lib/fastlane/plugin/upload_dsym_to_bugly/actions/upload_dsym_to_bugly_action.rb
|
149
|
-
- lib/fastlane/plugin/upload_dsym_to_bugly/actions/upload_ipa_to_bugly_action.rb
|
150
150
|
- lib/fastlane/plugin/upload_dsym_to_bugly/helper/upload_dsym_to_bugly_helper.rb
|
151
151
|
- lib/fastlane/plugin/upload_dsym_to_bugly/version.rb
|
152
152
|
homepage: https://github.com/srv7/fastlane-plugin-upload_dsym_to_bugly
|
@@ -168,8 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
- !ruby/object:Gem::Version
|
169
169
|
version: '0'
|
170
170
|
requirements: []
|
171
|
-
|
172
|
-
rubygems_version: 2.7.6
|
171
|
+
rubygems_version: 3.1.2
|
173
172
|
signing_key:
|
174
173
|
specification_version: 4
|
175
174
|
summary: upload_dsym_to_bugly
|
@@ -1,186 +0,0 @@
|
|
1
|
-
require 'fastlane/action'
|
2
|
-
require_relative '../helper/upload_dsym_to_bugly_helper'
|
3
|
-
|
4
|
-
module Fastlane
|
5
|
-
module Actions
|
6
|
-
module SharedValues
|
7
|
-
UPLOAD_APP_TO_BUGLY_DOWNLOAD_URL = :UPLOAD_APP_TO_BUGLY_DOWNLOAD_URL
|
8
|
-
end
|
9
|
-
|
10
|
-
# To share this integration with the other fastlane users:
|
11
|
-
# - Fork https://github.com/fastlane/fastlane/tree/master/fastlane
|
12
|
-
# - Clone the forked repository
|
13
|
-
# - Move this integration into lib/fastlane/actions
|
14
|
-
# - Commit, push and submit the pull request
|
15
|
-
|
16
|
-
class UploadAppToBuglyAction < Action
|
17
|
-
def self.run(params)
|
18
|
-
require 'json'
|
19
|
-
# fastlane will take care of reading in the parameter and fetching the environment variable:
|
20
|
-
UI.message "file path: #{params[:file_path]}"
|
21
|
-
|
22
|
-
json_file = 'upload_app_to_bugly_result.json'
|
23
|
-
|
24
|
-
begin
|
25
|
-
secret = ''
|
26
|
-
if !params[:secret].to_s.nil? && !params[:secret].empty?
|
27
|
-
secret = " -F \"secret=#{params[:secret]}\" "
|
28
|
-
UI.message "secret:#{secret}"
|
29
|
-
end
|
30
|
-
rescue Exception => e
|
31
|
-
UI.message "error at checking secret,caused by #{e}"
|
32
|
-
return
|
33
|
-
end
|
34
|
-
|
35
|
-
begin
|
36
|
-
users = ''
|
37
|
-
if !params[:users].nil? && !params[:users].empty?
|
38
|
-
users = " -F \"users=#{params[:users]}\" "
|
39
|
-
UI.message "users:#{users}"
|
40
|
-
end
|
41
|
-
rescue Exception => e
|
42
|
-
UI.message "error at checking users,caused by #{e}"
|
43
|
-
return
|
44
|
-
end
|
45
|
-
|
46
|
-
begin
|
47
|
-
password = ''
|
48
|
-
if !params[:password].nil? && !params[:password].empty?
|
49
|
-
password = " -F \"password=#{params[:password]}\" "
|
50
|
-
UI.message "password:#{password}"
|
51
|
-
end
|
52
|
-
rescue Exception => e
|
53
|
-
UI.message "error at checking password,caused by #{e}"
|
54
|
-
return
|
55
|
-
end
|
56
|
-
|
57
|
-
begin
|
58
|
-
download_limit = ''
|
59
|
-
if !params[:download_limit].nil? && params[:download_limit] > 0
|
60
|
-
download_limit = " -F \"download_limit=#{params[:download_limit]}\" "
|
61
|
-
UI.message "download_limit:#{download_limit}"
|
62
|
-
end
|
63
|
-
rescue Exception => e
|
64
|
-
UI.message "error at checking download_limit,caused by #{e}"
|
65
|
-
return
|
66
|
-
end
|
67
|
-
|
68
|
-
cmd = "curl --insecure -F \"file=@#{params[:file_path]}\" -F \"app_id=#{params[:app_id]}\" -F \"pid=#{params[:pid]}\" -F \"title=#{params[:title]}\" -F \"description=#{params[:desc]}\"" + secret + users + password + download_limit + " https://api.bugly.qq.com/beta/apiv1/exp?app_key=#{params[:app_key]} -o " + json_file
|
69
|
-
sh(cmd)
|
70
|
-
obj = JSON.parse(File.read(json_file))
|
71
|
-
ret = obj['rtcode']
|
72
|
-
if ret == 0
|
73
|
-
UI.message "upload success"
|
74
|
-
url = obj['data']['url']
|
75
|
-
Actions.lane_context[SharedValues::UPLOAD_APP_TO_BUGLY_DOWNLOAD_URL] = url
|
76
|
-
else
|
77
|
-
UI.message "upload failed,result is #{obj}"
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
#####################################################
|
82
|
-
# @!group Documentation
|
83
|
-
#####################################################
|
84
|
-
|
85
|
-
def self.description
|
86
|
-
'A short description with <= 80 characters of what this action does'
|
87
|
-
end
|
88
|
-
|
89
|
-
def self.details
|
90
|
-
# Optional:
|
91
|
-
# this is your chance to provide a more detailed description of this action
|
92
|
-
'You can use this action to do cool things...'
|
93
|
-
end
|
94
|
-
|
95
|
-
def self.available_options
|
96
|
-
# Define all options your action supports.
|
97
|
-
|
98
|
-
# Below a few examples
|
99
|
-
[
|
100
|
-
FastlaneCore::ConfigItem.new(key: :file_path,
|
101
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_FILE_PATH',
|
102
|
-
description: 'file path for UploadAppToBuglyAction',
|
103
|
-
is_string: true,
|
104
|
-
verify_block: proc do |value|
|
105
|
-
UI.user_error!("No file path for UploadAppToBuglyAction given, pass using `file_path: 'path'`") unless value && !value.empty?
|
106
|
-
UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
|
107
|
-
end),
|
108
|
-
FastlaneCore::ConfigItem.new(key: :app_key,
|
109
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_APP_KEY',
|
110
|
-
description: 'app key for UploadAppToBuglyAction',
|
111
|
-
is_string: true,
|
112
|
-
verify_block: proc do |value|
|
113
|
-
UI.user_error!("NO app_key for UploadAppToBuglyAction given, pass using `app_key: 'app_key'`") unless value && !value.empty?
|
114
|
-
end),
|
115
|
-
FastlaneCore::ConfigItem.new(key: :app_id,
|
116
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_APP_ID',
|
117
|
-
description: 'app id for UploadAppToBuglyAction',
|
118
|
-
is_string: true,
|
119
|
-
verify_block: proc do |value|
|
120
|
-
UI.user_error!("No app_id for UploadAppToBuglyAction given, pass using `app_id: 'app_id'`") unless value && !value.empty?
|
121
|
-
end),
|
122
|
-
FastlaneCore::ConfigItem.new(key: :pid,
|
123
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_PID',
|
124
|
-
description: 'pid for UploadToBuglyAction',
|
125
|
-
is_string: true,
|
126
|
-
verify_block: proc do |value|
|
127
|
-
UI.user_error!("No pid for UploadAppToBuglyAction given, pass using `pid: 'pid'`") unless value && !value.empty?
|
128
|
-
end),
|
129
|
-
FastlaneCore::ConfigItem.new(key: :title,
|
130
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_TITLE',
|
131
|
-
description: 'title for UploadAppToBuglyAction',
|
132
|
-
is_string: true,
|
133
|
-
default_value: 'title',
|
134
|
-
verify_block: proc do |value|
|
135
|
-
UI.user_error!("No title for UploadAppToBuglyAction given, pass using `title: 'title'`") unless value && !value.empty?
|
136
|
-
end),
|
137
|
-
FastlaneCore::ConfigItem.new(key: :desc,
|
138
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_DESC',
|
139
|
-
description: 'desc for UploadAppToBuglyAction',
|
140
|
-
is_string: true,
|
141
|
-
default_value: 'desc'),
|
142
|
-
FastlaneCore::ConfigItem.new(key: :secret,
|
143
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_DESCRIPTION',
|
144
|
-
description: 'secret for UploadAppToBuglyAction',
|
145
|
-
is_string: true,
|
146
|
-
default_value: ''),
|
147
|
-
FastlaneCore::ConfigItem.new(key: :users,
|
148
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_DESCRIPTION',
|
149
|
-
description: 'users for UploadAppToBuglyAction',
|
150
|
-
is_string: true,
|
151
|
-
default_value: ''),
|
152
|
-
FastlaneCore::ConfigItem.new(key: :password,
|
153
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_DESCRIPTION',
|
154
|
-
description: 'password for UploadAppToBuglyAction',
|
155
|
-
is_string: true,
|
156
|
-
default_value: ''),
|
157
|
-
FastlaneCore::ConfigItem.new(key: :download_limit,
|
158
|
-
env_name: 'FL_UPLOAD_APP_TO_BUGLY_DESCRIPTION',
|
159
|
-
description: 'download_limit for UploadAppToBuglyAction',
|
160
|
-
is_string: false, # true: verifies the input is a string, false: every kind of value
|
161
|
-
default_value: 10_000)
|
162
|
-
]
|
163
|
-
end
|
164
|
-
|
165
|
-
def self.output
|
166
|
-
# Define the shared values you are going to provide
|
167
|
-
[
|
168
|
-
['UPLOAD_APP_TO_BUGLY_DOWNLOAD_URL', 'download url']
|
169
|
-
]
|
170
|
-
end
|
171
|
-
|
172
|
-
def self.return_value
|
173
|
-
# If you method provides a return value, you can describe here what it does
|
174
|
-
end
|
175
|
-
|
176
|
-
def self.authors
|
177
|
-
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
|
178
|
-
["liubo"]
|
179
|
-
end
|
180
|
-
|
181
|
-
def self.is_supported?(platform)
|
182
|
-
platform == :ios
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|
186
|
-
end
|