2022-11-02 04:49:43 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2023-06-30 21:06:20 +02:00
|
|
|
require "bundler/setup"
|
2022-11-08 11:45:40 +01:00
|
|
|
require "ryo"
|
2023-06-30 21:14:21 +02:00
|
|
|
require "yaml"
|
2023-07-25 19:18:15 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
# Rake tasks
|
2024-05-17 08:02:13 +02:00
|
|
|
begin
|
|
|
|
load "rake/tasks/deploy.rake"
|
|
|
|
rescue LoadError
|
|
|
|
warn "[warn] #{$!.class}: #{$!.message}"
|
|
|
|
end
|
2024-05-02 15:46:40 +02:00
|
|
|
load "rake/tasks/format.rake"
|
2024-03-15 16:52:39 +01:00
|
|
|
load "rake/tasks/nanoc.rake"
|
2024-05-20 01:22:14 +02:00
|
|
|
load "rake/tasks/t.rake"
|
2024-05-20 04:24:47 +02:00
|
|
|
load "rake/tasks/ci.rake"
|
2023-06-30 21:06:20 +02:00
|
|
|
|
2024-05-25 05:22:12 +02:00
|
|
|
desc "Start HTTP server"
|
2024-03-22 14:36:23 +01:00
|
|
|
task :server, [:protocol] do |_t, args|
|
2023-06-30 21:14:21 +02:00
|
|
|
require "server"
|
2024-03-22 14:36:23 +01:00
|
|
|
nanoc = Ryo.from(YAML.load_file("./nanoc.yaml"))
|
2024-03-10 12:53:33 +01:00
|
|
|
h = args.to_h
|
2024-05-02 15:46:40 +02:00
|
|
|
o = if h[:protocol] == "unix"
|
|
|
|
{unix: nanoc.server.unix.path}
|
|
|
|
else
|
|
|
|
{host: nanoc.server.tcp.host, port: nanoc.server.tcp.port}
|
|
|
|
end
|
2024-03-23 18:45:43 +01:00
|
|
|
s = Server.dir(nanoc.output_dir, o)
|
2023-06-30 21:14:21 +02:00
|
|
|
s.start(block: true)
|
|
|
|
rescue Interrupt
|
|
|
|
s.stop
|
2022-11-03 23:09:51 +01:00
|
|
|
end
|
2024-03-10 12:54:42 +01:00
|
|
|
task default: "nanoc:build"
|