Module: Git::Story::Setup
Constant Summary collapse
- MARKER =
'Installed by the git-story gem'- PREPARE_COMMIT_MESSAGE_SRC =
File.join(File.dirname(__FILE__), 'prepare-commit-msg')
- PREPARE_COMMIT_MESSAGE_DST =
'.git/hooks/prepare-commit-msg'
Class Method Summary collapse
Methods included from Utils
Class Method Details
.install_prepare_commit_msg ⇒ Object
37 38 39 |
# File 'lib/git/story/setup.rb', line 37 def install_prepare_commit_msg cp PREPARE_COMMIT_MESSAGE_SRC, PREPARE_COMMIT_MESSAGE_DST end |
.perform(force: false) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/git/story/setup.rb', line 14 def perform(force: false) pcm = '.git/hooks/prepare-commit-msg' if File.exist?(pcm) if force install_prepare_commit_msg elsif File.read(pcm).match?(MARKER) ; else ask( prompt: "File #{pcm.inspect} not created by git-story."\ " Overwrite? (y/n, default is %s)", default: ?n, ) do |response| if response == ?y install_prepare_commit_msg end end end else install_prepare_commit_msg end end |