mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 05:53:38 +08:00
427d54b2b0
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. We no longer need to use Rails "require_dependency" anywhere and instead can just use standard Ruby patterns to require files. This is a far reaching change and we expect some followups here.
32 lines
490 B
Ruby
32 lines
490 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "demon/demon_base"
|
|
|
|
class Demon::RailsAutospec < Demon::DemonBase
|
|
|
|
def self.prefix
|
|
"rails-autospec"
|
|
end
|
|
|
|
def stop_signal
|
|
"TERM"
|
|
end
|
|
|
|
private
|
|
|
|
def after_fork
|
|
require "rack"
|
|
ENV["RAILS_ENV"] = "test"
|
|
Rack::Server.start(
|
|
config: "config.ru",
|
|
AccessLog: [],
|
|
Port: ENV["TEST_SERVER_PORT"] || 60099,
|
|
)
|
|
rescue => e
|
|
STDERR.puts e.message
|
|
STDERR.puts e.backtrace.join("\n")
|
|
exit 1
|
|
end
|
|
|
|
end
|