-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
36 lines (31 loc) · 901 Bytes
/
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
Rake::TaskManager.record_task_metadata = true
task :default do
puts "Available tasks:"
Rake.application.options.show_tasks = :tasks
Rake.application.options.full_description = true
Rake.application.options.show_task_pattern = //
Rake.application.display_tasks_and_comments
end
task :env do
require './app.rb'
end
namespace :db do
desc 'Drop and recreate the database'
task :setup => :env do
DataMapper.finalize.auto_migrate!
end
desc 'Migrate the database'
task :migrate => :env do
DataMapper.finalize.auto_upgrade!
end
end
desc 'syncronize slot app pids'
task :sync_pids => :env do
ActiveSlot.all.each do |slot|
ps_result = `ps -eo pid,command | grep "rails.*#{slot.port}"`
pid = ps_result.split("\n").select {|i| !i.include?("grep")}.first.to_i
slot.app_pid = -1
slot.app_pid = pid unless pid==0
slot.save
end
end