Class: Fastlane::Actions::AndroidCreateXmlReleaseNotesAction

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

Documentation collapse

Class Method Summary collapse

Class Method Details

.authorsObject



54
55
56
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb', line 54

def self.authors
  ['Automattic']
end

.available_optionsObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb', line 35

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :download_path,
                                 env_name: 'ANDROID_XML_NOTES_DOWNLOAD_PATH',
                                 description: 'The path to the folder with the release notes',
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :build_number,
                                 env_name: 'ANDROID_XML_NOTES_BUILD_NUMBER',
                                 description: 'The build number of the release notes',
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :locales,
                                 env_name: 'FL_DOWNLOAD_METADATA_LOCALES',
                                 description: 'The hash with the GLotPress locale and the project locale association',
                                 type: Hash),
  ]
end

.descriptionObject



27
28
29
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb', line 27

def self.description
  'Downloads translated metadata from the translation system'
end

.detailsObject



31
32
33
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb', line 31

def self.details
  'Downloads translated metadata from the translation system'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb', line 58

def self.is_supported?(platform)
  platform == :android
end

.run(params) ⇒ Object



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

def self.run(params)
  require_relative '../../helper/android/android_git_helper'

  release_notes_path = "#{params[:download_path]}/release_notes.xml"
  open(release_notes_path, 'w') do |f|
    params[:locales].each do |loc|
      puts "Looking for language: #{loc[1]}"
      complete_path = "#{params[:download_path]}/#{loc[1]}/changelogs/#{params[:build_number]}.txt"
      if File.exist?(complete_path)
        f.puts("<#{loc[1]}>")
        f.puts(File.read(complete_path))
        f.puts("</#{loc[1]}>\n")
      else
        UI.message("File #{complete_path} not found. Skipping language #{loc[1]}")
      end
    end
  end
end