class Dolphin::Lock
Use lock to avoid simultaneous deployments
Public Instance Methods
check()
click to toggle source
# File lib/dolphin/lock.rb, line 5 def check command = "if [ -e #{@lock_file} ]; then cat #{@lock_file}; fi" output = capture(command, @lead_server) if output.empty? puts "OK to proceed" else puts "[output]: #{output}" abort "\e[0;31m A deployment is already in progress\n Please wait for its completion\nOr in case of stale lock, remove #{@lock_file} to unlock \e[0m\n" end end
create()
click to toggle source
# File lib/dolphin/lock.rb, line 17 def create command = "echo '#{@lock_message}' > #{@lock_file}" puts capture(command, @lead_server) end
release()
click to toggle source
# File lib/dolphin/lock.rb, line 23 def release command = "rm -f #{@lock_file}" puts capture(command, @lead_server) end