Sha256: 13b3fd27c4337006b308ae36f0df2868635e891b84ceeef86efcef1ed7c96bbf

Contents?: true

Size: 679 Bytes

Versions: 3

Compression:

Stored size: 679 Bytes

Contents

# encoding: utf-8

class Hooks < Thor
  # TODO: force option
  desc "all", "Install all git hooks"
  def all
    if Dir.exist?(".git/hooks")
      abort "You must remove .git/hooks first"
    else
      # do not symlink them, otherwise git will add samples
      # FIXME: permissions
      FileUtils.cp_r("support/hooks", ".git/hooks")
    end
  end

  desc "install [*hooks]", "Install given git hook"
  def install(*names)
    names.each do |name|
      if File.file?(".git/hooks/#{name}")
        abort "File .git/hooks/#{name} already exists. Please remove it first."
      else
        FileUtils.cp("support/hooks/#{name}", ".git/hooks/#{name}")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rango-0.0.6 tasks/hooks.thor
rango-0.1.pre tasks/hooks.thor
rango-0.0.4 tasks/hooks.thor