Sha256: 4f721774ec314832bf96ea04e7824716e14b6d4f9dede6e1ec7e7563b1b89c3d

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

namespace :pumactl do

  ACTIONS = %w(
    halt restart phased-restart start stats
    reload-worker-directory status stop
  )

  task :validate do
    on release_roles(fetch(:pumactl_roles)) do
      puma_config_file = fetch(:pumactl_config_file)
      unless test "[ -f #{puma_config_file} ]"
        warn "puma: #{puma_config_file} is not found"
      end
    end
  end

  ACTIONS.each do |action|
    desc "Execute pumactl #{action}"
    task :"#{action}" do
      on release_roles(fetch(:pumactl_roles)) do
        within release_path do
          execute :pumactl, '--config-file', fetch(:pumactl_config_file), action
        end
      end
    end
  end
end

Capistrano::DSL.stages.each do |stage|
  after stage, :'pumactl:validate'
end

namespace :load do
  task :defaults do
    set :pumactl_config_file, -> { current_path.join('config/puma.rb') }
    # set :pumactl_pidfile,     -> { current_path.join('tmp/pids/puma.pid') }
    # set :pumactl_state_path,  -> { current_path.join('tmp/pids/puma.state') }
    set :pumactl_roles, fetch(:pumactl_roles, :app)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-pumactl-0.0.1 lib/capistrano/tasks/pumactl.rake