Sha256: 618c516313e759f16bffb8bef6af750b84411acdb5193593e22bc922d908319f

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

# -*- coding: utf-8; mode: ruby; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- vim:fenc=utf-8:filetype=ruby:et:sw=2:ts=2:sts=2

# parameters: revision1, revision 2, branch

require 'git_commit_notifier'

# Git commit notifier namespace
module GitCommitNotifier
  # binaries code
  class Executor
    # runs git commit notifier life
    # @param [Array(String)] args Command line arguments
    # @return [nil] Nothing
    def self.run!(args)
      case args.length
      when 0
        GitCommitNotifier::CommitHook.show_error("You have to add a path to the config file for git-commit-notifier")
        puts "Usage:  git-commit-notifier config-script [oldrev newrev [ref]]"
      when 1
        if $stdin.eof?
          GitCommitNotifier::CommitHook.show_error("No data given on standard input")
          return
        end
        
        # Note that there may be multiple lines on stdin, such
        # as in the case of multiple tags being pushed
        $stdin.each_line do |line|
          oldrev, newrev, ref = line.strip.split
          GitCommitNotifier::CommitHook.run args.first, oldrev, newrev, ref
        end

      when 2
        GitCommitNotifier::CommitHook.run args.first, args.last, args.last, ""
      when 3
        GitCommitNotifier::CommitHook.run args.first, args[1], args.last, ""
      else
        GitCommitNotifier::CommitHook.run args.first, args[1], args[2], args[3]
      end
      nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git-commit-notifier-0.11.2 lib/git_commit_notifier/executor.rb
git-commit-notifier-0.11.1 lib/git_commit_notifier/executor.rb