Sha256: 3ff95fc26690b888ff8e9a31f5d71f541b3ad184df80dba76060ef7f8330fcdd

Contents?: true

Size: 960 Bytes

Versions: 13

Compression:

Stored size: 960 Bytes

Contents

# TODO This file needs some love.
#
namespace :server do
  
  def chdir_to_root
    Dir.chdir PICKY_ROOT
  end
  
  def current_pid
    pid = `cat #{File.join(PICKY_ROOT, 'tmp/pids/unicorn.pid')}`
    pid.blank? ? nil : pid.chomp
  end
  
  # desc "Start the unicorns. (Wehee!)"
  task :start => :framework do
    chdir_to_root
    # Rake::Task[:"solr:start"].invoke # TODO Move to better place.
    daemonize = PICKY_ENVIRONMENT == 'production' ? '-D' : ''
    command = "export PICKY_ENV=#{PICKY_ENVIRONMENT}; unicorn -c unicorn.ru #{daemonize}".strip
    puts "Running \`#{command}\`."
    exec command
  end
  
  # desc "Stop the unicorns. (Blam!)"
  task :stop => :framework do
    `kill -QUIT #{current_pid}` if current_pid
    # Rake::Task[:"solr:stop"].invoke # TODO Move to better place.
  end
  
  # desc "Restart the unicorns."
  task :restart do
    Rake::Task[:"server:stop"].invoke
    sleep 5
    Rake::Task[:"server:start"].invoke
  end
  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
picky-1.0.0 lib/tasks/server.rake
picky-0.12.3 lib/tasks/server.rake
picky-0.12.2 lib/tasks/server.rake
picky-0.12.1 lib/tasks/server.rake
picky-0.12.0 lib/tasks/server.rake
picky-0.11.2 lib/tasks/server.rake
picky-0.11.1 lib/tasks/server.rake
picky-0.11.0 lib/tasks/server.rake
picky-0.10.5 lib/tasks/server.rake
picky-0.10.4 lib/tasks/server.rake
picky-0.10.2 lib/tasks/server.rake
picky-0.10.1 lib/tasks/server.rake
picky-0.10.0 lib/tasks/server.rake