Merge branch 'main' into production
This commit is contained in:
commit
54d7e1e99e
4 changed files with 15 additions and 7 deletions
|
@ -11,12 +11,13 @@ load "tasks/linter.rake"
|
|||
load "tasks/nanoc.rake"
|
||||
|
||||
desc "Serve the website on localhost"
|
||||
task :server do
|
||||
task :server, [:host, :port] do |_t, args|
|
||||
require "server"
|
||||
build_dir = Ryo.from(YAML.load_file("./nanoc.yaml")).output_dir
|
||||
s = Server.for_dir(build_dir)
|
||||
h = args.to_h
|
||||
s = Server.for_dir(build_dir, h.slice(:host,:port))
|
||||
s.start(block: true)
|
||||
rescue Interrupt
|
||||
s.stop
|
||||
end
|
||||
task default: "build"
|
||||
task default: "nanoc:build"
|
||||
|
|
|
@ -28,6 +28,10 @@ compile "/images/opengraph/*.png" do
|
|||
write(item.identifier.to_s)
|
||||
end
|
||||
|
||||
compile "/favicon.ico" do
|
||||
write(item.identifier.to_s)
|
||||
end
|
||||
|
||||
##
|
||||
# JSON
|
||||
passthrough "/durations/*/*.json"
|
||||
|
|
|
@ -15,7 +15,13 @@ class Server
|
|||
end
|
||||
|
||||
def self.for_dir(path, options = {})
|
||||
new(app(path), options)
|
||||
host = options.delete(:host) || "127.0.0.1"
|
||||
port = options.delete(:port) || 7777
|
||||
new app(path), options.merge!(
|
||||
binds: ["tcp://#{host}:#{port}"],
|
||||
tcp_host: host,
|
||||
tcp_port: port
|
||||
)
|
||||
end
|
||||
|
||||
def initialize(app, options = {})
|
||||
|
@ -39,9 +45,6 @@ class Server
|
|||
|
||||
def default_options
|
||||
{
|
||||
tcp_host: "127.0.0.1",
|
||||
tcp_port: 7777,
|
||||
binds: ["tcp://127.0.0.1:7777"],
|
||||
supported_http_methods: %w[GET HEAD],
|
||||
min_threads: 1,
|
||||
max_threads: 5,
|
||||
|
|
BIN
src/favicon.ico
Normal file
BIN
src/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Loading…
Reference in a new issue