Sha256: b67848cb7b354dda6025aec4ef104351ae301fffc15de7b490c828545d30e2fd
Contents?: true
Size: 1.09 KB
Versions: 55
Compression:
Stored size: 1.09 KB
Contents
# Server tasks, like starting/stopping/restarting. # desc "Start the server." task :start do Rake::Task[:'server:start'].invoke end desc "Stop the server." task :stop do Rake::Task[:'server:stop'].invoke end namespace :server do # desc "Start the unicorns. (Wehee!)" # task :start => :framework do chdir_to_root daemonize = PICKY_ENVIRONMENT == 'production' ? '-D' : '' ENV['PICKY_ENV'] = PICKY_ENVIRONMENT command = "unicorn -c unicorn.rb #{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 pidfile = 'tmp/pids/unicorn.pid' pid = `cat #{File.join(Picky.root, pidfile)}` if pid.blank? puts puts "No server running (no #{pidfile} found)." puts else pid.chomp end end end
Version data entries
55 entries across 55 versions & 1 rubygems