Update server.rake
This commit is contained in:
parent
97e282c1a2
commit
f9e7bb6469
4 changed files with 30 additions and 9 deletions
|
@ -51,7 +51,7 @@ GEM
|
|||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
ryo.rb (0.5.1)
|
||||
ryo.rb (0.5.5)
|
||||
sequel (5.80.0)
|
||||
bigdecimal
|
||||
server.rb (0.2.2)
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
require "bundler/setup"
|
||||
require "twenty/cli"
|
||||
require "twenty/client"
|
||||
require "twenty/server"
|
||||
require "ryo"
|
||||
require "ryo/yaml"
|
||||
|
||||
load "host/rake/tasks/schema.rake"
|
||||
load "host/rake/tasks/nanoc.rake"
|
||||
|
|
|
@ -14,3 +14,10 @@ data_sources:
|
|||
encoding: utf-8
|
||||
content_dir: src/
|
||||
layouts_dir: src/layouts
|
||||
|
||||
server:
|
||||
unix:
|
||||
path: /tmp/github.com.0x1eef.twenty
|
||||
tcp:
|
||||
host: 127.0.0.1
|
||||
port: 7777
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
desc "Run server"
|
||||
task :server, [:protocol] do |_, args|
|
||||
require 'rbconfig'
|
||||
cli = [RbConfig.ruby, "-rbundler/setup", "cli/bin/twenty", "up"]
|
||||
# frozen_string_literal: true
|
||||
|
||||
cwd = File.realpath File.join(__dir__, "..", "..", "..", "client")
|
||||
desc "Start web server"
|
||||
task :server, [:protocol] do |_t, args|
|
||||
nanoc = Ryo.from_yaml(path: File.join(cwd, "nanoc.yaml"))
|
||||
h = args.to_h
|
||||
if h[:protocol] == "unix"
|
||||
Process.wait spawn(*cli, "--unix", "/tmp/twenty.freebsd.local")
|
||||
p = h[:protocol] || "tcp"
|
||||
n = File.basename File.dirname(cwd)
|
||||
Process.setproctitle "rake server[#{p}] [#{n}]"
|
||||
if p == "unix"
|
||||
Twenty::Command::Up
|
||||
.new(["-u", nanoc.server.unix.path])
|
||||
.run
|
||||
else
|
||||
Process.wait spawn(*cli)
|
||||
Twenty::Command::Up
|
||||
.new(["-b", nanoc.server.tcp.host, "-p", nanoc.server.tcp.port])
|
||||
.run
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue