Class: Fastlane::Actions::IosUpdateMetadataSourceAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



71
72
73
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb', line 71

def self.authors
  ['Automattic']
end

.available_optionsObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb', line 36

def self.available_options
  # Define all options your action supports.

  # Below a few examples
  [
    FastlaneCore::ConfigItem.new(key: :po_file_path,
                                 env_name: 'FL_IOS_UPDATE_METADATA_SOURCE_PO_FILE_PATH',
                                 description: 'The path of the .po file to update',
                                 type: String,
                                 verify_block: proc do |value|
                                                 UI.user_error!("No .po file path for UpdateMetadataSourceAction given, pass using `po_file_path: 'file path'`") unless value && !value.empty?
                                                 UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
                                               end),
    FastlaneCore::ConfigItem.new(key: :release_version,
                                 env_name: 'FL_IOS_UPDATE_METADATA_SOURCE_RELEASE_VERSION',
                                 description: 'The release version of the app (to use to mark the release notes)',
                                 verify_block: proc do |value|
                                                 UI.user_error!("No relase version for UpdateMetadataSourceAction given, pass using `release_version: 'version'`") unless value && !value.empty?
                                               end),
    FastlaneCore::ConfigItem.new(key: :source_files,
                                 env_name: 'FL_IOS_UPDATE_METADATA_SOURCE_SOURCE_FILES',
                                 description: 'The hash with the path to the source files and the key to use to include their content',
                                 type: Hash,
                                 verify_block: proc do |value|
                                                 UI.user_error!("No source file hash for UpdateMetadataSourceAction given, pass using `source_files: 'source file hash'`") unless value && !value.empty?
                                               end),
  ]
end

.descriptionObject



28
29
30
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb', line 28

def self.description
  'Updates the AppStoreStrings.po file with the data from text source files'
end

.detailsObject



32
33
34
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb', line 32

def self.details
  'Updates the AppStoreStrings.po file with the data from text source files'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb', line 75

def self.is_supported?(platform)
  %i[ios mac].include?(platform)
end

.outputObject



65
66
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb', line 65

def self.output
end

.return_valueObject



68
69
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb', line 68

def self.return_value
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/ios/ios_update_metadata_source.rb', line 4

def self.run(params)
  # Check local repo status
  other_action.ensure_git_status_clean

  other_action.(po_file_path: params[:po_file_path],
                                         source_files: params[:source_files],
                                         release_version: params[:release_version])

  Action.sh("git add #{params[:po_file_path]}")
  params[:source_files].each_value do |file|
    Action.sh("git add #{file}")
  end

  repo_status = Actions.sh('git status --porcelain')
  repo_clean = repo_status.empty?
  return if repo_clean

  Action.sh('git commit -m "Update metadata strings"')
end