fastlane-plugin-rustore_developer 0.2.9
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +52 -0
- data/lib/fastlane/plugin/rustore_developer/actions/rustore_developer_auth_action.rb +56 -0
- data/lib/fastlane/plugin/rustore_developer/actions/rustore_developer_commit_action.rb +59 -0
- data/lib/fastlane/plugin/rustore_developer/actions/rustore_developer_create_version_action.rb +65 -0
- data/lib/fastlane/plugin/rustore_developer/actions/rustore_developer_delete_draft_action.rb +59 -0
- data/lib/fastlane/plugin/rustore_developer/actions/rustore_developer_status_action.rb +106 -0
- data/lib/fastlane/plugin/rustore_developer/actions/rustore_developer_upload_action.rb +63 -0
- data/lib/fastlane/plugin/rustore_developer/helper/rustore_developer_helper.rb +198 -0
- data/lib/fastlane/plugin/rustore_developer/version.rb +5 -0
- data/lib/fastlane/plugin/rustore_developer.rb +16 -0
- metadata +193 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3835e5851b853cfb2952eac02045f665dbfbeb1aa25bc4fd8d1d95d94d666b68
|
4
|
+
data.tar.gz: 40d08ccdaa4b733f3a7babed362723f314d46f00184d0d6896789f6de19651fc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ecf389d56ce32286c62326457c4c9d7889e907506b746fcb9a6f7802e3ca18944425c8f00828a984c932e3d0f8498b76272c9f066fd5223de19165f420f311af
|
7
|
+
data.tar.gz: 48ccf425ca7bbcd74aab0bbba2d9a352655d84ea799021a201a75b4e15e83cebefa4ec50b121c91bf028a141fe1d0645ee9adad53f2fb5ad25bcdc1bdf3c9383
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 RimiX2 <cj_rimix@rambler.ru>
|
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,52 @@
|
|
1
|
+
# rustore_developer plugin
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-rustore_developer)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-rustore_developer`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin rustore_developer
|
11
|
+
```
|
12
|
+
|
13
|
+
## About rustore_developer
|
14
|
+
|
15
|
+
RUSTORE deployment helper
|
16
|
+
|
17
|
+
**Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
|
18
|
+
|
19
|
+
## Example
|
20
|
+
|
21
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
22
|
+
|
23
|
+
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
24
|
+
|
25
|
+
## Run tests for this plugin
|
26
|
+
|
27
|
+
To run both the tests, and code style validation, run
|
28
|
+
|
29
|
+
```
|
30
|
+
rake
|
31
|
+
```
|
32
|
+
|
33
|
+
To automatically fix many of the styling issues, use
|
34
|
+
```
|
35
|
+
rubocop -a
|
36
|
+
```
|
37
|
+
|
38
|
+
## Issues and Feedback
|
39
|
+
|
40
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
41
|
+
|
42
|
+
## Troubleshooting
|
43
|
+
|
44
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
45
|
+
|
46
|
+
## Using _fastlane_ Plugins
|
47
|
+
|
48
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
49
|
+
|
50
|
+
## About _fastlane_
|
51
|
+
|
52
|
+
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/rustore_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
RUSTORE_DEVELOPER_ACCESS_TOKEN = :RUSTORE_DEVELOPER_ACCESS_TOKEN
|
8
|
+
end
|
9
|
+
class RustoreDeveloperAuthAction < Action
|
10
|
+
|
11
|
+
def self.run(params)
|
12
|
+
token = Helper::RustoreDeveloperHelper.getAccessToken(params[:company_id], params[:key_path])
|
13
|
+
Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_ACCESS_TOKEN] = token
|
14
|
+
return token
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.description
|
18
|
+
"RUSTORE: Get authorization token"
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.authors
|
22
|
+
["RimiX2"]
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.return_value
|
26
|
+
"Access token"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.details
|
30
|
+
# Optional:
|
31
|
+
""
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.available_options
|
35
|
+
[
|
36
|
+
FastlaneCore::ConfigItem.new(key: :company_id,
|
37
|
+
env_name: "RUSTORE_COMPANY_ID",
|
38
|
+
description: "Company ID",
|
39
|
+
optional: false,
|
40
|
+
type: String),
|
41
|
+
FastlaneCore::ConfigItem.new(key: :key_path,
|
42
|
+
env_name: "RUSTORE_PRIVATE_KEY_PATH",
|
43
|
+
description: "Path for the company's private key (PEM)",
|
44
|
+
optional: false,
|
45
|
+
default_value: './private_key.pem',
|
46
|
+
type: String)
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.is_supported?(platform)
|
51
|
+
[:android].include?(platform)
|
52
|
+
true
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/rustore_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class RustoreDeveloperCommitAction < Action
|
7
|
+
|
8
|
+
def self.run(params)
|
9
|
+
return Helper::RustoreDeveloperHelper.commitVersion(params[:token], params[:package],params[:version])
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"RUSTORE: Submit version for moderation (commit)"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.authors
|
17
|
+
["RimiX2"]
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.return_value
|
21
|
+
"Was operation successfull? (true|false)"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.details
|
25
|
+
# Optional:
|
26
|
+
""
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.available_options
|
30
|
+
[
|
31
|
+
FastlaneCore::ConfigItem.new(key: :package,
|
32
|
+
env_name: "RUSTORE_PACKAGE_NAME",
|
33
|
+
description: "Android app package name (FQDN)",
|
34
|
+
optional: false,
|
35
|
+
type: String),
|
36
|
+
FastlaneCore::ConfigItem.new(key: :version,
|
37
|
+
description: "Version ID",
|
38
|
+
optional: true,
|
39
|
+
type: String,
|
40
|
+
default_value: Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_DRAFT_VERSION]),
|
41
|
+
FastlaneCore::ConfigItem.new(key: :token,
|
42
|
+
description: "Access token",
|
43
|
+
optional: false,
|
44
|
+
sensitive: true,
|
45
|
+
default_value: Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_ACCESS_TOKEN],
|
46
|
+
verify_block: proc do |value|
|
47
|
+
UI.user_error!("No access token given, pass using `token: 'token_value'`") unless value && !value.empty?
|
48
|
+
end,
|
49
|
+
type: String)
|
50
|
+
]
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.is_supported?(platform)
|
54
|
+
[:android].include?(platform)
|
55
|
+
true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/rustore_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
RUSTORE_DEVELOPER_DRAFT_VERSION = :RUSTORE_DEVELOPER_DRAFT_VERSION
|
8
|
+
end
|
9
|
+
|
10
|
+
class RustoreDeveloperCreateVersionAction < Action
|
11
|
+
|
12
|
+
def self.run(params)
|
13
|
+
version = Helper::RustoreDeveloperHelper.createVersion(params[:token], params[:package], params[:publish], nil )
|
14
|
+
Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_DRAFT_VERSION] = version.to_s
|
15
|
+
return version
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.description
|
19
|
+
"RUSTORE: Create new deployment version (draft)"
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.authors
|
23
|
+
["RimiX2"]
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.return_value
|
27
|
+
"Created version id"
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.details
|
31
|
+
# Optional:
|
32
|
+
""
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(key: :package,
|
38
|
+
env_name: "RUSTORE_PACKAGE_NAME",
|
39
|
+
description: "Android app package name (FQDN)",
|
40
|
+
optional: false,
|
41
|
+
type: String),
|
42
|
+
FastlaneCore::ConfigItem.new(key: :publish,
|
43
|
+
description: "Publication mechanism (MANUAL | INSTANTLY)",
|
44
|
+
optional: false,
|
45
|
+
default_value: 'MANUAL',
|
46
|
+
type: String),
|
47
|
+
FastlaneCore::ConfigItem.new(key: :token,
|
48
|
+
description: "Access token",
|
49
|
+
optional: false,
|
50
|
+
sensitive: true,
|
51
|
+
default_value: Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_ACCESS_TOKEN],
|
52
|
+
verify_block: proc do |value|
|
53
|
+
UI.user_error!("No access token given, pass using `token: 'token_value'`") unless value && !value.empty?
|
54
|
+
end,
|
55
|
+
type: String)
|
56
|
+
]
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.is_supported?(platform)
|
60
|
+
[:android].include?(platform)
|
61
|
+
true
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/rustore_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
class RustoreDeveloperDeleteDraftAction < Action
|
8
|
+
|
9
|
+
def self.run(params)
|
10
|
+
return Helper::RustoreDeveloperHelper.deleteDraft(params[:token], params[:package],params[:version_id])
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.description
|
14
|
+
"RUSTORE: Delete specific draft version"
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.authors
|
18
|
+
["RimiX2"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.return_value
|
22
|
+
"Was operation successfull? (true|false)"
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.details
|
26
|
+
# Optional:
|
27
|
+
""
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.available_options
|
31
|
+
[
|
32
|
+
FastlaneCore::ConfigItem.new(key: :package,
|
33
|
+
env_name: "RUSTORE_PACKAGE_NAME",
|
34
|
+
description: "Android app package name (FQDN)",
|
35
|
+
optional: false,
|
36
|
+
type: String),
|
37
|
+
FastlaneCore::ConfigItem.new(key: :token,
|
38
|
+
description: "Access token",
|
39
|
+
optional: false,
|
40
|
+
sensitive: true,
|
41
|
+
default_value: Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_ACCESS_TOKEN],
|
42
|
+
verify_block: proc do |value|
|
43
|
+
UI.user_error!("No access token given, pass using `token: 'token_value'`") unless value && !value.empty?
|
44
|
+
end,
|
45
|
+
type: String),
|
46
|
+
FastlaneCore::ConfigItem.new(key: :version_id,
|
47
|
+
description: "Draft version id",
|
48
|
+
optional: false,
|
49
|
+
type: String),
|
50
|
+
]
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.is_supported?(platform)
|
54
|
+
[:android].include?(platform)
|
55
|
+
true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/rustore_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class RustoreDeveloperStatusAction < Action
|
7
|
+
|
8
|
+
def self.run(params)
|
9
|
+
if params[:version].nil?
|
10
|
+
massive = Helper::RustoreDeveloperHelper.getStatusAll(params[:token], params[:package])
|
11
|
+
# puts(massive)
|
12
|
+
exclude_cols = ['paid', 'priceValue', 'whatsNew', 'partialValue', 'sendDateForModer', 'publishDateTime',]
|
13
|
+
col_labels = {versionId: "ID",
|
14
|
+
appName: "Title",
|
15
|
+
appType: "appType",
|
16
|
+
versionName: "vName",
|
17
|
+
versionCode: "vCode",
|
18
|
+
versionStatus: "Status",
|
19
|
+
publishType: 'publishType',
|
20
|
+
publishDateTime: 'Published',
|
21
|
+
sendDateForModer: 'Commited',
|
22
|
+
partialValue: 'Part',
|
23
|
+
whatsNew: 'whatsNew',
|
24
|
+
priceValue: 'Price',
|
25
|
+
paid: 'paid',
|
26
|
+
}
|
27
|
+
@columns = col_labels.each_with_object({}) { |(col, label), h|
|
28
|
+
h[col] = {label: label,
|
29
|
+
width: [[(massive.map { |g| g[col.to_s].to_s.size }.max), 30].min, label.size].max}
|
30
|
+
}
|
31
|
+
|
32
|
+
# header top line
|
33
|
+
puts "+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+"
|
34
|
+
# header line
|
35
|
+
puts "| #{@columns.map { |_, g| g[:label].to_s.ljust(g[:width]) }.join(' | ')} |"
|
36
|
+
# # header bottom line
|
37
|
+
puts "+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+"
|
38
|
+
|
39
|
+
# row line
|
40
|
+
massive.each do |row|
|
41
|
+
str = row.keys.map { |k|
|
42
|
+
a = row[k]
|
43
|
+
if a.to_s.size > 30 then
|
44
|
+
a = a.to_s[0..26] + "..."
|
45
|
+
end
|
46
|
+
a.to_s.ljust(@columns[k.to_sym][:width])
|
47
|
+
}.join(' | ')
|
48
|
+
puts "| #{str} |"
|
49
|
+
end
|
50
|
+
# bottom line
|
51
|
+
puts "+-#{@columns.map { |_, g| '-' * g[:width] }.join('-+-')}-+"
|
52
|
+
else
|
53
|
+
info = Helper::RustoreDeveloperHelper.getStatus(params[:token], params[:package], params[:version])
|
54
|
+
puts(info)
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.description
|
60
|
+
"RUSTORE: Get app versions statuses"
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.authors
|
64
|
+
["RimiX2"]
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.return_value
|
68
|
+
""
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.details
|
72
|
+
# Optional:
|
73
|
+
""
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.available_options
|
77
|
+
[
|
78
|
+
FastlaneCore::ConfigItem.new(key: :package,
|
79
|
+
env_name: "RUSTORE_PACKAGE_NAME",
|
80
|
+
description: "Android app package name (FQDN)",
|
81
|
+
optional: false,
|
82
|
+
type: String),
|
83
|
+
FastlaneCore::ConfigItem.new(key: :version,
|
84
|
+
description: "Version ID",
|
85
|
+
optional: true,
|
86
|
+
type: String,
|
87
|
+
default_value: Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_DRAFT_VERSION]),
|
88
|
+
FastlaneCore::ConfigItem.new(key: :token,
|
89
|
+
description: "Access token",
|
90
|
+
optional: false,
|
91
|
+
sensitive: true,
|
92
|
+
default_value: Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_ACCESS_TOKEN],
|
93
|
+
verify_block: proc do |value|
|
94
|
+
UI.user_error!("No access token given, pass using `token: 'token_value'`") unless value && !value.empty?
|
95
|
+
end,
|
96
|
+
type: String)
|
97
|
+
]
|
98
|
+
end
|
99
|
+
|
100
|
+
def self.is_supported?(platform)
|
101
|
+
[:android].include?(platform)
|
102
|
+
true
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/rustore_developer_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class RustoreDeveloperUploadAction < Action
|
7
|
+
|
8
|
+
def self.run(params)
|
9
|
+
return Helper::RustoreDeveloperHelper.uploadAPK(params[:token], params[:package], params[:version], params[:file_path])
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.description
|
13
|
+
"RUSTORE: Upload an APK package"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.authors
|
17
|
+
["RimiX2"]
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.return_value
|
21
|
+
"Was operation successfull? (true|false)"
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.details
|
25
|
+
# Optional:
|
26
|
+
""
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.available_options
|
30
|
+
[
|
31
|
+
FastlaneCore::ConfigItem.new(key: :package,
|
32
|
+
env_name: "RUSTORE_PACKAGE_NAME",
|
33
|
+
description: "Android app package name (FQDN)",
|
34
|
+
optional: false,
|
35
|
+
type: String),
|
36
|
+
FastlaneCore::ConfigItem.new(key: :token,
|
37
|
+
description: "Access token",
|
38
|
+
optional: false,
|
39
|
+
sensitive: true,
|
40
|
+
default_value: Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_ACCESS_TOKEN],
|
41
|
+
verify_block: proc do |value|
|
42
|
+
UI.user_error!("No access token given, pass using `token: 'token_value'`") unless value && !value.empty?
|
43
|
+
end,
|
44
|
+
type: String),
|
45
|
+
FastlaneCore::ConfigItem.new(key: :version,
|
46
|
+
description: "Version ID",
|
47
|
+
optional: true,
|
48
|
+
type: String,
|
49
|
+
default_value: Actions.lane_context[SharedValues::RUSTORE_DEVELOPER_DRAFT_VERSION]),
|
50
|
+
FastlaneCore::ConfigItem.new(key: :file_path,
|
51
|
+
description: "File path of APK artifact",
|
52
|
+
optional: false ,
|
53
|
+
type: String)
|
54
|
+
]
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.is_supported?(platform)
|
58
|
+
[:android].include?(platform)
|
59
|
+
true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,198 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
require "base64"
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
6
|
+
|
7
|
+
module Helper
|
8
|
+
class RustoreDeveloperHelper
|
9
|
+
|
10
|
+
BASE_URL = 'https://public-api.rustore.ru'
|
11
|
+
|
12
|
+
def self.getTimestamp()
|
13
|
+
return DateTime.now.to_s()
|
14
|
+
# return '2023-08-23T09:00:32.939+03:00'
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.getSignatureEncoded(company_id, timestamp, key_path)
|
18
|
+
private_key = OpenSSL::PKey.read(File.read(key_path))
|
19
|
+
data = company_id + timestamp
|
20
|
+
signature = private_key.sign("SHA512", data)
|
21
|
+
encoded = Base64.strict_encode64(signature)
|
22
|
+
return encoded
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.getAccessToken(company_id, key_path)
|
26
|
+
UI.important("Getting access token ...")
|
27
|
+
timestamp = getTimestamp()
|
28
|
+
sign = getSignatureEncoded(company_id, timestamp, key_path)
|
29
|
+
uri = URI(BASE_URL + '/public/auth/')
|
30
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
31
|
+
http.use_ssl = true
|
32
|
+
req = Net::HTTP::Post.new(uri.path)
|
33
|
+
req["Content-Type"] = "application/json"
|
34
|
+
data = {'companyId': company_id, 'timestamp': timestamp, 'signature': sign}
|
35
|
+
req.body = data.to_json
|
36
|
+
res = http.request(req)
|
37
|
+
result_json = JSON.parse(res.body)
|
38
|
+
token = result_json['body']['jwe'] if result_json['code'] == 'OK'
|
39
|
+
|
40
|
+
if token.nil?
|
41
|
+
UI.error("Cannot retrieve access token, please check your credentials.\n#{result_json['message']}")
|
42
|
+
else
|
43
|
+
UI.success 'Got access token'
|
44
|
+
# UI.message token
|
45
|
+
end
|
46
|
+
|
47
|
+
return token
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.createVersion(token, package_name, publish_type = 'INSTANTLY', app_type = 'MAIN', whats_new)
|
51
|
+
UI.important("Creating draft version of '#{package_name}' ...")
|
52
|
+
uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version")
|
53
|
+
p uri
|
54
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
55
|
+
http.use_ssl = true
|
56
|
+
req = Net::HTTP::Post.new(uri.path)
|
57
|
+
req["Content-Type"] = "application/json"
|
58
|
+
req["Public-Token"] = token
|
59
|
+
data = {'publishType': publish_type, 'appType': app_type, 'whatsNew': whats_new}
|
60
|
+
req.body = data.to_json
|
61
|
+
# puts req.body
|
62
|
+
res = http.request(req)
|
63
|
+
# puts res.body
|
64
|
+
result_json = JSON.parse(res.body)
|
65
|
+
version = result_json['body'] if result_json['code'] == 'OK'
|
66
|
+
if version.nil?
|
67
|
+
UI.error("#{result_json['message']}")
|
68
|
+
else
|
69
|
+
UI.success "Created new version: #{version}"
|
70
|
+
end
|
71
|
+
return version
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.deleteDraft(token, package_name, version_id)
|
75
|
+
UI.important("Deleting draft version #{version_id} ...")
|
76
|
+
uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version/#{version_id}")
|
77
|
+
p uri
|
78
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
79
|
+
http.use_ssl = true
|
80
|
+
req = Net::HTTP::Delete.new(uri.path)
|
81
|
+
req["Public-Token"] = token
|
82
|
+
req["Content-Type"] = "application/json"
|
83
|
+
res = http.request(req)
|
84
|
+
result_json = JSON.parse(res.body)
|
85
|
+
if result_json['code'] != 'OK'
|
86
|
+
UI.error("#{result_json['message']}")
|
87
|
+
return false
|
88
|
+
else
|
89
|
+
UI.success "Successfully deleted"
|
90
|
+
return true
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.getStatus(token, package_name, version_id, page = 0, size = 10)
|
95
|
+
# METHOD_URL = BASE_URL + "/public/v1/application/#{package_name}/version"
|
96
|
+
if version_id.nil?
|
97
|
+
UI.important("Getting status of \'#{package_name}\' versions on page #{page} ...")
|
98
|
+
uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version?page=#{page}&size=#{size}")
|
99
|
+
else
|
100
|
+
UI.important("Getting status of \'#{package_name}\' version #{version_id} ...")
|
101
|
+
uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version?id=#{version_id}")
|
102
|
+
end
|
103
|
+
p uri
|
104
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
105
|
+
http.use_ssl = true
|
106
|
+
req = Net::HTTP::Get.new(uri.path)
|
107
|
+
req["Public-Token"] = token
|
108
|
+
req["Content-Type"] = "application/json"
|
109
|
+
res = http.request(req)
|
110
|
+
result_json = JSON.parse(res.body)
|
111
|
+
if result_json['code'] == 'OK'
|
112
|
+
content = result_json['body']['content']
|
113
|
+
totalVersions = result_json['body']['totalElements']
|
114
|
+
totalPages = result_json['body']['totalPages']
|
115
|
+
end
|
116
|
+
|
117
|
+
if content.nil?
|
118
|
+
UI.error("#{result_json['message']}")
|
119
|
+
else
|
120
|
+
if version_id.nil?
|
121
|
+
UI.success "Got #{totalVersions} versions in #{totalPages} pages"
|
122
|
+
else
|
123
|
+
UI.success "Got version info"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
return content
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.getStatusAll(token, package_name, page = 0, size = 100)
|
131
|
+
self.getStatus(token, package_name, nil, page, size)
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.uploadAPK(token, package_name, version_id, apk_path, is_main = true, service_type = 'Unknown')
|
135
|
+
UI.important("Uploading APK #{apk_path} ...")
|
136
|
+
# uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version/#{version_id}/apk?isMainApk=#{is_main}&servicesType=#{service_type}")
|
137
|
+
uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version/#{version_id}/apk")
|
138
|
+
p uri
|
139
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
140
|
+
http.use_ssl = true
|
141
|
+
req = Net::HTTP::Post.new(uri.path)
|
142
|
+
req["Public-Token"] = token
|
143
|
+
req.set_content_type("multipart/form-data")
|
144
|
+
req.set_form([['file', File.open(apk_path)],['isMainApk', is_main.to_s],['servicesType', service_type]], 'multipart/form-data')
|
145
|
+
res = http.request(req)
|
146
|
+
result_json = JSON.parse(res.body)
|
147
|
+
if result_json['code'] != 'OK'
|
148
|
+
UI.error("#{result_json['message']}")
|
149
|
+
return false
|
150
|
+
else
|
151
|
+
UI.success "APK uploaded"
|
152
|
+
return true
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
def self.commitVersion(token, package_name, version_id, priority_update = 0)
|
157
|
+
UI.important("Committing version #{version_id} ...")
|
158
|
+
uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version/#{version_id}/commit?priorityUpdate=#{priority_update}")
|
159
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
160
|
+
http.use_ssl = true
|
161
|
+
req = Net::HTTP::Post.new(uri.path)
|
162
|
+
req["Public-Token"] = token
|
163
|
+
puts req.body
|
164
|
+
res = http.request(req)
|
165
|
+
puts res.body
|
166
|
+
result_json = JSON.parse(res.body)
|
167
|
+
if result_json['code'] != 'OK'
|
168
|
+
UI.error("#{result_json['message']}")
|
169
|
+
return false
|
170
|
+
else
|
171
|
+
UI.success "Successfully committed"
|
172
|
+
return true
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def self.publishVersion(token, package_name, version_id, priority_update = 0)
|
177
|
+
UI.important("Publishing version #{version_id} ...")
|
178
|
+
uri = URI(BASE_URL + "/public/v1/application/#{package_name}/version/#{version_id}/publish")
|
179
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
180
|
+
http.use_ssl = true
|
181
|
+
req = Net::HTTP::Post.new(uri.path)
|
182
|
+
req["Public-Token"] = token
|
183
|
+
puts req.body
|
184
|
+
res = http.request(req)
|
185
|
+
puts res.body
|
186
|
+
result_json = JSON.parse(res.body)
|
187
|
+
if result_json['code'] != 'OK'
|
188
|
+
return false
|
189
|
+
UI.error("#{result_json['message']}")
|
190
|
+
else
|
191
|
+
UI.success "Successfully published"
|
192
|
+
return true
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/rustore_developer/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module RustoreDeveloper
|
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::RustoreDeveloper.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,193 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-rustore_developer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.9
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- RimiX2
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
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: fastlane
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.213.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.213.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
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: rake
|
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: rspec
|
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: rspec_junit_formatter
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.12.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.12.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-performance
|
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: rubocop-require_tools
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description:
|
154
|
+
email: cj_rimix@rambler.ru
|
155
|
+
executables: []
|
156
|
+
extensions: []
|
157
|
+
extra_rdoc_files: []
|
158
|
+
files:
|
159
|
+
- LICENSE
|
160
|
+
- README.md
|
161
|
+
- lib/fastlane/plugin/rustore_developer.rb
|
162
|
+
- lib/fastlane/plugin/rustore_developer/actions/rustore_developer_auth_action.rb
|
163
|
+
- lib/fastlane/plugin/rustore_developer/actions/rustore_developer_commit_action.rb
|
164
|
+
- lib/fastlane/plugin/rustore_developer/actions/rustore_developer_create_version_action.rb
|
165
|
+
- lib/fastlane/plugin/rustore_developer/actions/rustore_developer_delete_draft_action.rb
|
166
|
+
- lib/fastlane/plugin/rustore_developer/actions/rustore_developer_status_action.rb
|
167
|
+
- lib/fastlane/plugin/rustore_developer/actions/rustore_developer_upload_action.rb
|
168
|
+
- lib/fastlane/plugin/rustore_developer/helper/rustore_developer_helper.rb
|
169
|
+
- lib/fastlane/plugin/rustore_developer/version.rb
|
170
|
+
homepage:
|
171
|
+
licenses:
|
172
|
+
- MIT
|
173
|
+
metadata: {}
|
174
|
+
post_install_message:
|
175
|
+
rdoc_options: []
|
176
|
+
require_paths:
|
177
|
+
- lib
|
178
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '2.6'
|
183
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
requirements: []
|
189
|
+
rubygems_version: 3.1.6
|
190
|
+
signing_key:
|
191
|
+
specification_version: 4
|
192
|
+
summary: RUSTORE beta API integration plugin
|
193
|
+
test_files: []
|