Class: Danger::AndroidReleaseChecker

Inherits:
Plugin
  • Object
show all
Defined in:
lib/dangermattic/plugins/android_release_checker.rb

Overview

Plugin for performing Android release-related checks in a pull request.

Examples:

Checking Android release notes and Play Store strings:

android_release_checker.check_release_notes_and_play_store_strings

Checking for changes in internal release notes:

android_release_checker.check_internal_release_notes_changed

See Also:

  • Automattic/dangermattic

Constant Summary collapse

STRINGS_FILE =
'strings.xml'
MESSAGE_STRINGS_FILE_UPDATED =
"`#{STRINGS_FILE}` files should only be updated on release branches, when the translations are downloaded by our automation.".freeze

Instance Method Summary collapse

Instance Method Details

#check_internal_release_notes_changed(report_type: :warning) ⇒ void

This method returns an undefined value.

Check if there are changes to the internal release notes file RELEASE-NOTES.txt and report a message if that's the case.

Parameters:

  • report_type (Symbol) (defaults to: :warning)

    (optional) The type of report for the message. Types: :error, :warning (default), :message.



46
47
48
# File 'lib/dangermattic/plugins/android_release_checker.rb', line 46

def check_internal_release_notes_changed(report_type: :warning)
  common_release_checker.check_internal_release_notes_changed(report_type: report_type)
end

#check_modified_strings_on_release(report_type: :warning) ⇒ void

This method returns an undefined value.

Checks if any strings file (values*/strings.xml) has been modified on a release branch, otherwise reporting a warning / error.



32
33
34
35
36
37
38
39
# File 'lib/dangermattic/plugins/android_release_checker.rb', line 32

def check_modified_strings_on_release(report_type: :warning)
  common_release_checker.check_file_changed(
    file_comparison: ->(path) { File.basename(path) == STRINGS_FILE },
    message: MESSAGE_STRINGS_FILE_UPDATED,
    on_release_branch: false,
    report_type: report_type
  )
end

#check_release_notes_and_play_store_stringsvoid

This method returns an undefined value.

Checks if changes made to the release notes are also followed by changes in the Play Store strings file.



22
23
24
25
26
27
# File 'lib/dangermattic/plugins/android_release_checker.rb', line 22

def check_release_notes_and_play_store_strings
  common_release_checker.check_release_notes_and_store_strings(
    release_notes_file: 'metadata/release_notes.txt',
    po_file: 'metadata/PlayStoreStrings.po'
  )
end