Module: CapistranoDeployManagement::Memcached

Defined in:
lib/capistrano-deploy-management/memcached.rb

Class Method Summary collapse

Class Method Details

.load_into(configuration) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/capistrano-deploy-management/memcached.rb', line 3

def self.load_into(configuration)
  configuration.load do

    namespace :deploy do
      namespace :memcached do
        desc "Restart the Memcache daemon."
        task :restart, :roles => :app do
          deploy.memcached.stop
          deploy.memcached.start
        end

        desc "Start the Memcache daemon."
        task :start, :roles => :app do
          invoke_command "memcached -P #{current_path}/shared/log/memcached.pid -d", :via => run_method
        end

        desc "Stop the Memcache daemon."
        task :stop, :roles => :app do
          pid_file = "#{current_path}/shared/log/memcached.pid"
          invoke_command("killall -9 memcached", :via => run_method) if File.exist?(pid_file)
        end
      end
    end

  end
end