Repository: puma/puma
File: lib/puma/launcher.rb (Ruby)

Code before:
    #     user_config.app do |env|
    #       [200, {}, ["hello world"]]
    #     end
    #   end
    #   Puma::Launcher.new(conf, log_writer: Puma::LogWriter.stdio).run
    def initialize(conf, launcher_args={})
      @runner        = nil
      @log_writer    = launcher_args[:log_writer] || LogWriter::DEFAULT
      @events        = launcher_args[:events] || Events.new
      @argv          = launcher_args[:argv] || []
      @original_argv = @argv.dup
      @config        = conf

      env = launcher_args.delete(:env) || ENV

      @config.clamp
      @options = @config.options

      @options[:log_writer] = @log_writer
      @options[:logger] = @log_writer if clustered?

      # Advertise the Configuration
      Puma.cli_config = @config if defined?(Puma.cli_config)
      log_config if env['PUMA_LOG_CONFIG']

      @binder        = Binder.new(@log_writer, @options)
      @binder.create_inherited_fds(env).each { |k| env.delete k }
      @binder.create_activated_fds(env).each { |k| env.delete k }

      @environment = @config.environment

      # Load the systemd integration if we detect systemd's NOTIFY_SOCKET.
      # Skip this on JRuby though, because it is incompatible with the systemd
      # integration due to https://github.com/jruby/jruby/issues/6504
      if ENV["NOTIFY_SOCKET"] && !Puma.jruby? && !ENV["PUMA_SKIP_SYSTEMD"]
        @config.plugins.create('systemd')
      end

      if @options[:bind_to_activated_sockets]
        @options[:binds] = @binder.synthesize_binds_from_activated_fs(
          @options[:binds],
          @options[:bind_to_activated_sockets] == 'only'
        )
      end

      @log_writer.formatter = LogWriter::PidFormatter.new if clustered?
      @log_writer.formatter = @options[:log_formatter] if @options[:log_formatter]

      @log_writer.custom_logger = @options[:custom_logger] if @options[:custom_logger]

      generate_restart_data

Review comment (suggestion):
Request to say less or say more. Either explain what this is without someone needing to reference the history, preferably with the context of "how to know if you're putting your config in the right place or not" in mind or remove it:

```suggestion
```


Code after:
    #     user_config.app do |env|
    #       [200, {}, ["hello world"]]
    #     end
    #   end
    #   Puma::Launcher.new(conf, log_writer: Puma::LogWriter.stdio).run
    def initialize(conf, launcher_args={})
      ## Minimal initialization for a potential early restart (e.g. when pruning bundle)

      @config = conf
      @config.clamp

      @options = @config.options

      @log_writer = launcher_args[:log_writer] || LogWriter::DEFAULT
      @log_writer.formatter = LogWriter::PidFormatter.new if clustered?
      @log_writer.formatter = @options[:log_formatter] if @options[:log_formatter]
      @log_writer.custom_logger = @options[:custom_logger] if @options[:custom_logger]
      @options[:log_writer] = @log_writer
      @options[:logger] = @log_writer if clustered?

      @events = launcher_args[:events] || Events.new

      @argv = launcher_args[:argv] || []
      @original_argv = @argv.dup

      ## End minimal initialization

      generate_restart_data
      Dir.chdir(@restart_dir)

      prune_bundler!

      env = launcher_args.delete(:env) || ENV

      # Advertise the Configuration
      Puma.cli_config = @config if defined?(Puma.cli_config)
      log_config if env['PUMA_LOG_CONFIG']

      @binder = Binder.new(@log_writer, @options)
      @binder.create_inherited_fds(env).each { |k| env.delete k }
      @binder.create_activated_fds(env).each { |k| env.delete k }

      @environment = @config.environment

      # Load the systemd integration if we detect systemd's NOTIFY_SOCKET.
      # Skip this on JRuby though, because it is incompatible with the systemd
      # integration due to https://github.com/jruby/jruby/issues/6504
      if ENV["NOTIFY_SOCKET"] && !Puma.jruby? && !ENV["PUMA_SKIP_SYSTEMD"]
        @config.plugins.create('systemd')
      end