-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
44 lines (38 loc) · 1.02 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
42
43
44
require 'rake'
require(File.join(File.dirname(__FILE__), 'winebot'))
require(File.join(File.dirname(__FILE__), 'monopolybot'))
task :listen do
Winebot.runner
end
task :check_feeds do
Winebot.db_setup
Feed.monitor_all
end
namespace :solr do
desc 'Starts Solr'
task :start do
begin
n = Net::HTTP.new('localhost', Winebot::SOLR_PORT)
n.request_head('/').value
rescue Net::HTTPServerException #responding
puts "Port #{Winebot::SOLR_PORT} in use" and return
rescue Errno::ECONNREFUSED #not responding
Dir.chdir(Winebot::SOLR_PATH) do
pid = fork do
#STDERR.close
`java -Djetty.port=#{Winebot::SOLR_PORT} -jar start.jar`
end
sleep(5)
File.open(Winebot::SOLR_PID, "w"){ |f| f << pid}
puts "Solr started successfully on #{Winebot::SOLR_PORT}, pid: #{pid}."
end
end
end
end
desc 'Tasks to run the Monopolybot'
namespace :monopolybot do
desc 'start up the listener'
task :listen do
Monopolybot.runner
end
end