Sha256: 50408da9f7c545d074942d27ddfad580534fa1d9aad35f1a48c12f6186050ec4
Contents?: true
Size: 984 Bytes
Versions: 1
Compression:
Stored size: 984 Bytes
Contents
def cmd(service_name, action, sudo = false) sudo_cmd = sudo ? 'sudo ' : '' "#{sudo_cmd} service #{service_name} #{action}" end namespace :upstart do desc "Start the application services" task :start do on roles(:app) do execute cmd(fetch(:upstart_service), 'start', fetch(:upstart_sudo)) end end desc "Stop the application services" task :stop do on roles(:app) do execute cmd(fetch(:upstart_service), 'stop', fetch(:upstart_sudo)) end end desc "Restart the application services" task :restart do on roles(:app) do cmd_sq = cmd(fetch(:upstart_service), 'start', fetch(:upstart_sudo)) cmd_sq += ' || ' cmd_sq += cmd(fetch(:upstart_service), 'restart', fetch(:upstart_sudo)) execute cmd_sq end end end namespace :load do task :defaults do set :upstart_service, -> { fetch(:application) } set :upstart_sudo, false end end namespace :deploy do after :publishing, 'upstart:restart' end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mascherano-1.0.0 | lib/mascherano/tasks/upstart.cap |