Sha256: 576b9f120e0fc8ef569af6559691a82d1070696757cc866e62ab25e97ab40616
Contents?: true
Size: 735 Bytes
Versions: 2
Compression:
Stored size: 735 Bytes
Contents
desc 'Init githook, prepare template files' task :install do # step 1, check whether Dir.pwd is in git repo root folder git_path = ".git" unless Dir.exists?(git_path) puts "It isn't in a git repo root folder." exit 1 end # step 2, check whether '.githook' folder already exists githook_path = ".githook" if Dir.exists?(githook_path) print ".githook already exists, do you want to override it? [y/(n)]: " choice = STDIN.gets exit 0 if ["n", "N", "\n"].include?(choice[0]) FileUtils.rm_r(githook_path) end # setup 3, copy templates to .githook templates_path = File.expand_path("../../templates", __FILE__) FileUtils.cp_r(templates_path, githook_path) puts "Create .githook folder." end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git-hook-0.1.3 | lib/githook/tasks/install.rake |
git-hook-0.1.2 | lib/githook/tasks/install.rake |