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



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

def self.authors
  ['Automattic']
end

.available_optionsObject



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

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



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

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

.detailsObject



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

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


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

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
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/android/android_create_xml_release_notes.rb', line 4

def self.run(params)
  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