al-quran.reflectslight.io/Rakefile.rb

30 lines
667 B
Ruby
Raw Normal View History

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-03-15 16:52:39 +01:00
load "rake/tasks/deploy.rake"
load "rake/tasks/linter.rake"
load "rake/tasks/nanoc.rake"
2024-03-15 17:05:58 +01:00
load "rake/tasks/submodules.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-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"))
h = args.to_h
2024-03-22 14:36:23 +01: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"