bin/game_machine in game_machine-0.0.11 vs bin/game_machine in game_machine-1.0.2

- old
+ new

@@ -1,7 +1,11 @@ #!/usr/bin/env jruby +ENV['APP_ROOT'] ||= File.expand_path(Dir.pwd) +ENV['JAVA_ROOT'] = File.join(ENV['APP_ROOT'],'java','project') +ENV['GAME_ENV'] = 'development' + require 'rubygems' require 'fileutils' def load_game_machine begin @@ -9,71 +13,69 @@ rescue LoadError require_relative '../lib/game_machine' end end +def load_config + require_relative '../lib/game_machine/app_config' + GameMachine::AppConfig.instance.load_config +end + ARGV << '--help' if ARGV.empty? aliases = { - "n" => "new", "b" => "build", - "s" => "server", - "sl" => "server_loop" + "s" => "server" } command = ARGV.shift command = aliases[command] || command -ENV['APP_ROOT'] ||= File.expand_path(Dir.pwd) -ENV['JAVA_ROOT'] = File.join(ENV['APP_ROOT'],'java') -ENV['GAME_ENV'] = 'development' - require_relative '../lib/game_machine/console' -if command == 'new' + +if command == 'install' || command == 'upgrade' bin_path = File.dirname(__FILE__) install_source_path = File.expand_path( File.join(bin_path,'../') ) - GameMachine::Console::Install.new(ARGV,install_source_path).run! + GameMachine::Console::Install.new(command,ARGV,install_source_path).run! -elsif command == 'build' - require_relative '../java/local_lib/protostuff-compiler-1.0.7-jarjar.jar' +elsif command == 'build' || command == 'bundle' + require_relative '../java/project/local_lib/protostuff-compiler-1.0.8-jarjar.jar' require_relative '../lib/game_machine/protobuf/game_messages.rb' require_relative '../lib/game_machine/protobuf/generate.rb' - GameMachine::Console::Build.new(ARGV).run! + if command == 'bundle' + GameMachine::Console::Build.new(ARGV,true).run! + else + GameMachine::Console::Build.new(ARGV).run! + end + elsif command == 'server' # Need to set environment vars before loading everything. server = GameMachine::Console::Server.new(ARGV) server.set_environment load_game_machine # Run the server server.run! -elsif command == 'server_loop' - GameMachine::Console::Server.run_in_loop else puts <<EOF Usage: - game_machine server [options] Start the server - -r, --restartable If tmp/gm_restart.txt should trigger a restart - -s, --server=name Server name - -c, --config=name Configuration file - -e, --environment=name Specifies the environment to run under (development/production). - Default: development + game_machine server Start the server - game_machine server_loop Runs server in loop that restarts when tmp/gm_restart.txt - is present. On restart it will run build then server -r. + game_machine build [clean] Build java and protobuf messages - game_machine build Generate and compile protobuf messages + game_machine bundle Build and bundle gems for deployment - game_machine new [path] Create a new Game Machine application at the - specified path + game_machine install [path] Install Game Machine to [path] + + game_machine upgrade [path] Upgrade the Game Machine installation at [path] EOF -end - +exit 1 +end