Sha256: df78868fa1e3cb6c3cf554de18d0f3b2dc8d5de882b66cad20b5549dbac1fe8d

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

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

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

      ##
      # Returns the name of the plugin. Identifies the plugin to lolcommits.
      #
      # @return [String] the plugin name
      #
      def self.name
        'tranzlate'
      end

      # 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.5 lib/lolcommits/plugin/tranzlate.rb
lolcommits-tranzlate-0.0.4 lib/lolcommits/plugin/tranzlate.rb