diff options
author | Logan Lowell <fractaloop@thefrontside.net> | 2012-04-05 12:05:06 -0500 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2012-08-03 11:43:33 -0700 |
commit | b069bab4f4bcc6e6d18fb7b126a1fcc107cd0968 (patch) | |
tree | 1ecf84fa76a0535f8888dea8a1c466ae5b86a859 | |
parent | d9055cdad66025c851b65295b7d4a3577230ab2f (diff) | |
download | chef-b069bab4f4bcc6e6d18fb7b126a1fcc107cd0968.tar.gz |
Modifiy server boot process for new switches
-rw-r--r-- | Rakefile | 8 | ||||
-rwxr-xr-x | chef-server-webui/bin/chef-server-webui | 35 |
2 files changed, 19 insertions, 24 deletions
@@ -144,11 +144,11 @@ def start_chef_webui(type="normal") else # child case type when "normal" - puts "Starting chef webui for development with './chef-server/bin/chef-server-webui -a thin -l debug -N'" - exec("./chef-server-webui/bin/chef-server-webui -a thin -l debug -N") + puts "Starting chef webui for development with './chef-server/bin/chef-server-webui'" + exec("./chef-server-webui/bin/chef-server-webui") when "features" - puts "Starting chef server webui for features with #{["./chef-server/bin/chef-server-webui -a thin -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug -N"].join(' ')}" - exec("./chef-server-webui/bin/chef-server-webui -a thin -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")} -l debug -N") + puts "Starting chef server webui for features with #{["./chef-server/bin/chef-server-webui -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")}"].join(' ')}" + exec("./chef-server-webui/bin/chef-server-webui -C #{File.join(File.dirname(__FILE__), "features", "data", "config", "server.rb")}") end end end diff --git a/chef-server-webui/bin/chef-server-webui b/chef-server-webui/bin/chef-server-webui index 99679cf20c..986d394a2f 100755 --- a/chef-server-webui/bin/chef-server-webui +++ b/chef-server-webui/bin/chef-server-webui @@ -33,16 +33,22 @@ end require 'chef' require 'chef-server-webui' -if ARGV[0] && ARGV[0] =~ /^[^-]/ - ARGV.push "-H" +# Run the server unless console or script runner requested +unless %w[c console r runner].any? { |o| ARGV.index(o) } + ARGV.unshift "server" end -unless %w[-a --adapter -i --irb-console -r --script-runner].any? { |o| ARGV.index(o) } - ARGV.push *%w[thin] -end -unless %w[-p --port].any? { |o| ARGV.index(o) } + +# Default to port 4040 if not specified +unless %w[-p --port c console].any? { |o| ARGV.index(o) } ARGV.push *%w[-p 4040] end +# Configure Rails environment +if index = ARGV.index("-e") + ENV['RAILS_ENV'] = ARGV[index+1] +end + +# Load custom config if index = ARGV.index("-C") config = ARGV[index+1] ARGV.delete("-C") @@ -54,22 +60,11 @@ else ) end +# Configure Chef Chef::Log.init(Chef::Config[:log_location]) Chef::Log.level = Chef::Config[:log_level] -# Change to the application's path if there is no config.ru file in current dir. -# This allows us to run script/rails server from other directories, but still get -# the main config.ru and properly set the tmp directory. -Dir.chdir(File.join(File.dirname(__FILE__), '..')) - +# Boot Rails APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) - -require 'rails/commands/server' -Rails::Server.new.tap { |server| - # We need to require application after the server sets environment, - # otherwise the --environment option given to the server won't propagate. - require APP_PATH - Dir.chdir(Rails.application.root) - server.start -}
\ No newline at end of file +require 'rails/commands' |