Sha256: 03f3d2fdde896ea6f2b8bc01864c4ace4124c99d01ca516667f07eabdfe7fb79

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

require 'lolcommits/plugin/base'
require 'lolcommits/tranzlate/lolspeak'

module Lolcommits
  module Plugin
    class Tranzlate < Base
      extend Lolcommits::Tranzlate::Lolspeak

      # Returns position(s) of when this plugin should run during the capture
      # process.
      #
      # We want to change the commit message text before the capture happens.
      #
      # @return [Array] the position(s) (:pre_capture)
      #
      def self.runner_order
        [:pre_capture]
      end

      ##
      #
      # Pre-capture hook, runs after lolcommits captures a snapshot.
      #
      # Translate the commmit message with lolspeak
      #
      def run_pre_capture
        debug "Commit message before: #{runner.message}"
        runner.message = self.class.tranzlate(runner.message)
        debug "Commit message after: #{runner.message}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lolcommits-tranzlate-0.0.7 lib/lolcommits/plugin/tranzlate.rb
lolcommits-tranzlate-0.0.6 lib/lolcommits/plugin/tranzlate.rb