4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/dean/git_helper.rb', line 4
def commit_asking_user(prompt, new_version, envs_paths)
def ask_user(message)
puts message.chomp + " (y/n)"
user_input = $stdin.gets.chomp!
user_input == 'y'
end
if ask_user prompt
system "git reset HEAD . 1> /dev/null"
envs_paths.each do |path|
system "git add #{path}"
end
message = "Bumped version to #{new_version}"
system "git commit -m 'Bumped version to #{new_version}' 1> /dev/null"
if ask_user "Do you want to tag this commit with version #{new_version}? (Editor will open to insert message)"
system "git tag -a #{new_version}"
end
puts "Done"
else
puts "Changes not committed"
end
end
|