Class: Hanami::Reloader::Commands::Server

Inherits:
CLI::Commands::App::Server
  • Object
show all
Defined in:
lib/hanami/reloader/commands.rb

Overview

Override ‘hanami server` command

Constant Summary collapse

DEFAULT_GUARD_PUMA_OPTIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0

["-n", "f", "-i", "-g", Guardfile.group, "-G"].freeze
OPTIONS_SEPARATOR =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0

" "

Instance Method Summary collapse

Instance Method Details

#call(**args) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/hanami/reloader/commands.rb', line 78

def call(**args)
  code_reloading = args.fetch(:code_reloading)

  if ENV["HANAMI_ENV"] == "production"
    msg = <<~TEXT
      WARNING: You are running `hanami server` in the production environment via hanami-reloader.

      Code reloading is disabled, but `hanami server` and hanami-reloader are intended to be used in
      development only.

      For production, start your web server directly, e.g. `bundle exec puma -C config/puma.rb`.
    TEXT

    err.puts msg

    return super
  end

  if code_reloading
    guard_puma_env_vars!(**args)
    exec "bundle exec guard #{guard_puma_options(**args)}"
  else
    super
  end
end