diff --git a/nanoc.yaml.sample b/nanoc.yaml.sample index c3b2b7e..06c3212 100644 --- a/nanoc.yaml.sample +++ b/nanoc.yaml.sample @@ -27,6 +27,7 @@ server: base_url: https://al-quran.reflectslight.io unix: path: + mode: ug=rw,o= tcp: host: 127.0.0.1 port: 7777 diff --git a/rake/tasks/server.rake b/rake/tasks/server.rake index c6ed11d..6243735 100644 --- a/rake/tasks/server.rake +++ b/rake/tasks/server.rake @@ -1,19 +1,28 @@ # frozen_string_literal: true +cwd = File.realpath File.join(__dir__, "..", "..", ".") desc "Start web server" task :server, [:protocol] do |_t, args| require "server" + nanoc = Ryo.from_yaml(path: File.join(cwd, "nanoc.yaml")) h = args.to_h p = h[:protocol] || "tcp" - n = File.basename(dirs.root) + n = File.basename(cwd) o = if p == "unix" - {unix: nanoc.server.unix.path} - else - {host: nanoc.server.tcp.host, port: nanoc.server.tcp.port} - end - Process.setproctitle "rake server[#{p}] [#{n}]" + {unix: nanoc.server.unix.path} + else + {host: nanoc.server.tcp.host, port: nanoc.server.tcp.port} + end s = Server.dir(nanoc.output_dir, o) - s.start(block: true) + Process.setproctitle "rake server[#{p}] [#{n}]" + if p == "unix" + t = s.start(block: false) + unix = nanoc.server.unix + chmod(unix.mode, unix.path, verbose: false) + t.join + else + s.start(block: true) + end rescue Interrupt s.stop end diff --git a/share/al-quran.reflectslight.io/CHANGELOG b/share/al-quran.reflectslight.io/CHANGELOG index fcc9a9d..377777b 100644 --- a/share/al-quran.reflectslight.io/CHANGELOG +++ b/share/al-quran.reflectslight.io/CHANGELOG @@ -1,5 +1,11 @@ # -*- mode: org -*- +** vNEXT + +**** Add ability to set file mode in ~server.rake~ +Add ability to set the file mode on unix socket. +Default: ~ug=rw,o=~ + ** v0.9.1 **** Fix ~_opengraph.html.erb~ typos