29 lines
671 B
Ruby
29 lines
671 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "bundler/setup"
|
|
require "ryo"
|
|
require "yaml"
|
|
|
|
##
|
|
# Rake tasks
|
|
load "rake/tasks/deploy.rake"
|
|
load "rake/tasks/linter.rake"
|
|
load "rake/tasks/nanoc.rake"
|
|
load "rake/tasks/submodules.rake"
|
|
|
|
desc "Serve the website on localhost"
|
|
task :server, [:protocol] do |_t, args|
|
|
require "server"
|
|
nanoc = Ryo.from(YAML.load_file("./nanoc.yaml"))
|
|
h = args.to_h
|
|
o = if h[:protocol] == 'unix'
|
|
{unix: nanoc.server.unix.path}
|
|
else
|
|
{host: nanoc.server.tcp.host, port: nanoc.server.tcp.port}
|
|
end
|
|
s = Server.for_dir(nanoc.output_dir, o)
|
|
s.start(block: true)
|
|
rescue Interrupt
|
|
s.stop
|
|
end
|
|
task default: "nanoc:build"
|