Sha256: cb9033fc51a22d5a75eb16b5d2fbd98508ba60abf66030341e3dbb6f63fcf64e

Contents?: true

Size: 833 Bytes

Versions: 4

Compression:

Stored size: 833 Bytes

Contents

module Capistrano
  class Puma::Monit < Capistrano::Plugin
    include PumaCommon
    def register_hooks
      before 'deploy:updating', 'puma:monit:unmonitor'
      after 'deploy:published', 'puma:monit:monitor'
    end

    def define_tasks
      eval_rakefile File.expand_path('../../tasks/monit.rake', __FILE__)
    end

    def set_defaults
      set_if_empty :puma_monit_conf_dir, -> { "/etc/monit/conf.d/#{puma_monit_service_name}.conf" }
      set_if_empty :puma_monit_use_sudo, true
      set_if_empty :puma_monit_bin, '/usr/bin/monit'
    end

    def puma_monit_service_name
      fetch(:puma_monit_service_name, "puma_#{fetch(:application)}_#{fetch(:stage)}")
    end

    def sudo_if_needed(command)
      if fetch(:puma_monit_use_sudo)
        sudo command
      else
        execute command
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
capistrano3-puma-3.1.0 lib/capistrano/puma/monit.rb
capistrano3-puma-3.0.3 lib/capistrano/puma/monit.rb
capistrano3-puma-3.0.2 lib/capistrano/puma/monit.rb
capistrano3-puma-3.0.1 lib/capistrano/puma/monit.rb