fastlane-plugin-catappultuploader 0.0.1

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: 671c4595d4444c26fd736bfc2ff2ab23f5f5b26ba7b6aaf60a64661d69e5c37b
4
+ data.tar.gz: c17fe2fb7ce8255b2edcd98221077c3c05ba7f4e31b275a01bba54cac19266bd
5
+ SHA512:
6
+ metadata.gz: 95fa7d8bf21109e39072f37d397ef88d3457ebc6c1bb9b8daf3d5dca9769ae43cd4da2c58c312c0dce56cfb0f1957e627628d7ea836a687f410f07c48af8e6d0
7
+ data.tar.gz: 87b7bf805fc20bcfde21ce982d8e17f563e20be705c2395bb55def9da72a8ec7a105ab8c62397e34958f86907dcf1bb046208f32ddf69c464a15df470b0f9f87
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 danielbras <daniel.bras@aptoide.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,52 @@
1
+ # catappultuploader plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-catappultuploader)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-catappultuploader`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin catappultuploader
11
+ ```
12
+
13
+ ## About catappultuploader
14
+
15
+ Catappult Uploader
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,97 @@
1
+ require "fastlane/action"
2
+ require_relative "../helper/catappultuploader_helper"
3
+ require "uri"
4
+ require "net/http"
5
+ require "net/http/uploadprogress"
6
+ require "ruby-progressbar"
7
+
8
+ module Fastlane
9
+ module Actions
10
+ class CatappultuploaderAction < Action
11
+ def self.run(params)
12
+
13
+ progressbar = ProgressBar.create
14
+ progressPercent = 0
15
+ form_data = []
16
+ file_iterator = 0
17
+
18
+ url = URI("https://uploader.catappult.io/api")
19
+
20
+ https = Net::HTTP.new(url.host, url.port)
21
+ https.read_timeout = 1800
22
+ https.open_timeout = 1800
23
+ https.use_ssl = true
24
+
25
+ request = Net::HTTP::Post.new(url)
26
+ request.set_form form_data, 'multipart/form-data'
27
+ request["Api-Key"] = params[:apiKey]
28
+
29
+ Dir.foreach(params[:supply_folder]) { |file, index|
30
+ next unless File.extname(file) == ".apk" || File.extname(file) == ".obb"
31
+ form_data.append(["files[#{file_iterator}]", File.open(params[:supply_folder] + "/" + file)])
32
+ file_iterator += 1
33
+ }
34
+ form_data.append(['billingMethod', 'catappult-osp'])
35
+
36
+ UI.message("Uploading your files:")
37
+ Net::HTTP::UploadProgress.new(request) do |progress|
38
+ if ((progress.upload_size / request.content_length.to_f * 100).to_i) != progressPercent
39
+ progressbar.increment
40
+ progressPercent = (progress.upload_size / request.content_length.to_f * 100).to_i
41
+
42
+ end
43
+ if (progressPercent == 100)
44
+ UI.message("Processing your files...")
45
+ end
46
+ end
47
+
48
+ response = https.request(request)
49
+
50
+
51
+ if response.code == "200"
52
+ UI.success("Upload Successful!")
53
+ else
54
+ begin
55
+ UI.error("ERROR: " + JSON.parse(response.read_body)["description"])
56
+ rescue
57
+ UI.error("ERROR: " + response.read_body)
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ def self.description
64
+ "Catappult Uploader"
65
+ end
66
+
67
+ def self.authors
68
+ ["danielbras"]
69
+ end
70
+
71
+ def self.available_options
72
+ [
73
+ FastlaneCore::ConfigItem.new(key: :apiKey,
74
+ env_name: "CATAPPULTUPLOADER_API_KEY",
75
+ description: "User API Key for Catappult account",
76
+ short_option: "-k",
77
+ optional: false,
78
+ type: String),
79
+ FastlaneCore::ConfigItem.new(key: :supply_folder,
80
+ env_name: "CATAPPULTUPLOADER_SUPPLY_FOLDER",
81
+ description: "Path to the folder containing the files to upload",
82
+ short_option: "-f",
83
+ default_value: File.expand_path("", Dir.pwd) + "/app/release",
84
+ optional: false,
85
+ type: String,
86
+ verify_block: proc do |value|
87
+ UI.user_error!("Could not find any .apk or .obb file at path '#{value}'") if Dir.foreach(value).none? { |fname| File.extname(fname) == ".apk" || File.extname(fname) == ".obb"}
88
+ end)
89
+ ]
90
+ end
91
+
92
+ def self.is_supported?(platform)
93
+ [:android].include?(platform)
94
+ end
95
+ end
96
+ end
97
+ 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 CatappultuploaderHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::CatappultuploaderHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the catappultuploader plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Catappultuploader
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/catappultuploader/version'
2
+
3
+ module Fastlane
4
+ module Catappultuploader
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::Catappultuploader.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,218 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-catappultuploader
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Catappult
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-08-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: net-http-uploadprogress
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: ruby-progressbar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.11.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.11.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
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: fastlane
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 2.208.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 2.208.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
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: rspec
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: rspec_junit_formatter
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
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '='
130
+ - !ruby/object:Gem::Version
131
+ version: 1.12.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '='
137
+ - !ruby/object:Gem::Version
138
+ version: 1.12.1
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-performance
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
+ - !ruby/object:Gem::Dependency
154
+ name: rubocop-require_tools
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ description:
182
+ email: joao.melo@aptoide.com
183
+ executables: []
184
+ extensions: []
185
+ extra_rdoc_files: []
186
+ files:
187
+ - LICENSE
188
+ - README.md
189
+ - lib/fastlane/plugin/catappultuploader.rb
190
+ - lib/fastlane/plugin/catappultuploader/actions/catappultuploader_action.rb
191
+ - lib/fastlane/plugin/catappultuploader/helper/catappultuploader_helper.rb
192
+ - lib/fastlane/plugin/catappultuploader/version.rb
193
+ homepage:
194
+ licenses:
195
+ - MIT
196
+ metadata: {}
197
+ post_install_message:
198
+ rdoc_options: []
199
+ require_paths:
200
+ - lib
201
+ required_ruby_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: '2.6'
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ requirements: []
212
+ rubygems_version: 3.0.3.1
213
+ signing_key:
214
+ specification_version: 4
215
+ summary: Upload your application directly onto Catappult! (Check how to get your API
216
+ Key in https://docs.catappult.io/docs/your-account#api-key). The upload will only
217
+ be successful if you follow our PSV rules (Read more in https://docs.catappult.io/docs/psv)
218
+ test_files: []