Sha256: 3d9ea7eecd07f9d58c780b103307ad7e1c13f0dea8d9fa3056f43ad0ca79a767
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
# TODO This file needs some love. # namespace :server do def chdir_to_root Dir.chdir SEARCH_ROOT end def current_pid pid = `cat #{File.join(SEARCH_ROOT, 'tmp/pids/unicorn.pid')}` pid.blank? ? nil : pid.chomp end desc "Start the unicorns. Weheee!" task :start => :application do chdir_to_root # Rake::Task[:"solr:start"].invoke # TODO Move to better place. config = {} config['production'] = { :port => 6000, :daemonize => true } config['development'] = { :port => 4000, :daemonize => false } # TODO Move port! port = SEARCH_ENVIRONMENT == 'production' ? 6000 : 4000 `export SEARCH_ENV=#{SEARCH_ENVIRONMENT}; unicorn -p #{config[SEARCH_ENVIRONMENT][:port]} -c #{File.join(SEARCH_ROOT, 'app/unicorn.ru')} #{config[SEARCH_ENVIRONMENT][:daemonize] ? '-D' : ''} #{File.join(SEARCH_ROOT, 'app/application.ru')}` end desc "Restart the unicorns!" task :restart do Rake::Task[:"server:stop"].invoke sleep 15 Rake::Task[:"server:start"].invoke end desc "Stop the unicorns. Blam!" task :stop => :application do chdir_to_root `kill -QUIT #{current_pid}` if current_pid # Rake::Task[:"solr:stop"].invoke # TODO Move to better place. end # TODO # desc 'send the USR1 signal to the thin server' task :usr1 => :ruby_version do puts "Sending USR1 signal to the thin server." `pidof thin#{RUBY_VERSION_APPENDIX}`.split.each { |pid| Process.kill('USR1', pid.to_i) } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
picky-0.0.3 | lib/tasks/server.rake |
picky-0.0.2 | lib/tasks/server.rake |