Class: TrackerGitHook::PrepareCommitMsg

Inherits:
Object
  • Object
show all
Defined in:
lib/tracker_git_hook/prepare_commit_msg.rb

Instance Method Summary collapse

Instance Method Details

#prepare(message_file_path:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/tracker_git_hook/prepare_commit_msg.rb', line 6

def prepare(message_file_path:)
  return unless story_id

  original_message = File.read(message_file_path)

  message = MessageGenerator.new.generate(
    original_message: original_message,
    story_id: story_id
  )

  File.open(message_file_path, 'w') do |f|
    f.write(message)
  end
end