Skip to content

Commit 4b398ed

Browse files
authored
Merge pull request #447 from iangmaia/cleanup/remove-legacy-localization-tooling
Remove legacy localisation script references and actions
2 parents aea6166 + 7aaa3b7 commit 4b398ed

File tree

8 files changed

+8
-140
lines changed

8 files changed

+8
-140
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
### Breaking Changes
88

99
- Remove the `skip_glotpress` parameter from the `ios_bump_version_release` action [#443]
10+
- Remove the `ios_localize_project` and `ios_update_metadata` actions [#447]
1011

1112
### New Features
1213

lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_beta.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def self.run(params)
1515
Fastlane::Helper::Ios::VersionHelper.update_xc_configs(@new_beta_version, @short_version, @new_internal_version)
1616
UI.message 'Done!'
1717

18-
Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: false, include_metadata: false)
18+
Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: false)
1919
end
2020

2121
#####################################################

lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_hotfix.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def self.run(params)
2020
Fastlane::Helper::Ios::VersionHelper.update_xc_configs(@new_version, @new_short_version, @new_version_internal)
2121
UI.message 'Done!'
2222

23-
Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: update_deliverfile, include_metadata: false)
23+
Fastlane::Helper::Ios::GitHelper.commit_version_bump(include_deliverfile: update_deliverfile)
2424

2525
UI.message 'Done.'
2626
end

lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_bump_version_release.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ def self.run(params)
3030
UI.message 'Done!'
3131

3232
Fastlane::Helper::Ios::GitHelper.commit_version_bump(
33-
include_deliverfile: !params[:skip_deliver],
34-
include_metadata: false
33+
include_deliverfile: !params[:skip_deliver]
3534
)
3635

3736
UI.message 'Done.'

lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_localize_project.rb

Lines changed: 0 additions & 43 deletions
This file was deleted.

lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata.rb

Lines changed: 0 additions & 40 deletions
This file was deleted.

lib/fastlane/plugin/wpmreleasetoolkit/helper/ios/ios_git_helper.rb

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -9,67 +9,18 @@ module GitHelper
99
# This typically commits and pushes:
1010
# - The files in `./config/*` – especially `Version.*.xcconfig` files
1111
# - The `fastlane/Deliverfile` file (which contains the `app_version` line)
12-
# - The `<ProjectRoot>/<ProjectName>/Resources/AppStoreStrings.pot` file, containing a key for that version's release notes
1312
#
1413
# @env PROJECT_ROOT_FOLDER The path to the git root of the project
15-
# @env PROJECT_NAME The name of the directory containing the project code (especially containing the Resources/ subfolder)
1614
#
1715
# @param [Bool] include_deliverfile If true (the default), includes the `fastlane/Deliverfile` in files being commited
18-
# @param [Bool] include_metadata If true (the default), includes the `fastlane/download_metadata.swift` file and the `.pot` file (which typically contains an entry or release notes for the new version)
1916
#
20-
def self.commit_version_bump(include_deliverfile: true, include_metadata: true)
21-
files_list = [File.join(ENV['PROJECT_ROOT_FOLDER'], 'config', '.')]
17+
def self.commit_version_bump(include_deliverfile: true)
18+
files_list = [File.join(get_from_env!(key: 'PROJECT_ROOT_FOLDER'), 'config', '.')]
2219
files_list.append File.join('fastlane', 'Deliverfile') if include_deliverfile
23-
if include_metadata
24-
files_list.append File.join('fastlane', 'download_metadata.swift')
25-
files_list.append File.join(ENV['PROJECT_ROOT_FOLDER'], ENV['PROJECT_NAME'], 'Resources', ENV['APP_STORE_STRINGS_FILE_NAME'])
26-
end
2720

2821
Fastlane::Helper::GitHelper.commit(message: 'Bump version number', files: files_list, push: true)
2922
end
3023

31-
# Calls the `Scripts/localize.py` script in the project root folder and push the `*.strings` files
32-
#
33-
# That script updates the `.strings` files with translations from GlotPress.
34-
#
35-
# @env PROJECT_ROOT_FOLDER The path to the git root of the project
36-
# @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
37-
#
38-
# @deprecated This method is only used by the `ios_localize_project` action, which is itself deprecated
39-
# in favor of the new `ios_generate_strings_file_from_code` action
40-
# @todo [Next Major] Remove this method once we fully remove `ios_localize_project`
41-
#
42-
def self.localize_project
43-
Action.sh("cd #{get_from_env!(key: 'PROJECT_ROOT_FOLDER')} && ./Scripts/localize.py")
44-
45-
Fastlane::Helper::GitHelper.commit(message: 'Update strings for localization', files: strings_files, push: true) || UI.message('No new strings, skipping commit')
46-
end
47-
48-
# Call the `Scripts/update-translations.rb` then the `fastlane/download_metadata` Scripts from the host project folder
49-
#
50-
# @env PROJECT_ROOT_FOLDER The path to the git root of the project
51-
# @env PROJECT_NAME The name of the directory containing the project code (especially containing the `build.gradle` file)
52-
#
53-
# @todo Migrate the scripts, currently in each host repo and called by this method, to be helpers and actions
54-
# in the release-toolkit instead, and move this code away from `ios_git_helper`.
55-
#
56-
def self.update_metadata
57-
Action.sh("cd #{get_from_env!(key: 'PROJECT_ROOT_FOLDER')} && ./Scripts/update-translations.rb")
58-
59-
Fastlane::Helper::GitHelper.commit(message: 'Update translations', files: strings_files, push: false)
60-
61-
Action.sh('cd fastlane && ./download_metadata.swift')
62-
63-
Fastlane::Helper::GitHelper.commit(message: 'Update metadata translations', files: './fastlane/metadata/', push: true)
64-
end
65-
66-
def self.strings_files
67-
project_root = get_from_env!(key: 'PROJECT_ROOT_FOLDER')
68-
project_name = get_from_env!(key: 'PROJECT_NAME')
69-
70-
Dir.glob(File.join(project_root, project_name, '**', '*.strings'))
71-
end
72-
7324
def self.get_from_env!(key:)
7425
ENV.fetch(key) do
7526
UI.user_error! "Could not find value for \"#{key}\" in environment."

spec/ios_bump_version_release_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
skip_deliver = false
2424

2525
expect(Fastlane::Helper::Ios::VersionHelper).to receive(:update_fastlane_deliver).with(next_version_short)
26-
expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver, include_metadata: false)
26+
expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver)
2727

2828
run_described_fastlane_action(
2929
skip_deliver: skip_deliver,
@@ -35,7 +35,7 @@
3535
skip_deliver = true
3636

3737
expect(Fastlane::Helper::Ios::VersionHelper).not_to receive(:update_fastlane_deliver)
38-
expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver, include_metadata: false)
38+
expect(Fastlane::Helper::Ios::GitHelper).to receive(:commit_version_bump).with(include_deliverfile: !skip_deliver)
3939

4040
run_described_fastlane_action(
4141
skip_deliver: skip_deliver,

0 commit comments

Comments
 (0)