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
|
2023-07-13 02:31:54 +02:00
|
|
|
load "tasks/deploy.rake"
|
2023-07-25 19:18:15 +02:00
|
|
|
load "tasks/linter.rake"
|
2023-07-25 20:32:57 +02:00
|
|
|
load "tasks/nanoc.rake"
|
2023-06-30 21:06:20 +02:00
|
|
|
|
2023-06-30 21:14:21 +02:00
|
|
|
desc "Serve the website on localhost"
|
2024-03-10 12:53:33 +01:00
|
|
|
task :server, [:host, :port] do |_t, args|
|
2023-06-30 21:14:21 +02:00
|
|
|
require "server"
|
2023-07-27 16:34:15 +02:00
|
|
|
build_dir = Ryo.from(YAML.load_file("./nanoc.yaml")).output_dir
|
2024-03-10 12:53:33 +01:00
|
|
|
h = args.to_h
|
|
|
|
s = Server.for_dir(build_dir, h.slice(:host,:port))
|
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"
|