Class: Overcommit::Hook::PrepareCommitMsg::Base
- Extended by:
- Forwardable
- Defined in:
- lib/overcommit/hook/prepare_commit_msg/base.rb
Overview
Functionality common to all prepare-commit-msg hooks.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#applicable_files, #command, #description, #enabled?, #excluded?, #execute, #execute_in_background, #flags, #in_path?, #included_files, #initialize, #name, #parallelize?, #processors, #quiet?, #required?, #required_executable, #required_libraries, #run, #run?, #run_and_transform, #skip?
Constructor Details
This class inherits a constructor from Overcommit::Hook::Base
Instance Method Details
#modify_commit_message ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/overcommit/hook/prepare_commit_msg/base.rb', line 13 def raise 'This expects a block!' unless block_given? # NOTE: this assumes all the hooks of the same type share the context's # memory. If that's not the case, this won't work. lock.synchronize do contents = File.read() File.open(, 'w') do |f| f << (yield contents) end end end |