ruby-win32/lib/ruby/gems/1.8/gems/mongrel_service-0.3.4-x86-mswin32/lib/mongrel_service/init.rb
# When we validate the options, we need to make sure the --root is actually RAILS_ROOT
# of the rails application we wanted to serve, because later "as service" no error 
# show to trace this.

When we validate the options, we need to make sure the --root is actually RAILS_ROOT
of the rails application we wanted to serve, because later "as service" no error
show to trace this.
When we validate the options we need to make sure the -- root is actually RAILS_ROOT of the rails application we wanted to serve because later " as service " no error show to trace this .
def validate
      gem 'win32-service', '>= 0.5.2', '< 0.6.0'
      require 'win32/service'
      @cwd = File.expand_path(@cwd)
      valid_dir? @cwd, "Invalid path to change to: #@cwd"
      Dir.chdir(@cwd)
      app_exist = true
      %w{app config log}.each do |path|
        if !File.directory?(File.join(@cwd, path))
          app_exist = false
          break
        end
      end
      valid?(@prefix[0].chr == "/" && @prefix[-1].chr != "/", "Prefix must begin with / and not end in /") if @prefix
      valid? app_exist == true, "The path you specified isn't a valid Rails application."
      valid_dir? File.dirname(@log_file), "Path to log file not valid: #@log_file"
      valid_dir? File.dirname(@pid_file), "Path to pid file not valid: #@pid_file"
      valid_dir? @docroot, "Path to docroot not valid: #@docroot"
      valid_exists? @mime_map, "MIME mapping file does not exist: #@mime_map" if @mime_map
      valid_exists? @config_file, "Config file not there: #@config_file" if @config_file
      begin
        valid? !Win32::Service.exists?(@svc_name), "The service already exist, please remove it first."
      rescue
      end
      valid? @svc_name != nil, "A service name is mandatory."
      @svc_display = @svc_name if !@svc_display
      return @valid
    end
def validate gem 'win32-service' , '>= 0.5.2' , '< 0.6.0' require 'win32/service' @cwd = File . expand_path ( @cwd ) valid_dir? @cwd , "Invalid path to change to: #@cwd" Dir . chdir ( @cwd ) app_exist = true %w{ app config log } . each do | path | if ! File . directory? ( File . join ( @cwd , path ) ) app_exist = false break end end valid? ( @prefix [ 0 ] . chr == "/" && @prefix [ - 1 ] . chr != "/" , "Prefix must begin with / and not end in /" ) if @prefix valid? app_exist == true , "The path you specified isn't a valid Rails application." valid_dir? File . dirname ( @log_file ) , "Path to log file not valid: #@log_file" valid_dir? File . dirname ( @pid_file ) , "Path to pid file not valid: #@pid_file" valid_dir? @docroot , "Path to docroot not valid: #@docroot" valid_exists? @mime_map , "MIME mapping file does not exist: #@mime_map" if @mime_map valid_exists? @config_file , "Config file not there: #@config_file" if @config_file begin valid? ! Win32 :: Service . exists? ( @svc_name ) , "The service already exist, please remove it first." rescue end valid? @svc_name != nil , "A service name is mandatory." @svc_display = @svc_name if ! @svc_display return @valid end
When we validate the options, we need to make sure the --root is actually RAILS_ROOT
of the rails application we wanted to serve, because later "as service" no error
show to trace this.
When we validate the options we need to make sure the -- root is actually RAILS_ROOT of the rails application we wanted to serve because later " as service " no error show to trace this .
# TODO: investigate why Win32::Service interfere with gem_plugin
 # change there to start, then we'll have to come back after daemonize
 # start with the premise of app really exist.
 # We should validate service existance here, right Zed?
 # default service display to service name
