lib/dyndoc-html-servers.rb in dyndoc-ruby-0.9.5 vs lib/dyndoc-html-servers.rb in dyndoc-ruby-0.9.7
- old
+ new
@@ -1,26 +1,28 @@
require 'dyndoc/init/home'
require 'pathname'
+require 'yaml'
module Dyndoc
module HtmlServers
@@cfg=nil
def HtmlServers.cfg
unless @@cfg
dyndoc_home = Dyndoc.home
cfg_yml = File.join(dyndoc_home,"etc","dyn-html.yml")
- @@cfg=(File.exist? cfg_yml) ? YAML::load_file(cfg_yml) : {}
+ @@cfg=(File.exist? cfg_yml) ? ::YAML::load_file(cfg_yml) : {}
@@cfg["dyndoc_home"]=dyndoc_home
end
@@cfg
end
- def HtmlServers.dyn_http_server(host=nil,port="9292")
+ def HtmlServers.dyn_http_server(host=nil,port="9294")
require 'thin'
- arg=["-R",File.join(HtmlServers.cfg["dyndoc_home"],"html-srv","dyn-html-srv.ru")]
+ dyn_html_srv_ru=File.expand_path("../../share/html-srv/dyn-html-srv.ru",__FILE__)
+ arg=["-R",dyn_html_srv_ru]
if port
arg += ["-p",port]
elsif HtmlServers.cfg["html-srv-port"]
arg += ["-p",HtmlServers.cfg["html-srv-port"].to_s]
end
@@ -45,11 +47,11 @@
root ||= cfg["root"] || HtmlServers.cfg["root"] || File.join(ENV["HOME"],"RCqls","RodaServer")
dyn_root = cfg["dyn_root"] || HtmlServers.cfg["dyn_root"] || File.join(root ,"edit")
public_root = cfg["public_root"] || HtmlServers.cfg["public_root"] || File.join(root ,"public")
pages_root = File.join(public_root ,"pages")
current_email = cfg["email"] || HtmlServers.cfg["email"] || "rdrouilh@gmail.com" #default email user can be overriden by -u option
- host=cfg["html-srv-host"] || HtmlServers.cfg["html-srv-host"] || "http://localhost"
- port=cfg["html-srv-port"] || HtmlServers.cfg["html-srv-port"] || "9292"
+ host=(cfg["html-srv-host"] || HtmlServers.cfg["html-srv-host"] || "http://localhost").to_s
+ port=(cfg["html-srv-port"] || HtmlServers.cfg["html-srv-port"] || "9294").to_s
base_url= host+":"+port
opts = {
dyn_root: dyn_root,
html_root: pages_root,