# File lib/ramaze/bin/start.rb, line 152
      def run(argv = [])
        begin
          @options.parse!(argv)
        rescue => e
          warn "Error: #{e.message}"
          abort @options.to_s
        end

        # Remove all trailing/leading whitespace from the options
        @rack_options.each do |k, v|
          @rack_options[k] = v.strip if v.respond_to?(:strip)
        end

        @ruby_options.each do |k, v|
          @ruby_options[k] = v.strip if v.respond_to?(:strip)
        end

        rackup_config = argv.delete_at(0)
        rackup_config = File.join(Dir.pwd, 'config.ru') if rackup_config.nil?

        # Check if the config is a directory or file
        if File.directory?(rackup_config)
          rackup_config = File.join(rackup_config, 'config.ru')
        end

        if !File.exist?(rackup_config)
          abort "The Rackup config #{rackup_config} does not exist"
        end

        # Set the default port and server to use.
        if !@rack_options['-p']
          @rack_options['-p'] = 7000
        end

        # Set the default server to use
        if !@rack_options['-s']
          @rack_options['-s'] = Ramaze.options.adapter.handler.to_s
        end

        # If a PID is supplied we should first check to see if Ramaze isn't
        # already running.
        if @rack_options.key?('-P') and is_running?(@rack_options['-P'])
          abort 'This application is already running'
        end

        params = []

        @ruby_options.merge(@rack_options).each do |opt, value|
          params.push("#{opt}#{value}")
        end

        start_server(rackup_path, rackup_config, *params)
      end