Sha256: fffe4ccd633007564bc793729d070b3006cb666a587c876cc5feb70fe5a83f04

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

namespace :commit_msg do
  desc "Check commit msg style"
  task :check_msg do |t|
    Githook::Util.log_task(t.name)

    commit_msg_file = Githook::Util.commit_msg_file
    commit_msg = Githook::Util.get_commit_msg(commit_msg_file)
    puts "commit-msg:"
    puts commit_msg.join("\n")
    # 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 if Githook::Util.expected_msg_format?(commit_msg)
    exit 1 unless Githook::Util.check_msg_format?(commit_msg)
  end
end

desc "Run all commit-msg hook tasks"
task :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/commit-msg.rake
git-hook-0.1.6 lib/githook/tasks/commit-msg.rake