al-quran.reflectslight.io/rake/tasks/server.rake

20 lines
462 B
Ruby
Raw Normal View History

2024-06-19 23:36:03 +02:00
# frozen_string_literal: true
2024-06-19 22:56:38 +02:00
desc "Start web server"
task :server, [:protocol] do |_t, args|
require "server"
h = args.to_h
p = h[:protocol] || "tcp"
2024-06-22 19:12:50 +02:00
n = File.basename(dirs.root)
2024-06-19 22:56:38 +02:00
o = if p == "unix"
2024-06-19 23:36:03 +02:00
{unix: nanoc.server.unix.path}
else
{host: nanoc.server.tcp.host, port: nanoc.server.tcp.port}
end
2024-06-19 22:56:38 +02:00
Process.setproctitle "rake server[#{p}] [#{n}]"
s = Server.dir(nanoc.output_dir, o)
s.start(block: true)
rescue Interrupt
s.stop
end