Sha256: 49f5508561cff3b80bc3e17c49083f2f650d329ddba844019ad9998940593797

Contents?: true

Size: 825 Bytes

Versions: 31

Compression:

Stored size: 825 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
    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
  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

31 entries across 31 versions & 1 rubygems

Version Path
picky-2.0.0 lib/tasks/server.rake
picky-2.0.0.pre3 lib/tasks/server.rake
picky-2.0.0.pre2 lib/tasks/server.rake
picky-2.0.0.pre1 lib/tasks/server.rake
picky-1.5.4 lib/tasks/server.rake
picky-1.5.3 lib/tasks/server.rake
picky-1.5.2 lib/tasks/server.rake
picky-1.5.1 lib/tasks/server.rake
picky-1.5.0 lib/tasks/server.rake
picky-1.4.3 lib/tasks/server.rake
picky-1.4.2 lib/tasks/server.rake
picky-1.4.1 lib/tasks/server.rake
picky-1.4.0 lib/tasks/server.rake
picky-1.3.4 lib/tasks/server.rake
picky-1.3.3 lib/tasks/server.rake
picky-1.3.2 lib/tasks/server.rake
picky-1.3.1 lib/tasks/server.rake
picky-1.3.0 lib/tasks/server.rake
picky-1.2.4 lib/tasks/server.rake
picky-1.2.3 lib/tasks/server.rake