Sha256: 77d727c72292b9ae7a79c40a56f52ab2a041ed8224106b7fdb48be04a27bc970

Contents?: true

Size: 706 Bytes

Versions: 3

Compression:

Stored size: 706 Bytes

Contents

require_relative 'pretty_printer'

module GOCD_PRE_PUSH
  class Linker
    include GOCD_PRE_PUSH::PrettyPrinter

    def 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

3 entries across 3 versions & 1 rubygems

Version Path
gocd_pre_push-2.1 lib/gocd_pre_push/linker.rb
gocd_pre_push-2.0.2 lib/gocd_pre_push/linker.rb
gocd_pre_push-2.0 lib/gocd_pre_push/linker.rb