Sha256: 0a64f37efb04bf8a0cf74de1d0a67a7d0385d1559c4c984dcd2bcdbbc0899981

Contents?: true

Size: 1.64 KB

Versions: 5

Compression:

Stored size: 1.64 KB

Contents

namespace :load do
  task :defaults do
    set :maily_herald_default_hooks, -> { true }

    set :maily_herald_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
    set :maily_herald_role, -> { :app }

    set :rbenv_map_bins, fetch(:rbenv_map_bins).to_a.concat(%w(maily_herald))
    set :rvm_map_bins, fetch(:rvm_map_bins).to_a.concat(%w(maily_herald))
  end
end

namespace :deploy do
  before :starting, :check_maily_herald_hooks do
    invoke 'maily_herald:add_default_hooks' if fetch(:maily_herald_default_hooks)
  end
  after :publishing, :restart_maily_herald do
    invoke 'maily_herald:restart' if fetch(:maily_herald_default_hooks)
  end
end

namespace :maily_herald do
  def stop_maily_herald
    execute :bundle, :exec, :maily_herald, "paperboy", "--stop"
  end

  def start_maily_herald
    execute :bundle, :exec, :maily_herald, "paperboy", "--start"
  end

  def restart_maily_herald
    execute :bundle, :exec, :maily_herald, "paperboy", "--restart"
  end

  task :add_default_hooks do
    after 'deploy:updated', 'maily_herald:stop'
    after 'deploy:reverted', 'maily_herald:stop'
    after 'deploy:published', 'maily_herald:start'
  end

  desc 'Stop maily_herald'
  task :stop do
    on roles fetch(:maily_herald_role) do
      within release_path do
        stop_maily_herald
      end
    end
  end

  desc 'Start maily_herald'
  task :start do
    on roles fetch(:maily_herald_role) do
      within release_path do
        start_maily_herald
      end
    end
  end

  desc 'Restart maily_herald'
  task :restart do
    on roles fetch(:maily_herald_role) do
      within release_path do
        restart_maily_herald
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
maily_herald-0.9.4 lib/maily_herald/capistrano/tasks.cap
maily_herald-0.9.3 lib/maily_herald/capistrano/tasks.cap
maily_herald-0.9.2 lib/maily_herald/capistrano/tasks.cap
maily_herald-0.9.1 lib/maily_herald/capistrano/tasks.cap
maily_herald-0.8.0 lib/maily_herald/capistrano/tasks.cap