Methods
R
S
Class Public methods
record_pid(name = "#{OPTIONS[:process]}.spawner", id = Process.pid)
# File rails/railties/lib/commands/process/spawner.rb, line 18
def self.record_pid(name = "#{OPTIONS[:process]}.spawner", id = Process.pid)
  FileUtils.mkdir_p(OPTIONS[:pids])
  File.open(File.expand_path(OPTIONS[:pids] + "/#{name}.pid"), "w+") { |f| f.write(id) }
end
spawn_all()
# File rails/railties/lib/commands/process/spawner.rb, line 23
def self.spawn_all
  OPTIONS[:instances].times do |i|
    port = OPTIONS[:port] + i
    print "Checking if something is already running on #{OPTIONS[:address]}:#{port}..."

    begin
      srv = TCPServer.new(OPTIONS[:address], port)
      srv.close
      srv = nil

      puts "NO"
      puts "Starting dispatcher on port: #{OPTIONS[:address]}:#{port}"

      FileUtils.mkdir_p(OPTIONS[:pids])
      spawn(port)
    rescue
      puts "YES"
    end
  end
end