module Shuttle::Helpers
Constants
- LEVEL_COLORS
Public Instance Methods
deployer_hostname()
click to toggle source
# File lib/shuttle/helpers.rb, line 52 def deployer_hostname `hostname`.strip end
error(message)
click to toggle source
# File lib/shuttle/helpers.rb, line 14 def error(message) log("ERROR: #{message}", "error") log("Release v#{version} aborted", "error") raise DeployError, message end
git_installed?()
click to toggle source
# File lib/shuttle/helpers.rb, line 25 def git_installed? ssh.run("which git").success? end
git_remote()
click to toggle source
# File lib/shuttle/helpers.rb, line 42 def git_remote result = ssh.run("cd #{scm_path} && git remote -v") if result.success? result.output.scan(/^origin\t(.+)\s\(fetch\)/).flatten.first else nil end end
log(message, level='info')
click to toggle source
# File lib/shuttle/helpers.rb, line 9 def log(message, level='info') prefix = "----->".send(LEVEL_COLORS[level]) STDOUT.puts("#{prefix} #{message}") end
release_exists?()
click to toggle source
# File lib/shuttle/helpers.rb, line 33 def release_exists? ssh.directory_exists?(release_path) end
stream_output(buff)
click to toggle source
# File lib/shuttle/helpers.rb, line 37 def stream_output(buff) str = buff.split("\n").map { |str| " #{str}"}.join("\n") STDOUT.puts(str) end
svn_installed?()
click to toggle source
# File lib/shuttle/helpers.rb, line 29 def svn_installed? ssh.run("which svn").success? end
warn(message)
click to toggle source
# File lib/shuttle/helpers.rb, line 21 def warn(message) log("WARNING: #{message}", "warning") end