Skip to content

Commit 261f9e0

Browse files
authored
Merge pull request #109 from wordpress-mobile/feature/add-ios-localization-lane
Add iOS update metadata source lane
2 parents 4668aa1 + 7a98a80 commit 261f9e0

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
module Fastlane
2+
module Actions
3+
class IosUpdateMetadataSourceAction < Action
4+
def self.run(params)
5+
# Check local repo status
6+
other_action.ensure_git_status_clean()
7+
8+
other_action.gp_update_metadata_source(po_file_path: params[:po_file_path],
9+
source_files: params[:source_files],
10+
release_version: params[:release_version])
11+
12+
Action.sh("git add #{params[:po_file_path]}")
13+
params[:source_files].each do | key, file |
14+
Action.sh("git add #{file}")
15+
end
16+
17+
repo_status = Actions.sh("git status --porcelain")
18+
repo_clean = repo_status.empty?
19+
if (!repo_clean) then
20+
Action.sh("git commit -m \"Update metadata strings\"")
21+
Action.sh("git push")
22+
end
23+
end
24+
25+
#####################################################
26+
# @!group Documentation
27+
#####################################################
28+
29+
def self.description
30+
"Updates the AppStoreStrings.po file with the data from text source files"
31+
end
32+
33+
def self.details
34+
"Updates the AppStoreStrings.po file with the data from text source files"
35+
end
36+
37+
def self.available_options
38+
# Define all options your action supports.
39+
40+
# Below a few examples
41+
[
42+
FastlaneCore::ConfigItem.new(key: :po_file_path,
43+
env_name: "FL_IOS_UPDATE_METADATA_SOURCE_PO_FILE_PATH",
44+
description: "The path of the .po file to update",
45+
is_string: true,
46+
verify_block: proc do |value|
47+
UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless (value and not value.empty?)
48+
UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
49+
end),
50+
FastlaneCore::ConfigItem.new(key: :release_version,
51+
env_name: "FL_IOS_UPDATE_METADATA_SOURCE_RELEASE_VERSION",
52+
description: "The release version of the app (to use to mark the release notes)",
53+
verify_block: proc do |value|
54+
UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless (value and not value.empty?)
55+
end),
56+
FastlaneCore::ConfigItem.new(key: :source_files,
57+
env_name: "FL_IOS_UPDATE_METADATA_SOURCE_SOURCE_FILES",
58+
description: "The hash with the path to the source files and the key to use to include their content",
59+
is_string: false,
60+
verify_block: proc do |value|
61+
UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless (value and not value.empty?)
62+
end)
63+
]
64+
end
65+
66+
def self.output
67+
68+
end
69+
70+
def self.return_value
71+
72+
end
73+
74+
def self.authors
75+
["loremattei"]
76+
end
77+
78+
def self.is_supported?(platform)
79+
platform == :ios
80+
end
81+
end
82+
end
83+
end

0 commit comments

Comments
 (0)