lib/thin/runner.rb
# Send the command to the controller: single instance or cluster.
Send the command to the controller: single instance or cluster.
Send the command to the controller : single instance or cluster .
def run_command
      load_options_from_config_file! unless CONFIGLESS_COMMANDS.include?(@command)
      Command.script = File.expand_path($PROGRAM_NAME)
      Dir.chdir(@options[:chdir]) unless CONFIGLESS_COMMANDS.include?(@command)
      @options[:require].each { |r| ruby_require r }
      Logging.debug = @options[:debug]
      Logging.trace = @options[:trace]
      controller = case
      when cluster? then Controllers::Cluster.new(@options)
      when service? then Controllers::Service.new(@options)
      else               Controllers::Controller.new(@options)
      end
      if controller.respond_to?(@command)
        begin
          controller.send(@command, *@arguments)
        rescue RunnerError => e
          abort e.message
        end
      else
        abort "Invalid options for command: #{@command}"
      end
    end
def run_command load_options_from_config_file! unless CONFIGLESS_COMMANDS . include? ( @command ) Command . script = File . expand_path ( $PROGRAM_NAME ) Dir . chdir ( @options [ :chdir ] ) unless CONFIGLESS_COMMANDS . include? ( @command ) @options [ :require ] . each { | r | ruby_require r } Logging . debug = @options [ :debug ] Logging . trace = @options [ :trace ] controller = case when cluster? then Controllers :: Cluster . new ( @options ) when service? then Controllers :: Service . new ( @options ) else Controllers :: Controller . new ( @options ) end if controller . respond_to? ( @command ) begin controller . send ( @command , * @arguments ) rescue RunnerError => e abort e . message end else abort "Invalid options for command: #{@command}" end end
Send the command to the controller: single instance or cluster.
Send the command to the controller : single instance or cluster .
# PROGRAM_NAME is relative to the current directory, so make sure # we store and expand it before changing directory. # Change the current directory ASAP so that all relative paths are # relative to this one.