Sha256: 01679d49cd6be7e1b27866f8aaa7ae3cd4ef5e1d5acdc4c041a61e5c314724f2

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

namespace :prepare_commit_msg do
  desc "Prepare commit msg"
  task :prepare do |t|
    Githook::Util.log_task(t.name)

    commit_msg_file = Githook::Util.commit_msg_file
    # can't use return in block
    # can't "exit 0" in advance, else will abort later tasks
    # but we can "exit 1" in advance
    # exit 0 unless Githook::Util.commit_msg_empty?(commit_msg_file)

    commit_msg = Githook::Util.get_commit_msg(commit_msg_file)
    if Githook::Util.commit_msg_empty?(commit_msg)
      branch_name = Githook::Util.branch_name
      pre_msg = Githook::Util.gen_pre_msg(branch_name)
      puts "pre-msg:"
      puts pre_msg
      Githook::Util.prefill_msg(commit_msg_file, pre_msg)
    end
  end
end

desc "Run all prepare-commit-msg hook tasks"
task :prepare_commit_msg do |t|
  Githook::Util.log_task(t.name)
  Githook::Util.run_tasks(t.name.to_sym)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
git-hook-0.1.7 lib/githook/tasks/prepare-commit-msg.rake
git-hook-0.1.6 lib/githook/tasks/prepare-commit-msg.rake