Class: Danger::IosReleaseChecker
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::IosReleaseChecker
- Defined in:
- lib/dangermattic/plugins/ios_release_checker.rb
Overview
Plugin for performing iOS / macOS release-related checks in a pull request.
Constant Summary collapse
- LOCALIZABLE_STRINGS_FILE =
'Localizable.strings'- BASE_STRINGS_FILE =
"en.lproj/#{LOCALIZABLE_STRINGS_FILE}".freeze
- MESSAGE_STRINGS_FILE_UPDATED =
"The `#{LOCALIZABLE_STRINGS_FILE}` files should only be updated on release branches, when the translations are downloaded by our automation.".freeze
- MESSAGE_BASE_STRINGS_FILE_UPDATED =
"The `#{BASE_STRINGS_FILE}` file should only be updated before creating a release branch.".freeze
- MESSAGE_TRANSLATION_FILE_UPDATED =
"Translation files `*.lproj/#{LOCALIZABLE_STRINGS_FILE}` should only be updated on a release branch.".freeze
- MESSAGE_CORE_DATA_UPDATED =
'Do not edit an existing Core Data model in a release branch unless it hasn\'t been released to testers yet. ' \ 'Instead create a new model version and merge back to develop soon.'
Instance Method Summary collapse
-
#check_core_data_model_changed(report_type: :warning) ⇒ void
Checks if an existing Core Data model has been edited in a release branch.
-
#check_modified_en_strings_on_regular_branch(report_type: :warning) ⇒ void
Checks if the en.lproj/Localizable.strings file has been modified on a regular branch, otherwise reporting a warning.
-
#check_modified_localizable_strings_on_release(report_type: :warning) ⇒ void
Checks if any Localizable.strings file has been modified on a release branch, otherwise reporting a warning.
-
#check_modified_translations_on_release_branch(report_type: :warning) ⇒ void
Checks if a translation file (*.lproj/Localizable.strings) has been modified on a release branch, otherwise reporting a warning.
-
#check_release_notes_and_app_store_strings ⇒ void
Checks if changes made to the release notes are also followed by changes in the App Store strings file.
Instance Method Details
#check_core_data_model_changed(report_type: :warning) ⇒ void
This method returns an undefined value.
Checks if an existing Core Data model has been edited in a release branch.
33 34 35 36 37 38 39 40 |
# File 'lib/dangermattic/plugins/ios_release_checker.rb', line 33 def check_core_data_model_changed(report_type: :warning) common_release_checker.check_file_changed( file_comparison: ->(path) { File.extname(path) == '.xcdatamodeld' }, message: MESSAGE_CORE_DATA_UPDATED, on_release_branch: true, report_type: report_type ) end |
#check_modified_en_strings_on_regular_branch(report_type: :warning) ⇒ void
This method returns an undefined value.
Checks if the en.lproj/Localizable.strings file has been modified on a regular branch, otherwise reporting a warning.
61 62 63 64 65 66 67 68 |
# File 'lib/dangermattic/plugins/ios_release_checker.rb', line 61 def check_modified_en_strings_on_regular_branch(report_type: :warning) common_release_checker.check_file_changed( file_comparison: ->(path) { base_strings_file?(path: path) }, message: MESSAGE_BASE_STRINGS_FILE_UPDATED, on_release_branch: true, report_type: report_type ) end |
#check_modified_localizable_strings_on_release(report_type: :warning) ⇒ void
This method returns an undefined value.
Checks if any Localizable.strings file has been modified on a release branch, otherwise reporting a warning.
47 48 49 50 51 52 53 54 |
# File 'lib/dangermattic/plugins/ios_release_checker.rb', line 47 def check_modified_localizable_strings_on_release(report_type: :warning) common_release_checker.check_file_changed( file_comparison: ->(path) { File.basename(path) == LOCALIZABLE_STRINGS_FILE }, message: MESSAGE_STRINGS_FILE_UPDATED, on_release_branch: false, report_type: report_type ) end |
#check_modified_translations_on_release_branch(report_type: :warning) ⇒ void
This method returns an undefined value.
Checks if a translation file (*.lproj/Localizable.strings) has been modified on a release branch, otherwise reporting a warning.
75 76 77 78 79 80 81 82 |
# File 'lib/dangermattic/plugins/ios_release_checker.rb', line 75 def check_modified_translations_on_release_branch(report_type: :warning) common_release_checker.check_file_changed( file_comparison: ->(path) { !base_strings_file?(path: path) && File.basename(path) == LOCALIZABLE_STRINGS_FILE }, message: MESSAGE_TRANSLATION_FILE_UPDATED, on_release_branch: false, report_type: report_type ) end |
#check_release_notes_and_app_store_strings ⇒ void
This method returns an undefined value.
Checks if changes made to the release notes are also followed by changes in the App Store strings file.
87 88 89 90 91 92 |
# File 'lib/dangermattic/plugins/ios_release_checker.rb', line 87 def check_release_notes_and_app_store_strings common_release_checker.check_release_notes_and_store_strings( release_notes_file: 'Resources/release_notes.txt', po_file: 'Resources/AppStoreStrings.po' ) end |