class Object

Public Instance Methods

_monit_args() click to toggle source
# File lib/capistrano-offroad/modules/monit.rb, line 7
def _monit_args()
  if fetch :monit_group, nil then
    return " -g #{monit_group} "
  else
    return ""
  end
end
_target(var) click to toggle source
# File lib/capistrano-offroad/modules/supervisord.rb, line 43
def _target(var)
  group_name = ENV['GROUP']
  group_name ||= fetch var
  prog_name = ENV['PROGRAM']
  prog_name ||= 'all'

  if ['', nil].include? group_name then
    prog_name
  else
    "'#{group_name}:*'"
  end
end
django_manage(cmd, options={}) click to toggle source
# File lib/capistrano-offroad/modules/django.rb, line 15
def django_manage(cmd, options={})
  path = options.delete(:path) || "#{latest_release}"
  run "cd #{path}/#{django_project_subdirectory}; #{python} manage.py #{cmd}", options
end
offroad_modules(*modules) click to toggle source

just for consistency

# File lib/capistrano-offroad.rb, line 6
def offroad_modules(*modules)
  modules.each { |mod| require "capistrano-offroad/modules/#{mod}" }
end
supervisorctl(cmd, options={}) click to toggle source

Run supervisorctl command `cmd'. If options is true (default) and supervisord is not running, start it. If just started supervisord, and options is false (default), skip running supervisorctl

# File lib/capistrano-offroad/modules/supervisord.rb, line 19
    def supervisorctl(cmd, options={})
      try_start = options.delete(:try_start) {|k| true}

      full_command = "#{supervisord_path}#{supervisorctl_command} -c #{current_path}/#{supervisord_conf} #{cmd}"
      after_start = (full_command if options.delete(:run_when_started)) || ""

      if not try_start then
        run full_command, options
      else
        run <<-EOF, options
        if test -f #{shared_path}/#{supervisord_pidfile}
             && ps #{supervisord_pid} > /dev/null ;
        then
          echo "supervisord seems to be up, good" ;
          #{full_command} ;
        else
          echo "starting supervisord" ;
          #{sudo :as => deploy_user} #{supervisord_path}#{supervisord_command} -c #{current_path}/#{supervisord_conf} ;
          #{after_start}
        fi
    EOF
      end
    end
supervisord_pid() click to toggle source
# File lib/capistrano-offroad/modules/supervisord.rb, line 14
def supervisord_pid ; "`cat #{supervisord_pidfile_path}`" end
supervisord_pidfile_path() click to toggle source
# File lib/capistrano-offroad/modules/supervisord.rb, line 13
def supervisord_pidfile_path ; "#{shared_path}/#{supervisord_pidfile}" end
svc(cmd) click to toggle source
# File lib/capistrano-offroad/modules/daemontools.rb, line 8
def svc(cmd)
  sudo "svc #{cmd} #{svscan_root}/#{supervise_name}"
end