forked from rubytaiwan/ruby-taiwan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
41 lines (33 loc) · 1.06 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'resque/tasks'
RubyChina::Application.load_tasks
namespace :resque do
task :restart_workers => :environment do
pids = Array.new
Resque.workers.each do |worker|
pids << worker.to_s.split(/:/).second
end
if pids.size > 0
system("kill -QUIT #{pids.join(' ')}")
end
system("rm /var/run/god/resque-1.8.0*.pid")
end
end
namespace :test do
desc "preparing config files..."
task :prepare => :init do
["config","mongoid","redis"].each do |cfgfile|
system("cp config/#{cfgfile}.yml.default config/#{cfgfile}.yml") unless File.exist?("config/#{cfgfile}.yml")
end
end
desc "start essential services.."
task :init do
desc "starting resque..."
system("./script/resque start")
desc "starting sunspot..."
system("bundle exec rake sunspot:solr:start")
end
end