Sha256: d3520d7e2a13083ce4fdb05c7b4e1d02482d64c1ebd5a33c30540ef54ef37680

Contents?: true

Size: 1.07 KB

Versions: 4

Compression:

Stored size: 1.07 KB

Contents

#!/usr/bin/env ruby

require_relative '../templates/pre_push.rb'
require_relative '../templates/pipelines.rb'
require_relative '../lib/gocd_pre_push/linker.rb'
require_relative '../lib/gocd_pre_push/pretty_printer.rb'

include GOCD_PRE_PUSH::PrettyPrinter

def execute
  linker = GOCD_PRE_PUSH::Linker.new

  if ARGV[0] == 'create'
    print_info "Creating pre-push hook.."
    `mkdir hooks`
    File.write('hooks/pre-push', pre_push_hook)
    print_info "Done!\n"
    print_info "Adding executable permission to pre-push hook.."
    `chmod 777 hooks/pre-push`
    print_success "Please update the pre-push hook with your gocd server url, username and password\n"
    linker.symlink_git_hooks

    print_success "Adding pipelines.yml, change the pipelines as per your requirement!\n"
    File.write('gocd_pre_push.yml', pipelines)
  elsif ARGV[0] == 'use_hooks'
    linker.symlink_git_hooks
  else
    print_info "Right usage is:"
    print_info "gocd_pre_push create     => For first time setup"
    print_info "gocd_pre_push use_hooks  => To use the already created hooks\n"
  end
end

execute

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gocd_pre_push-2.1 bin/gocd_pre_push
gocd_pre_push-2.0.3 bin/gocd_pre_push
gocd_pre_push-2.0.2 bin/gocd_pre_push
gocd_pre_push-2.0 bin/gocd_pre_push