fastlane-plugin-wpmreleasetoolkit 8.0.0 → 8.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 800ea2231ea5727ef5d9f529e38802b18b947bfd124d5a904c5ee9eef29cf389
|
4
|
+
data.tar.gz: 742331639d6749c92bc2303d0a8303fc790a90517c46262410f259b99ea174fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7017d051cea5a6be3a734dbba0ad1b0e8d7f3bb372aa0b62af9bc113546fbbcb429c24c48e8edbeae28d80f502c5886ab891c696415772731e4123a5f3a1cc3
|
7
|
+
data.tar.gz: 5f4c26332afb18a947df9368ba9efc1f9508db854c0270fd84e5a12125c31f2bc89695b6311efb5e3cd6047a54b7c73efe8da5288cc5bd334461c85952db871a
|
@@ -10,12 +10,13 @@ module Fastlane
|
|
10
10
|
UI.message "Locales: #{params[:locales].inspect}"
|
11
11
|
UI.message "Source locale: #{params[:source_locale].nil? ? '-' : params[:source_locale]}"
|
12
12
|
UI.message "Path: #{params[:download_path]}"
|
13
|
+
UI.message "Auto-retry: #{params[:auto_retry]}"
|
13
14
|
|
14
15
|
# Check download path
|
15
16
|
FileUtils.mkdir_p(params[:download_path])
|
16
17
|
|
17
18
|
# Download
|
18
|
-
downloader = Fastlane::Helper::MetadataDownloader.new(params[:download_path], params[:target_files])
|
19
|
+
downloader = Fastlane::Helper::MetadataDownloader.new(params[:download_path], params[:target_files], params[:auto_retry])
|
19
20
|
|
20
21
|
params[:locales].each do |loc|
|
21
22
|
if loc.is_a?(Array)
|
@@ -59,7 +60,7 @@ module Fastlane
|
|
59
60
|
FastlaneCore::ConfigItem.new(key: :locales,
|
60
61
|
env_name: 'FL_DOWNLOAD_METADATA_LOCALES',
|
61
62
|
description: 'The hash with the GlotPress locale and the project locale association',
|
62
|
-
|
63
|
+
is_string: false),
|
63
64
|
FastlaneCore::ConfigItem.new(key: :source_locale,
|
64
65
|
env_name: 'FL_DOWNLOAD_METADATA_SOURCE_LOCALE',
|
65
66
|
description: 'The source locale code',
|
@@ -68,6 +69,12 @@ module Fastlane
|
|
68
69
|
env_name: 'FL_DOWNLOAD_METADATA_DOWNLOAD_PATH',
|
69
70
|
description: 'The path of the target files',
|
70
71
|
type: String),
|
72
|
+
FastlaneCore::ConfigItem.new(key: :auto_retry,
|
73
|
+
env_name: 'FL_DOWNLOAD_METADATA_AUTO_RETRY',
|
74
|
+
description: 'Whether to auto retry downloads after Too Many Requests error',
|
75
|
+
type: FastlaneCore::Boolean,
|
76
|
+
optional: true,
|
77
|
+
default_value: true),
|
71
78
|
]
|
72
79
|
end
|
73
80
|
|
@@ -4,12 +4,17 @@ require 'json'
|
|
4
4
|
module Fastlane
|
5
5
|
module Helper
|
6
6
|
class MetadataDownloader
|
7
|
+
AUTO_RETRY_SLEEP_TIME = 20
|
8
|
+
MAX_AUTO_RETRY_ATTEMPTS = 30
|
9
|
+
|
7
10
|
attr_reader :target_folder, :target_files
|
8
11
|
|
9
|
-
def initialize(target_folder, target_files)
|
12
|
+
def initialize(target_folder, target_files, auto_retry)
|
10
13
|
@target_folder = target_folder
|
11
14
|
@target_files = target_files
|
15
|
+
@auto_retry = auto_retry
|
12
16
|
@alternates = {}
|
17
|
+
@auto_retry_attempt_counter = 0
|
13
18
|
end
|
14
19
|
|
15
20
|
# Downloads data from GlotPress, in JSON format
|
@@ -112,8 +117,13 @@ module Fastlane
|
|
112
117
|
UI.message("Received 301 for `#{locale}`. Following redirect...")
|
113
118
|
download(locale, response.header['location'], is_source)
|
114
119
|
when '429'
|
115
|
-
# We got rate-limited, offer to try again
|
116
|
-
if
|
120
|
+
# We got rate-limited, auto_retry or offer to try again with a prompt
|
121
|
+
if @auto_retry && @auto_retry_attempt_counter <= MAX_AUTO_RETRY_ATTEMPTS
|
122
|
+
UI.message("Received 429 for `#{locale}`. Auto retrying in #{AUTO_RETRY_SLEEP_TIME} seconds...")
|
123
|
+
sleep(AUTO_RETRY_SLEEP_TIME)
|
124
|
+
@auto_retry_attempt_counter += 1
|
125
|
+
download(locale, response.uri, is_source)
|
126
|
+
elsif UI.confirm("Retry downloading `#{locale}` after receiving 429 from the API?")
|
117
127
|
download(locale, response.uri, is_source)
|
118
128
|
else
|
119
129
|
UI.error("Abandoning `#{locale}` download as requested.")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-wpmreleasetoolkit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Automattic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|