fastlane-plugin-supply_aptoide 0.1.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 +7 -0
- data/LICENSE +21 -0
- data/README.md +72 -0
- data/lib/fastlane/plugin/supply_aptoide.rb +16 -0
- data/lib/fastlane/plugin/supply_aptoide/actions/supply_aptoide_action.rb +152 -0
- data/lib/fastlane/plugin/supply_aptoide/helper/supply_aptoide_helper.rb +6 -0
- data/lib/fastlane/plugin/supply_aptoide/version.rb +5 -0
- metadata +161 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: e18ed53de02ff31b39df9e775772a2d76215e1b6
|
|
4
|
+
data.tar.gz: 516a178249c958589ad4b649eb0bf08d82963d02
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 53d3b7bef3dd3fdaffe9cce1d9da77e859190e99821ffd2f761d023af1d662e2fbd5da4d8feaf0dfe7447b9eb4dbb326faf081a3372b316de1ea7e4f14718336
|
|
7
|
+
data.tar.gz: 8df3ccd104307107de8bc80778a584053fcf63f51a075c603adffb5ec71420af0d12157a1e91de0de78a13956c97b6e4b01fac4eb8f004249cc63849b49971e4
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 William Schurman <wschurman@limbix.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,72 @@
|
|
|
1
|
+
# supply_aptoide plugin
|
|
2
|
+
|
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-supply_aptoide)
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-supply_aptoide`, add it to your project by running:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
fastlane add_plugin supply_aptoide
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## About supply_aptoide
|
|
14
|
+
|
|
15
|
+
Upload metadata, screenshots and binaries to Aptoide.
|
|
16
|
+
|
|
17
|
+
## Setup & Usage
|
|
18
|
+
|
|
19
|
+
#### Prerequisites
|
|
20
|
+
|
|
21
|
+
- Creation of app on store must be done on Aptoide web interface since this plugin doesn't support metadata.
|
|
22
|
+
|
|
23
|
+
#### Fastlane
|
|
24
|
+
|
|
25
|
+
1) Create a JSON file containing your aptoide username and password somewhere on the filesystem.
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"username": "...",
|
|
30
|
+
"password": "..."
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
2) Add supply_aptoide action to Fastfile after gradle build action.
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
supply_aptoide(
|
|
38
|
+
json_credential_path: './aptoide-credentials.json', # path to JSON file from above
|
|
39
|
+
repo: "#{your_aptoide_repo_here}", # aptoide private repo
|
|
40
|
+
only_user_repo: true,
|
|
41
|
+
apk: "#{lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH]}"
|
|
42
|
+
)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Run tests for this plugin
|
|
46
|
+
|
|
47
|
+
To run both the tests, and code style validation, run
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
rake
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
To automatically fix many of the styling issues, use
|
|
54
|
+
```sh
|
|
55
|
+
rubocop -a
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Issues and Feedback
|
|
59
|
+
|
|
60
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
|
61
|
+
|
|
62
|
+
## Troubleshooting
|
|
63
|
+
|
|
64
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
|
65
|
+
|
|
66
|
+
## Using _fastlane_ Plugins
|
|
67
|
+
|
|
68
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
|
69
|
+
|
|
70
|
+
## About _fastlane_
|
|
71
|
+
|
|
72
|
+
_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,16 @@
|
|
|
1
|
+
require 'fastlane/plugin/supply_aptoide/version'
|
|
2
|
+
|
|
3
|
+
module Fastlane
|
|
4
|
+
module SupplyAptoide
|
|
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::SupplyAptoide.all_classes.each do |current|
|
|
15
|
+
require current
|
|
16
|
+
end
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
require 'typhoeus'
|
|
3
|
+
|
|
4
|
+
module Fastlane
|
|
5
|
+
module Actions
|
|
6
|
+
class SupplyAptoideAction < Action
|
|
7
|
+
def self.run(params)
|
|
8
|
+
repo = params[:repo]
|
|
9
|
+
only_user_repo = params[:only_user_repo]
|
|
10
|
+
apk = params[:apk]
|
|
11
|
+
|
|
12
|
+
username, password = self.parse_json_credentials(params[:json_credential_path])
|
|
13
|
+
|
|
14
|
+
UI.message "Fetching access token..."
|
|
15
|
+
|
|
16
|
+
access_token = self.fetch_aptoid_access_token(username, password)
|
|
17
|
+
return unless access_token
|
|
18
|
+
|
|
19
|
+
UI.message "Got access token: '#{access_token}', starting upload..."
|
|
20
|
+
|
|
21
|
+
params = {
|
|
22
|
+
access_token: access_token,
|
|
23
|
+
repo: repo,
|
|
24
|
+
mode: "json",
|
|
25
|
+
apk: File.open(apk, "r")
|
|
26
|
+
}
|
|
27
|
+
if only_user_repo
|
|
28
|
+
params[:only_user_repo] = true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
response = Typhoeus.post(
|
|
32
|
+
"https://webservices.aptoide.com/webservices/3/uploadAppToRepo",
|
|
33
|
+
body: params
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
unless response.success?
|
|
37
|
+
UI.error "Could not contact Aptoide to upload apk"
|
|
38
|
+
return
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
parsed_response = nil
|
|
42
|
+
begin
|
|
43
|
+
parsed_response = JSON.parse(response.response_body)
|
|
44
|
+
rescue JSON::ParserError
|
|
45
|
+
UI.error "Invalid JSON returned by Apotide apk upload"
|
|
46
|
+
return
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
if parsed_response["status"] != "OK"
|
|
50
|
+
UI.error "Aptoide apk upload errors: #{parsed_response['errors']}"
|
|
51
|
+
return
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
UI.message "Successfully uploaded apk to Aptoide: #{parsed_response['url']}"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def self.parse_json_credentials(json_credential_path)
|
|
58
|
+
parsed = JSON.parse(File.read(File.expand_path(json_credential_path)))
|
|
59
|
+
return parsed["username"], parsed["password"]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.fetch_aptoid_access_token(username, password)
|
|
63
|
+
params = {
|
|
64
|
+
grant_type: "password",
|
|
65
|
+
client_id: "Aptoide",
|
|
66
|
+
mode: "json",
|
|
67
|
+
username: username,
|
|
68
|
+
password: password
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
response = Typhoeus.post(
|
|
72
|
+
"http://webservices.aptoide.com/webservices/3/oauth2Authentication",
|
|
73
|
+
headers: { 'Content-Type' => "application/json" },
|
|
74
|
+
body: params.to_json
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
unless response.success?
|
|
78
|
+
UI.error "Could not contact Aptoide to fetch access token"
|
|
79
|
+
return nil
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
parsed_response = nil
|
|
83
|
+
begin
|
|
84
|
+
parsed_response = JSON.parse(response.response_body)
|
|
85
|
+
rescue JSON::ParserError
|
|
86
|
+
UI.error "Invalid JSON returned by Apotide access token fetch: #{response.response_body}"
|
|
87
|
+
return nil
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
if parsed_response["error"]
|
|
91
|
+
UI.error "Aptoide access token fetch error: #{parsed_response['error_description']}"
|
|
92
|
+
return nil
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
return parsed_response["access_token"]
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def self.available_options
|
|
99
|
+
[
|
|
100
|
+
FastlaneCore::ConfigItem.new(key: :json_credential_path,
|
|
101
|
+
env_name: "SUPPLY_APTOIDE_JSON_CREDENTIAL_PATH",
|
|
102
|
+
short_option: "-c",
|
|
103
|
+
description: "JSON file containing object with username and password for authentication",
|
|
104
|
+
verify_block: proc do |value|
|
|
105
|
+
UI.user_error! "'#{value}' doesn't seem to be a JSON file" unless FastlaneCore::Helper.json_file?(File.expand_path(value))
|
|
106
|
+
begin
|
|
107
|
+
parsed_value = JSON.parse(File.read(File.expand_path(value)))
|
|
108
|
+
UI.user_error! "JSON must be an object with \"username\" and \"password\" keys" if parsed_value["username"].empty? || parsed_value["password"].empty?
|
|
109
|
+
rescue JSON::ParserError
|
|
110
|
+
UI.user_error! "Could not parse Aptoide account json -- JSON::ParseError"
|
|
111
|
+
end
|
|
112
|
+
end),
|
|
113
|
+
FastlaneCore::ConfigItem.new(key: :repo,
|
|
114
|
+
env_name: "SUPPLY_APTOIDE_REPO",
|
|
115
|
+
short_option: "-r",
|
|
116
|
+
description: "User repository name"),
|
|
117
|
+
FastlaneCore::ConfigItem.new(key: :only_user_repo,
|
|
118
|
+
env_name: "SUPPLY_APTOIDE_ONLY_USER_REPO",
|
|
119
|
+
short_option: "-x",
|
|
120
|
+
optional: true,
|
|
121
|
+
is_string: false,
|
|
122
|
+
description: "If true, the application gets uploaded only to the repository given in the repo argument. If false or ommited, the application gets uploaded to the official apps repository as well"),
|
|
123
|
+
FastlaneCore::ConfigItem.new(key: :apk,
|
|
124
|
+
env_name: "SUPPLY_APK",
|
|
125
|
+
description: "Path to the APK file to upload",
|
|
126
|
+
short_option: "-b",
|
|
127
|
+
default_value: Dir["*.apk"].last || Dir[File.join("app", "build", "outputs", "apk", "app-Release.apk")].last,
|
|
128
|
+
verify_block: proc do |value|
|
|
129
|
+
UI.user_error! "Could not find apk file at path '#{value}'" unless File.exist?(value)
|
|
130
|
+
UI.user_error! "apk file is not an apk" unless value.end_with?('.apk')
|
|
131
|
+
end)
|
|
132
|
+
]
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
def self.is_supported?(platform)
|
|
136
|
+
[:android].include?(platform)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def self.description
|
|
140
|
+
"Upload metadata, screenshots and binaries to Aptoide."
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def self.authors
|
|
144
|
+
["wschurman"]
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def self.details
|
|
148
|
+
"Drop-in replacement for supply that uploads to Aptoide instead."
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: fastlane-plugin-supply_aptoide
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- wschurman
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-04-25 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: json
|
|
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: typhoeus
|
|
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: 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: bundler
|
|
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: rake
|
|
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: '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: fastlane
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 2.28.3
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 2.28.3
|
|
125
|
+
description:
|
|
126
|
+
email: wschurman@limbix.com
|
|
127
|
+
executables: []
|
|
128
|
+
extensions: []
|
|
129
|
+
extra_rdoc_files: []
|
|
130
|
+
files:
|
|
131
|
+
- LICENSE
|
|
132
|
+
- README.md
|
|
133
|
+
- lib/fastlane/plugin/supply_aptoide.rb
|
|
134
|
+
- lib/fastlane/plugin/supply_aptoide/actions/supply_aptoide_action.rb
|
|
135
|
+
- lib/fastlane/plugin/supply_aptoide/helper/supply_aptoide_helper.rb
|
|
136
|
+
- lib/fastlane/plugin/supply_aptoide/version.rb
|
|
137
|
+
homepage: https://github.com/LimbixHealth/fastlane-plugin-supply_aptoide
|
|
138
|
+
licenses:
|
|
139
|
+
- MIT
|
|
140
|
+
metadata: {}
|
|
141
|
+
post_install_message:
|
|
142
|
+
rdoc_options: []
|
|
143
|
+
require_paths:
|
|
144
|
+
- lib
|
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
|
+
requirements:
|
|
147
|
+
- - ">="
|
|
148
|
+
- !ruby/object:Gem::Version
|
|
149
|
+
version: '0'
|
|
150
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
|
+
requirements:
|
|
152
|
+
- - ">="
|
|
153
|
+
- !ruby/object:Gem::Version
|
|
154
|
+
version: '0'
|
|
155
|
+
requirements: []
|
|
156
|
+
rubyforge_project:
|
|
157
|
+
rubygems_version: 2.6.11
|
|
158
|
+
signing_key:
|
|
159
|
+
specification_version: 4
|
|
160
|
+
summary: Upload metadata, screenshots and binaries to Aptoide
|
|
161
|
+
test_files: []
|