Sha256: 23bbb058ab5daf0c5ccd9e0c4766076cc25067090dbb8e1712467beddeea3caa
Contents?: true
Size: 838 Bytes
Versions: 14
Compression:
Stored size: 838 Bytes
Contents
# Server tasks, like starting/stopping/restarting. # namespace :server do # 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 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 end
Version data entries
14 entries across 14 versions & 1 rubygems