lib/conf/argv.rb in rsence-pre-2.2.0.27 vs lib/conf/argv.rb in rsence-pre-2.2.0.28

- old
+ new

@@ -81,27 +81,27 @@ :latency => 0, # --latency :say => false, # -S --say :http_delayed_start => nil, # --http-delayed-start # client_pkg (not supported yet) - :client_pkg_no_gzip => false, # --client-no-gzip - :client_pkg_no_obfuscation => false, # --client-no-obfuscation - :client_pkg_no_whitespace_removal => false, # --client-keep-whitespace - :client_pkg_quiet => true, # --client-verbose + :client_pkg_no_gzip => false, # --disable-gzip + :client_pkg_no_obfuscation => false, # --disable-obfuscation + :client_pkg_no_whitespace_removal => false, # --disable-jsmin + :suppress_build_messages => true, # --build-report } end def set_client_pkg_arg( arg_name ) - if arg_name == '--client-no-gzip' + if arg_name == '--disable-gzip' @args[:client_pkg_no_gzip] = true - elsif arg_name == '--client-no-obfuscation' + elsif arg_name == '--disable-obfuscation' @args[:client_pkg_no_obfuscation] = true - elsif arg_name == '--client-keep-whitespace' + elsif arg_name == '--disable-jsmin' @args[:client_pkg_no_whitespace_removel] = true - elsif arg_name == '--client-verbose' - @args[:client_pkg_quiet] = false + elsif arg_name == '--build-report' + @args[:suppress_build_messages] = false else invalid_option( arg_name ) end end @@ -150,11 +150,11 @@ expect_option = true option_name = :port elsif arg == '--addr' expect_option = true option_name = :addr - elsif arg == '--http-delayed-start' + elsif arg == '--http-delayed-start' or arg == '--delayed-start' expect_option = true option_name = :http_delayed_start elsif arg == '--server' expect_option = true option_name = :server @@ -218,11 +218,11 @@ @args[:debug] = true @args[:verbose] = true @args[:autoupdate] = true @args[:client_pkg_no_obfuscation] = true @args[:client_pkg_no_whitespace_removal] = true - @args[:client_pkg_quiet] = false + @args[:suppress_build_messages] = false end # Set the verbose argument on def set_verbose @args[:verbose] = true @@ -631,13 +631,30 @@ puts @@strs[:initenv][:env_already_initialized] exit end conf_file = File.expand_path( File.join( @args[:env_path], 'conf', 'config.yaml' ) ) if File.exists?(@args[:env_path]) - if Dir.entries(@args[:env_path]).length > 2 # [ '.', '..' ] + env_empty = true # true while entries start with a dot + env_clear = true # true while entries don't contain RSence project files + env_entries = ['conf', 'db', 'log', 'plugins', 'run', 'README', 'VERSION'] + Dir.entries(@args[:env_path]).each do |entry| + next if entry.start_with?('.') + env_empty = false + if env_entries.include? entry + env_clear = false + break + end + end + unless env_clear + puts ERB.new( @@strs[:initenv][:env_not_clear] ).result( binding ) + print @@strs[:initenv][:continue_question] + exit unless yesno + end + unless env_empty puts ERB.new( @@strs[:initenv][:env_not_empty] ).result( binding ) - exit + print @@strs[:initenv][:continue_question] + exit unless yesno end end require 'conf/default' default_config = Configuration.new(@args,true).config @@ -721,10 +738,10 @@ Dir.mkdir( plugins_dir ) run_dir = File.expand_path( 'run', env_dir ) Dir.mkdir( run_dir ) unless create_blank print @@strs[:initenv][:install_welcome] - if yesno(true) + if yesno welcome_plugin_dir = File.join( SERVER_PATH, 'setup', 'welcome' ) welcome_plugin_dst = File.join( plugins_dir, 'welcome' ) puts ERB.new( @@strs[:initenv][:installing_welcome_plugin] ).result( binding ) FileUtils.cp_r( welcome_plugin_dir, welcome_plugin_dst ) end