fastlane-plugin-wpmreleasetoolkit 1.1.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +17 -11
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +11 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +24 -24
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +25 -22
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +23 -28
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +29 -38
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +14 -7
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +8 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +9 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +6 -2
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +7 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +7 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +7 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotifx_prechecks.rb +4 -4
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +9 -3
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb +147 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +30 -15
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +14 -5
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +124 -46
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb +3 -1
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb +79 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +1 -1
- metadata +18 -2
@@ -36,7 +36,9 @@ module Fastlane
|
|
36
36
|
while continue
|
37
37
|
child_filenames = dir.children.map! { |x| File.basename(x) }
|
38
38
|
|
39
|
-
|
39
|
+
# The first case is for development – where the `.gemspec` is present in the project root
|
40
|
+
# The second case is for production – where there's no `.gemspec`, but the root dir of the plugin is named `fastlane-plugin-wpmreleasetoolkit-{version}`.
|
41
|
+
if child_filenames.include?('fastlane-plugin-wpmreleasetoolkit.gemspec') || File.basename(dir).start_with?('fastlane-plugin-wpmreleasetoolkit-')
|
40
42
|
continue = false
|
41
43
|
else
|
42
44
|
dir = dir.parent
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'uri'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Helper
|
6
|
+
class GlotPressHelper
|
7
|
+
# Gets the data about status of the translation.
|
8
|
+
#
|
9
|
+
# @param [String] URL to the GlotPress project.
|
10
|
+
#
|
11
|
+
# @return [Array] Data from GlotPress project overview page.
|
12
|
+
#
|
13
|
+
def self.get_translation_status_data(glotpress_url:)
|
14
|
+
uri = URI.parse(glotpress_url)
|
15
|
+
response = Net::HTTP.get_response(uri)
|
16
|
+
response = Net::HTTP.get_response(URI.parse(response.header['location'])) if response.code == '301'
|
17
|
+
|
18
|
+
response.body.split("\n")
|
19
|
+
end
|
20
|
+
|
21
|
+
# Gets the status of the translation for a given language.
|
22
|
+
#
|
23
|
+
# @param [Array] Data from GlotPress project overview page.
|
24
|
+
# @param [String] The code of the language to get information about (GlotPress format).
|
25
|
+
#
|
26
|
+
# @return [Integer] The percentage of the translated strings.
|
27
|
+
#
|
28
|
+
def self.get_translation_status(data:, language_code:)
|
29
|
+
# The status is parsed from the GlotPress project page.
|
30
|
+
# The row can be identified by the language code and the progress is in the column identified by the class "stats percent".
|
31
|
+
# When the progress is above 90%, a special badge is added.
|
32
|
+
# Because of the way the HTML is organized, this regex matches content spawned on three or four lines
|
33
|
+
# Regex:
|
34
|
+
# ^ : start of a line
|
35
|
+
# \s* : any space
|
36
|
+
# <strong><a href=".*\/#{language_code}\/default\/"> : This link contains the language code of that line in the HTML table, so it's a reliable match
|
37
|
+
# .* : any character. The language name should be here, but it can be less reliable than the language code as a match
|
38
|
+
# <\/strong> : tag closure
|
39
|
+
# \n : new line
|
40
|
+
# (?: : match the following. This starts the "morethan90" special badge, which we expect to exist zero or one times (see the closure of this part of the regex).
|
41
|
+
# \s* : any space
|
42
|
+
# <span class="bubble morethan90"> : Start of the special badge
|
43
|
+
# \d\d\d?% : 2 or 3 digits and the percentage char
|
44
|
+
# <\/span>\n : Special badge closure and new line
|
45
|
+
# )? : end of the "morethan90" special badge section. Expect this zero or one times.
|
46
|
+
# \s*<\/td>\n : column closure tag. Any space before of it are ok. Expect new line after it.
|
47
|
+
# \s* : any space
|
48
|
+
# <td class="stats percent"> : This is the tag which can be used to extract the progress
|
49
|
+
# ([0-9]+) : progress is the first group
|
50
|
+
# %<\/td> : tag closure
|
51
|
+
regex = "^\\s*<strong><a href=\".*\\/#{language_code}\\/default\\/\">.*<\\/strong>\\n"
|
52
|
+
regex += '(?:\s*<span class="bubble morethan90">\d\d\d?%<\/span>\n)?\s*<\/td>\n\s*<td class="stats percent">([0-9]+)%<\/td>$'
|
53
|
+
|
54
|
+
# 1. Merge the array into a single string.
|
55
|
+
# 2. Match the info and extract the value in group 1.
|
56
|
+
# 3. Convert to integer.
|
57
|
+
data.join("\n").match(/#{regex}/)[1].to_i
|
58
|
+
end
|
59
|
+
|
60
|
+
# Extract the number of strings which are in the given status.
|
61
|
+
#
|
62
|
+
# @param [Array] Data from GlotPress project overview page.
|
63
|
+
# @param [String] The code of the language to get information about (GlotPress format).
|
64
|
+
# @param [String] The status which data should be extracted for.
|
65
|
+
#
|
66
|
+
# @return [Integer] The percentage of the translated strings.
|
67
|
+
#
|
68
|
+
def self.extract_value_from_translation_info_data(data:, language_code:, status:)
|
69
|
+
regex = "\/#{language_code}\/.*#{status}.*>([0-9,]+)"
|
70
|
+
|
71
|
+
# 1. Grep the line with contains the required info.
|
72
|
+
# 2. Match the info and extract the value in group 1.
|
73
|
+
# 3. Values use comma as thousands separator, so remove it.
|
74
|
+
# 4. Convert to integer.
|
75
|
+
data.grep(/#{regex}/)[0].match(/#{regex}/)[1].gsub(/,/, '').to_i
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
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: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lorenzo Mattei
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|
@@ -318,6 +318,20 @@ dependencies:
|
|
318
318
|
- - "~>"
|
319
319
|
- !ruby/object:Gem::Version
|
320
320
|
version: '4.1'
|
321
|
+
- !ruby/object:Gem::Dependency
|
322
|
+
name: cocoapods
|
323
|
+
requirement: !ruby/object:Gem::Requirement
|
324
|
+
requirements:
|
325
|
+
- - "~>"
|
326
|
+
- !ruby/object:Gem::Version
|
327
|
+
version: '1.10'
|
328
|
+
type: :development
|
329
|
+
prerelease: false
|
330
|
+
version_requirements: !ruby/object:Gem::Requirement
|
331
|
+
requirements:
|
332
|
+
- - "~>"
|
333
|
+
- !ruby/object:Gem::Version
|
334
|
+
version: '1.10'
|
321
335
|
description:
|
322
336
|
email: lore.mattei@gmail.com
|
323
337
|
executables:
|
@@ -385,6 +399,7 @@ files:
|
|
385
399
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb
|
386
400
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb
|
387
401
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_for_toolkit_updates_action.rb
|
402
|
+
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/check_translation_progress.rb
|
388
403
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/circleci_trigger_job_action.rb
|
389
404
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb
|
390
405
|
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb
|
@@ -440,6 +455,7 @@ files:
|
|
440
455
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb
|
441
456
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb
|
442
457
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb
|
458
|
+
- lib/fastlane/plugin/wpmreleasetoolkit/helper/glotpress_helper.rb
|
443
459
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb
|
444
460
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb
|
445
461
|
- lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb
|