fastlane-plugin-wpmreleasetoolkit 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +339 -0
- data/README.md +38 -0
- data/bin/drawText +19 -0
- data/ext/drawText/extconf.rb +36 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit.rb +16 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/README.md +20 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_localize_libs_action.rb +53 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_update_metadata_source_action.rb +171 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/an_validate_lib_strings_action.rb +63 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_betabuild_prechecks.rb +103 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_prechecks.rb +83 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_build_preflight.rb +54 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_beta.rb +69 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_final_release.rb +58 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_hotfix.rb +77 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_bump_version_release.rb +89 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_codefreeze_prechecks.rb +79 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_completecodefreeze_prechecks.rb +68 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb +63 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_current_branch_is_hotfix.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_file_by_version.rb +79 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_download_translations_action.rb +115 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_finalize_prechecks.rb +71 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_alpha_version.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_app_version.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_get_release_version.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_hotifx_prechecks.rb +78 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_merge_translators_strings.rb +106 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_tag_build.rb +51 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_metadata.rb +52 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_update_release_notes.rb +56 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/circleci_trigger_job_action.rb +63 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/close_milestone_action.rb +56 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_new_milestone_action.rb +59 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/create_release_action.rb +91 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/extract_release_notes_for_version_action.rb +89 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_list_action.rb +64 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_downloadmetadata_action.rb +90 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/gp_update_metadata_source.rb +170 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/promo_screenshots_action.rb +247 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/removebranchprotection_action.rb +57 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setbranchprotection_action.rb +56 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/common/setfrozentag_action.rb +81 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_add_files_to_copy_action.rb +96 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_apply_action.rb +139 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_download_action.rb +57 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_setup_action.rb +86 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_update_action.rb +139 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/configure/configure_validate_action.rb +134 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_development_certificates_to_provisioning_profiles.rb +77 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/add_devices_to_provisioning_profiles.rb +79 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_betabuild_prechecks.rb +92 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_prechecks.rb +74 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_build_preflight.rb +78 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb +68 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb +87 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb +114 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_check_beta_deps.rb +62 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_clear_intermediate_tags.rb +60 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_codefreeze_prechecks.rb +70 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_completecodefreeze_prechecks.rb +63 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_current_branch_is_hotfix.rb +40 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_final_tag.rb +52 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_finalize_prechecks.rb +64 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_app_version.rb +47 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_build_version.rb +60 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_get_store_app_sizes.rb +121 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_hotifx_prechecks.rb +78 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_lint_localizations.rb +167 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_merge_translators_strings.rb +93 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_tag_build.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb +40 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb +81 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_release_notes.rb +56 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_validate_ci_build.rb +46 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/an_metadata_update_helper.rb +152 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_git_helper.rb +44 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_localize_helper.rb +359 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/android/android_version_helper.rb +475 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ci_helper.rb +91 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/configure_helper.rb +282 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/encryption_helper.rb +51 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/filesystem_helper.rb +93 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/git_helper.rb +224 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/github_helper.rb +135 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_adc_app_sizes_helper.rb +74 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb +80 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_l10n_helper.rb +208 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_version_helper.rb +348 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_download_helper.rb +107 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/metadata_update_helper.rb +182 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/promo_screenshots_helper.rb +399 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/helper/release_notes_helper.rb +21 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/configuration.rb +40 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/models/file_reference.rb +86 -0
- data/lib/fastlane/plugin/wpmreleasetoolkit/version.rb +5 -0
- metadata +449 -0
@@ -0,0 +1,121 @@
|
|
1
|
+
require_relative '../../helper/ios/ios_adc_app_sizes_helper.rb'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class IosGetStoreAppSizesAction < Action
|
6
|
+
Helper = Fastlane::Helper::Ios::ADCAppSizesHelper
|
7
|
+
|
8
|
+
def self.run(params)
|
9
|
+
app_sizes = Helper.get_adc_sizes(
|
10
|
+
adc_user: params[:adc_user],
|
11
|
+
adc_team: params[:adc_team],
|
12
|
+
bundle_id: params[:bundle_id],
|
13
|
+
only_version: params[:version],
|
14
|
+
limit: params[:limit]
|
15
|
+
)
|
16
|
+
|
17
|
+
devices = params[:devices]
|
18
|
+
|
19
|
+
case params[:format]
|
20
|
+
when 'csv'
|
21
|
+
csv = Helper.format_csv(app_sizes, devices: devices)
|
22
|
+
UI.message "Result (CSV)\n\n#{csv}\n"
|
23
|
+
when 'markdown'
|
24
|
+
tables = Helper.format_markdown(app_sizes, devices: devices)
|
25
|
+
tables.each do |table|
|
26
|
+
UI.message "Result (Markdown)\n\n#{table}\n"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
return app_sizes
|
31
|
+
end
|
32
|
+
|
33
|
+
#####################################################
|
34
|
+
# @!group Documentation
|
35
|
+
#####################################################
|
36
|
+
|
37
|
+
def self.description
|
38
|
+
'Gets the size of the app as reported in Apple Developer Portal for recent versions'
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.details
|
42
|
+
'Gets the download + installed size of the app from the Apple Developer Portail for various app versions release to AppStore and various device types'
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.available_options
|
46
|
+
[
|
47
|
+
FastlaneCore::ConfigItem.new(
|
48
|
+
key: :adc_user,
|
49
|
+
env_name: 'FL_IOS_STOREAPPSIZES_USER',
|
50
|
+
description: 'The ADC user to use to log into ADC',
|
51
|
+
type: String
|
52
|
+
),
|
53
|
+
FastlaneCore::ConfigItem.new(
|
54
|
+
key: :adc_team,
|
55
|
+
env_name: 'FL_IOS_STOREAPPSIZES_TEAM',
|
56
|
+
description: 'The ADC team name to use to log into ADC',
|
57
|
+
type: String,
|
58
|
+
optional: true,
|
59
|
+
default_value: 'Automattic, Inc.'
|
60
|
+
),
|
61
|
+
FastlaneCore::ConfigItem.new(
|
62
|
+
key: :bundle_id,
|
63
|
+
env_name: 'FL_IOS_STOREAPPSIZES_BUNDLEID',
|
64
|
+
description: 'The bundleID of the app to retrieve sizes from',
|
65
|
+
type: String
|
66
|
+
),
|
67
|
+
FastlaneCore::ConfigItem.new(
|
68
|
+
key: :version,
|
69
|
+
env_name: 'FL_IOS_STOREAPPSIZES_VERSION',
|
70
|
+
description: 'The version to retrive the data for. Keep nil to retrieve data for all the last {limit} versions',
|
71
|
+
type: String,
|
72
|
+
optional: true
|
73
|
+
),
|
74
|
+
FastlaneCore::ConfigItem.new(
|
75
|
+
key: :limit,
|
76
|
+
env_name: 'FL_IOS_STOREAPPSIZES_LIMIT',
|
77
|
+
description: 'The maximum number of past versions to retrieve information from',
|
78
|
+
type: Integer,
|
79
|
+
optional: true,
|
80
|
+
default_value: 10
|
81
|
+
),
|
82
|
+
FastlaneCore::ConfigItem.new(
|
83
|
+
key: :devices,
|
84
|
+
env_name: 'FL_IOS_STOREAPPSIZES_DEVICES',
|
85
|
+
description: 'The list of devices to print the app size for. If nil, will print data for all device types returned by ADC',
|
86
|
+
type: Array,
|
87
|
+
optional: true
|
88
|
+
),
|
89
|
+
FastlaneCore::ConfigItem.new(
|
90
|
+
key: :format,
|
91
|
+
env_name: 'FL_IOS_STOREAPPSIZES_FORMAT',
|
92
|
+
description: "The output format used to print the result. Can be one of 'csv' or 'markdown', or nil to print nothing (raw data will always be available as the the action's return value)",
|
93
|
+
type: String,
|
94
|
+
optional: true
|
95
|
+
),
|
96
|
+
]
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.output
|
100
|
+
# Define the shared values you are going to provide
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.return_type
|
104
|
+
:hash
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.return_value
|
108
|
+
'Return a Hash containing the details of download and install app size, for various device models, all that for each requested version of the app'
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.authors
|
112
|
+
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
|
113
|
+
['AliSoftware']
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.is_supported?(platform)
|
117
|
+
[:ios, :mac].include?(platform)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class IosHotfixPrechecksAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
UI.message "Skip confirm: #{params[:skip_confirm]}"
|
6
|
+
UI.message ''
|
7
|
+
|
8
|
+
require_relative '../../helper/ios/ios_version_helper.rb'
|
9
|
+
require_relative '../../helper/ios/ios_git_helper.rb'
|
10
|
+
|
11
|
+
# Evaluate previous tag
|
12
|
+
new_ver = params[:version]
|
13
|
+
prev_ver = Fastlane::Helper::Ios::VersionHelper.calc_prev_hotfix_version(new_ver)
|
14
|
+
|
15
|
+
# Confirm
|
16
|
+
message = "Requested Hotfix version: #{new_ver}\n"
|
17
|
+
message << "Branching from: #{prev_ver}\n"
|
18
|
+
|
19
|
+
if !params[:skip_confirm]
|
20
|
+
UI.user_error!('Aborted by user request') unless UI.confirm("#{message}Do you want to continue?")
|
21
|
+
else
|
22
|
+
UI.message(message)
|
23
|
+
end
|
24
|
+
|
25
|
+
# Check tags
|
26
|
+
UI.crash!("Version #{new_ver} already exists! Abort!") if other_action.git_tag_exists(tag: new_ver)
|
27
|
+
|
28
|
+
UI.crash!("Version #{prev_ver} is not tagged! Can't branch. Abort!") unless other_action.git_tag_exists(tag: prev_ver)
|
29
|
+
|
30
|
+
# Check local repo status
|
31
|
+
other_action.ensure_git_status_clean()
|
32
|
+
|
33
|
+
# Return the current version
|
34
|
+
prev_ver
|
35
|
+
end
|
36
|
+
|
37
|
+
#####################################################
|
38
|
+
# @!group Documentation
|
39
|
+
#####################################################
|
40
|
+
|
41
|
+
def self.description
|
42
|
+
'Runs some prechecks before preparing for a new hotfix'
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.details
|
46
|
+
'Checks out a new branch from a tag and updates tags'
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.available_options
|
50
|
+
[
|
51
|
+
FastlaneCore::ConfigItem.new(key: :version,
|
52
|
+
env_name: 'FL_IOS_HOTFIX_PRECHECKS_VERSION',
|
53
|
+
description: 'The version to work on', # a short description of this parameter
|
54
|
+
is_string: true),
|
55
|
+
FastlaneCore::ConfigItem.new(key: :skip_confirm,
|
56
|
+
env_name: 'FL_IOS_HOTFIX_PRECHECKS_SKIPCONFIRM',
|
57
|
+
description: 'Skips confirmation',
|
58
|
+
is_string: false, # true: verifies the input is a string, false: every kind of value
|
59
|
+
default_value: false), # the default value if the user didn't provide one
|
60
|
+
]
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.output
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.return_value
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.authors
|
70
|
+
['loremattei']
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.is_supported?(platform)
|
74
|
+
platform == :ios
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class IosLintLocalizationsAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
violations = {}
|
6
|
+
|
7
|
+
loop do
|
8
|
+
violations = self.run_linter(params)
|
9
|
+
break unless !violations.empty? && params[:allow_retry] && UI.confirm(RETRY_MESSAGE)
|
10
|
+
end
|
11
|
+
|
12
|
+
UI.abort_with_message!(ABORT_MESSAGE) if !violations.empty? && params[:abort_on_violations]
|
13
|
+
|
14
|
+
violations
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.run_linter(params)
|
18
|
+
UI.message 'Linting localizations for parameter placeholders consistency...'
|
19
|
+
|
20
|
+
require_relative '../../helper/ios/ios_l10n_helper.rb'
|
21
|
+
helper = Fastlane::Helper::Ios::L10nHelper.new(
|
22
|
+
install_path: resolve_path(params[:install_path]),
|
23
|
+
version: params[:version]
|
24
|
+
)
|
25
|
+
violations = helper.run(
|
26
|
+
input_dir: resolve_path(params[:input_dir]),
|
27
|
+
base_lang: params[:base_lang],
|
28
|
+
only_langs: params[:only_langs]
|
29
|
+
)
|
30
|
+
|
31
|
+
violations.each do |lang, diff|
|
32
|
+
UI.error "Inconsistencies found between '#{params[:base_lang]}' and '#{lang}':\n\n#{diff}\n"
|
33
|
+
end
|
34
|
+
|
35
|
+
violations
|
36
|
+
end
|
37
|
+
|
38
|
+
RETRY_MESSAGE = <<~MSG
|
39
|
+
Inconsistencies found during Localization linting.
|
40
|
+
You need to fix them before continuing. From this point on, you should either:
|
41
|
+
|
42
|
+
- Cancel this lane (reply 'No' below), then work with polyglots in #i18n
|
43
|
+
to fix those directly in GlotPress – by rejecting the inconsistent
|
44
|
+
translations, or by submitting a fixed copy. Rerun the lane when everything
|
45
|
+
has been fixed.
|
46
|
+
|
47
|
+
This is the recommended way to go, as it will fix the issues at their source.
|
48
|
+
|
49
|
+
- Or manually edit the `Localizable.strings` files to fix the inconsistencies
|
50
|
+
locally, commit them, then reply 'Yes' below to re-lint and validate that all
|
51
|
+
inconsistencies have been fixed locally so you can continue with the build.
|
52
|
+
|
53
|
+
This is only a workaround to allow you to submit a build if translators are
|
54
|
+
not available to help you fix the issues in GlotPress in time. You will still
|
55
|
+
need to let the translators know that they will need to fix those copies
|
56
|
+
at some point before the next build to fix the root of the issue.
|
57
|
+
|
58
|
+
Did you fix the `.strings` files locally and want to lint them again?
|
59
|
+
MSG
|
60
|
+
|
61
|
+
ABORT_MESSAGE = <<~MSG
|
62
|
+
Inconsistencies found during Localization linting. Aborting.
|
63
|
+
MSG
|
64
|
+
|
65
|
+
def self.repo_root
|
66
|
+
@repo_root || `git rev-parse --show-toplevel`.chomp
|
67
|
+
end
|
68
|
+
|
69
|
+
# If the path is relative, makes the path absolute by resolving it relative to the repository's root.
|
70
|
+
# If the path is already absolute, it will not affect it and return it as-is.
|
71
|
+
def self.resolve_path(path)
|
72
|
+
File.absolute_path(path, repo_root)
|
73
|
+
end
|
74
|
+
|
75
|
+
#####################################################
|
76
|
+
# @!group Documentation
|
77
|
+
#####################################################
|
78
|
+
|
79
|
+
def self.description
|
80
|
+
'Lint the different *.lproj/.strings files for each locale and ensure the parameter placeholders are consistent.'
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.details
|
84
|
+
'Compares the translations against a base language to find potential mismatches for the %s/%d/… parameter placeholders between locales.'
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.available_options
|
88
|
+
[
|
89
|
+
FastlaneCore::ConfigItem.new(
|
90
|
+
key: :install_path,
|
91
|
+
env_name: 'FL_IOS_LINT_TRANSLATIONS_INSTALL_PATH',
|
92
|
+
description: 'The path where to install the SwiftGen tooling needed to run the linting process. If a relative path, should be relative to your repo_root',
|
93
|
+
type: String,
|
94
|
+
optional: true,
|
95
|
+
default_value: "vendor/swiftgen/#{Fastlane::Helper::Ios::L10nHelper::SWIFTGEN_VERSION}"
|
96
|
+
),
|
97
|
+
FastlaneCore::ConfigItem.new(
|
98
|
+
key: :version,
|
99
|
+
env_name: 'FL_IOS_LINT_TRANSLATIONS_SWIFTGEN_VERSION',
|
100
|
+
description: 'The version of SwiftGen to install and use for linting',
|
101
|
+
type: String,
|
102
|
+
optional: true,
|
103
|
+
default_value: Fastlane::Helper::Ios::L10nHelper::SWIFTGEN_VERSION
|
104
|
+
),
|
105
|
+
FastlaneCore::ConfigItem.new(
|
106
|
+
key: :input_dir,
|
107
|
+
env_name: 'FL_IOS_LINT_TRANSLATIONS_INPUT_DIR',
|
108
|
+
description: 'The path to the directory containing the .lproj folders to lint, relative to your git repo root',
|
109
|
+
type: String,
|
110
|
+
optional: false
|
111
|
+
),
|
112
|
+
FastlaneCore::ConfigItem.new(
|
113
|
+
key: :base_lang,
|
114
|
+
env_name: 'FL_IOS_LINT_TRANSLATIONS_BASE_LANG',
|
115
|
+
description: 'The language that should be used as the base language that every other language will be compared against',
|
116
|
+
type: String,
|
117
|
+
optional: true,
|
118
|
+
default_value: Fastlane::Helper::Ios::L10nHelper::DEFAULT_BASE_LANG
|
119
|
+
),
|
120
|
+
FastlaneCore::ConfigItem.new(
|
121
|
+
key: :only_langs,
|
122
|
+
env_name: 'FL_IOS_LINT_TRANSLATIONS_ONLY_LANGS',
|
123
|
+
description: 'The list of languages to limit the analysis to',
|
124
|
+
type: Array,
|
125
|
+
optional: true
|
126
|
+
),
|
127
|
+
FastlaneCore::ConfigItem.new(
|
128
|
+
key: :abort_on_violations,
|
129
|
+
env_name: 'FL_IOS_LINT_TRANSLATIONS_ABORT',
|
130
|
+
description: 'Should we abort the rest of the lane with a global error if any violations are found?',
|
131
|
+
optional: true,
|
132
|
+
default_value: true,
|
133
|
+
is_string: false # https://docs.fastlane.tools/advanced/actions/#boolean-parameters
|
134
|
+
),
|
135
|
+
FastlaneCore::ConfigItem.new(
|
136
|
+
key: :allow_retry,
|
137
|
+
env_name: 'FL_IOS_LINT_TRANSLATIONS_ALLOW_RETRY',
|
138
|
+
description: 'If any violations are found, show an interactive prompt allowing the user to manually fix the issues locally and retry the linting',
|
139
|
+
optional: true,
|
140
|
+
default_value: false,
|
141
|
+
is_string: false # https://docs.fastlane.tools/advanced/actions/#boolean-parameters
|
142
|
+
),
|
143
|
+
]
|
144
|
+
end
|
145
|
+
|
146
|
+
def self.output
|
147
|
+
nil
|
148
|
+
end
|
149
|
+
|
150
|
+
def self.return_type
|
151
|
+
:hash_of_strings
|
152
|
+
end
|
153
|
+
|
154
|
+
def self.return_value
|
155
|
+
'A hash, keyed by language code, whose values are the diff found for said language'
|
156
|
+
end
|
157
|
+
|
158
|
+
def self.authors
|
159
|
+
['AliSoftware']
|
160
|
+
end
|
161
|
+
|
162
|
+
def self.is_supported?(platform)
|
163
|
+
[:ios, :mac].include?(platform)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class IosLocalizeProjectAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
UI.message 'Updating project localisation...'
|
6
|
+
|
7
|
+
require_relative '../../helper/ios/ios_git_helper.rb'
|
8
|
+
other_action.cocoapods()
|
9
|
+
Fastlane::Helper::Ios::GitHelper.localize_project()
|
10
|
+
|
11
|
+
UI.message 'Done.'
|
12
|
+
end
|
13
|
+
|
14
|
+
#####################################################
|
15
|
+
# @!group Documentation
|
16
|
+
#####################################################
|
17
|
+
|
18
|
+
def self.description
|
19
|
+
'Gathers the string to localise'
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.details
|
23
|
+
'Gathers the string to localise'
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.available_options
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.output
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.return_value
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.authors
|
36
|
+
['loremattei']
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.is_supported?(platform)
|
40
|
+
platform == :ios
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require 'date'
|
3
|
+
require_relative '../../helper/github_helper'
|
4
|
+
require_relative '../../helper/ios/ios_version_helper'
|
5
|
+
module Fastlane
|
6
|
+
module Actions
|
7
|
+
class IosMergeTranslatorsStringsAction < Action
|
8
|
+
def self.run(params)
|
9
|
+
folder_path = File.expand_path(params[:strings_folder])
|
10
|
+
|
11
|
+
subfolders = Dir.entries(folder_path)
|
12
|
+
subfolders.each do |strings_folder|
|
13
|
+
merge_folder(File.join(folder_path, strings_folder)) if strings_folder.ends_with?('.lproj')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.merge_folder(strings_folder)
|
18
|
+
main_file = File.join(strings_folder, 'Localizable.strings')
|
19
|
+
tmp_main_file = File.join(strings_folder, 'Localizable_current.strings')
|
20
|
+
return unless File.exist?(main_file) && File.exist?(tmp_main_file)
|
21
|
+
|
22
|
+
UI.message("Merging in: #{strings_folder}")
|
23
|
+
|
24
|
+
join_files = Dir.glob(File.join(strings_folder, 'Localizable_*.strings')) - [tmp_main_file]
|
25
|
+
extra_strings = []
|
26
|
+
extra_keys = []
|
27
|
+
join_files.each do |join_strings|
|
28
|
+
my_strings = File.read(join_strings).split("\n")
|
29
|
+
my_strings.each do |string|
|
30
|
+
if string[/^\"(.*)\" = \"(.*)\";$/]
|
31
|
+
/^\"(?<string_key>.*)\" = \"/i =~ string
|
32
|
+
unless extra_keys.include?(string_key)
|
33
|
+
extra_strings << string
|
34
|
+
extra_keys << string_key
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
File.delete(join_strings)
|
40
|
+
end
|
41
|
+
|
42
|
+
File.open(main_file, 'w') do |f|
|
43
|
+
File.open(tmp_main_file).each do |line|
|
44
|
+
f.puts(check_line(line, extra_keys))
|
45
|
+
end
|
46
|
+
f.puts(extra_strings)
|
47
|
+
end
|
48
|
+
|
49
|
+
File.delete(tmp_main_file)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.check_line(line, extra_keys)
|
53
|
+
return line unless line[/^\"(.*)\" = \"(.*)\";$/]
|
54
|
+
|
55
|
+
/^\"(?<line_key>.*)\" = \"/i =~ line
|
56
|
+
return '' if extra_keys.include?(line_key)
|
57
|
+
|
58
|
+
return line
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.description
|
62
|
+
'Merge strings for translators'
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.authors
|
66
|
+
['Lorenzo Mattei']
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.return_value
|
70
|
+
# If your method provides a return value, you can describe here what it does
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.details
|
74
|
+
# Optional:
|
75
|
+
'Merges waiting and fuzzy strings into the main file for translators'
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.available_options
|
79
|
+
[
|
80
|
+
FastlaneCore::ConfigItem.new(key: :strings_folder,
|
81
|
+
env_name: 'IMTS_STRING_FOLDER',
|
82
|
+
description: 'The folder that contains all the translations',
|
83
|
+
optional: false,
|
84
|
+
type: String),
|
85
|
+
]
|
86
|
+
end
|
87
|
+
|
88
|
+
def self.is_supported?(platform)
|
89
|
+
true
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|