Class: Fastlane::Actions::EmojifyChangelogAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::EmojifyChangelogAction
- Defined in:
- lib/fastlane/plugin/changelog/actions/emojify_changelog.rb
Constant Summary collapse
- SUBSECTION_IDENTIFIERS =
['Added', 'Changed', 'Fixed', 'Removed', 'Work In Progress', 'Security', 'Deprecated']
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
87 88 89 |
# File 'lib/fastlane/plugin/changelog/actions/emojify_changelog.rb', line 87 def self. ["pajapro"] end |
.available_options ⇒ Object
77 78 79 |
# File 'lib/fastlane/plugin/changelog/actions/emojify_changelog.rb', line 77 def self. [] end |
.description ⇒ Object
69 70 71 |
# File 'lib/fastlane/plugin/changelog/actions/emojify_changelog.rb', line 69 def self.description "Emojifies the output of read_changelog action" end |
.details ⇒ Object
73 74 75 |
# File 'lib/fastlane/plugin/changelog/actions/emojify_changelog.rb', line 73 def self.details "This action uses the output of read_changelog action to append an emoji to known subsections" end |
.is_supported?(platform) ⇒ Boolean
91 92 93 |
# File 'lib/fastlane/plugin/changelog/actions/emojify_changelog.rb', line 91 def self.is_supported?(platform) true end |
.output ⇒ Object
81 82 83 84 85 |
# File 'lib/fastlane/plugin/changelog/actions/emojify_changelog.rb', line 81 def self.output [ ['EMOJIFY_CHANGELOG_CONTENT', 'Contains the emojified content of the last read_changelog action'], ] end |
.run(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 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/changelog/actions/emojify_changelog.rb', line 10 def self.run(params) UI. "Emojifying the output of read_changelog action" read_changelog_output = lane_context[SharedValues::READ_CHANGELOG_SECTION_CONTENT] changelog_path = lane_context[SharedValues::READ_CHANGELOG_CHANGELOG_PATH] line_separator = Helper::ChangelogHelper.get_line_separator(changelog_path) emojified_content = "" # Read through read changelog output string read_changelog_output.each_line do |line| # Remove leading or trailing whitespaces stripped = line.strip # Remove trailing colon (if any) if stripped.end_with?(':') stripped.chop! chopped_colon = true end if SUBSECTION_IDENTIFIERS.include?(stripped) emojified_string = case stripped when 'Added' then '*Added* 🎁' when 'Changed' then '*Changed* ↔️' when 'Fixed' then '*Fixed* ✅' when 'Removed' then '*Removed* 🚫' when 'Work In Progress' then '*Work In Progress* 🚧' when 'Security' then '*Security* 🔒' when 'Deprecated' then '*Deprecated* 💨' end # Add back trailing colon, if previously removed if chopped_colon emojified_string.concat(':') end # Add line break to the end of the string, in order to start next line on the next line emojified_string.concat(line_separator) # Output updated line emojified_content.concat(emojified_string) else # Output updated line # Replace '-' with '*' if line.start_with?('-') line[0] = '•' end emojified_content.concat(line) end end UI.success("Successfully emojified output of read_changelog action") Actions.lane_context[SharedValues::EMOJIFY_CHANGELOG_CONTENT] = emojified_content end |