Class: GameMachine::MonoServer
- Inherits:
-
Object
- Object
- GameMachine::MonoServer
- Defined in:
- lib/game_machine/mono_server.rb
Instance Attribute Summary collapse
-
#mono_path ⇒ Object
readonly
Returns the value of attribute mono_path.
Instance Method Summary collapse
-
#initialize ⇒ MonoServer
constructor
A new instance of MonoServer.
- #run! ⇒ Object
Constructor Details
#initialize ⇒ MonoServer
Returns a new instance of MonoServer.
5 6 7 |
# File 'lib/game_machine/mono_server.rb', line 5 def initialize @mono_path = File.join(GameMachine.app_root,'mono','server') end |
Instance Attribute Details
#mono_path ⇒ Object (readonly)
Returns the value of attribute mono_path.
4 5 6 |
# File 'lib/game_machine/mono_server.rb', line 4 def mono_path @mono_path end |
Instance Method Details
#run! ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/game_machine/mono_server.rb', line 9 def run! # mono server blocks. We run in a loop so if it dies or we restart it, # it will just get restarted Thread.new do loop do case RbConfig::CONFIG['host_os'] when /mswin|windows/i system("cd #{mono_path} && server.exe") else system("cd #{mono_path} && mono server.exe") end sleep 10 end end end |