Sha256: 7300458425a91fd069612b9f6eca388d7ba4d9954e8de88d71f725e083b5d7f8

Contents?: true

Size: 754 Bytes

Versions: 1

Compression:

Stored size: 754 Bytes

Contents

require_relative 'pretty_printer'

module GOCD_PRE_PUSH
  class Linker
    include GOCD_PRE_PUSH::PrettyPrinter

    def symlink_git_hooks
      print_info "Running symlink_git_hooks..."
      return unless File.exists?('./hooks')

      print_info "Creating symlink ./.git/hooks => hooks"
      print_info "Your old hooks will be saved inside ./.git/hooks.old\n"

      `if [[ ! -L "./.git/hooks" && -d "./.git/hooks" ]]
      then
        echo -e  "\nHooks folder exists moving content into ./.git/hooks.old"
        mv "./.git/hooks" "./.git/hooks.old"
      fi`
      `if [[ ! -L "./.git/hooks" && -d "./hooks" ]]
      then
        echo -e "\nCreating symlink ./.git/hooks => hooks"
        ln -s "../hooks/" ".git/hooks"
      fi`
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gocd_pre_push-2.0.3 lib/gocd_pre_push/linker.rb