public
Rubygem
Description: Resource-oriented open source Ruby framework for Web apps.
Homepage: http://rubywaves.com/
Clone URL: git://github.com/dyoder/waves.git
Search Repo:
commit  6c248a07c06ea2e9b7f524ff65a3f3388c539d26
tree    2c80256a3766d1a776136768a354059ce92f28d0
parent  812ae93637e1aa6124b79d6c7ef5951bd03f1712
waves / lib / tasks / cluster.rb
100644 26 lines (22 sloc) 0.827 kb
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
namespace :cluster do
 
  desc 'Start a cluster of waves applications.'
  task :start do |task|
    using_waves_src = defined?(WAVES) || ENV['WAVES'] || File.exist( File.dirname(__FILE__) / :waves )
    script = using_waves_src ? :bin / 'waves-server' : 'waves-server'
    ( Waves::Console.config.ports || [ Waves::Console.config.port ] ).each do |port|
      cmd = "#{script} -p #{port} -c #{ENV['mode']||'development'} -d"
      puts cmd ; `#{cmd}`
    end
  end
 
  desc 'Stop a cluster of waves applications.'
  task :stop do |task|
     Dir[ :log / '*.pid' ].each do |pidfile|
       pid = File.read(pidfile).to_i
       puts "Stopping process #{pid} ..."
       Process.kill( 'INT', pid ) rescue nil
    end
  end
 
  desc 'Restart a cluster of waves applications.'
  task :restart => [ :stop, :start ] do |task|
  end
 
end