class Fastlane::Actions::LogmeAction

Public Class Methods

author() click to toggle source
# File lib/fastlane/plugin/logme/actions/logme.rb, line 56
def self.author
  "mindera.com"
end
available_options() click to toggle source
# File lib/fastlane/plugin/logme/actions/logme.rb, line 32
def self.available_options
  [
      FastlaneCore::ConfigItem.new(key: :to_revision,
                                   description: 'End revision commit',
                                   optional: false),
      FastlaneCore::ConfigItem.new(key: :from_revision,
                                   description: 'End revision commit',
                                   optional: false),
      FastlaneCore::ConfigItem.new(key: :message_regexp_filters,
                                   description: "Regexp filters like. ie '^MDM-|^CTS:'",
                                   default_value: '.',
                                   optional: true),
      FastlaneCore::ConfigItem.new(key: :remove_commits_already_merged,
                                   description: 'Remove commit messages already merged',
                                   default_value: false,
                                   is_string: false,
                                   optional: true)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/logme/actions/logme.rb, line 28
def self.description
  "Collect git commit messages"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/logme/actions/logme.rb, line 52
def self.is_supported?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/logme/actions/logme.rb, line 24
def self.return_value
  # Returns the commit messages as a string
end
run(options) click to toggle source
# File lib/fastlane/plugin/logme/actions/logme.rb, line 5
def self.run(options)
  regexp_filter = Regexp.new(options[:message_regexp_filters])
  changes = Actions.sh("git log --pretty=\"%s\" --no-merges #{options[:from_revision]}...#{options[:to_revision]}")
                .split(/\n/)

  if options[:remove_commits_already_merged]
    merges = Actions.sh("git log --pretty=\"%b\" --merges #{options[:from_revision]}...#{options[:to_revision]}")
                 .split("* commit")

    merges.delete_at(0) # empty value
    merges.delete_at(0) # last merge
    merges = merges.join("\n")
    changes.delete_if{|commit| merges.include?(commit) }
  end

  changes.select{|message| message[regexp_filter] != nil}
      .join("\n\r")
end