dyndoc-ruby 1.3.0 → 1.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ead83e394d38dcc18626162ada3e9fc5077d1e5673a6992227811bfda153fd5
4
- data.tar.gz: be7ce6c24f93febcfddf6822aaf30e4dad4978cbbc8e88e47c02d6902cff525e
3
+ metadata.gz: 8e134057e655c0154df49f4518d6964d373efd163adde55ac057f734649c677b
4
+ data.tar.gz: 6f92db285fbbb590d952480e9ba1b8a1fc099c6924861b87a548e097b1188e55
5
5
  SHA512:
6
- metadata.gz: 924604a6f99dd1fc71ec45c2fb7d062b4564ae569bc8d6328ddbf2ae7e1ed88326aa607e8e62f7ba99f95ed68cef0e46732bcbc9468d8caa5ffa0b3abf039524
7
- data.tar.gz: 015316465d1ac2db277a1390e4566a525e5005fdb45b9ea333e89b61014a8f870cdc6305a8301772bf5c8a70e5f0634704410fc26068f365fdd3da5c6356842d
6
+ metadata.gz: 673b82c1efc5b4e1f6a16e9f394ff35cba499353050043351c13037ef49e6ee24be0a75acb1d1ef378ad6decf741859aa9b15920eee2f5936b78d6ab17e46417
7
+ data.tar.gz: d1b541c745c7dab4ee9c8372f71d9f7524c6b438ad8c0d101e5adf6de0a6581b4674f735dbf601daaf0af124cb0466abdb631440d0a708c84a36c298dbe22f60
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ cur=0
4
+ opts={mode: :default, to: ""}
5
+
6
+ ##p ARGV
7
+
8
+ while ["--dir","--mode","--from","--to","--help","--ext"].include? ARGV[cur]
9
+ ##p [:cur,ARGV[cur]]
10
+ case ARGV[cur]
11
+ when "--dir","--help"
12
+ opts[ARGV[cur].to_sym]=true
13
+ cur += 1
14
+ when "--mode"
15
+ opts[:mode]==ARGV[cur+1].to_sym if ["default","href"].include? ARGV[cur+1]
16
+ cur += 2
17
+ when "--from","--to"
18
+ opts[ARGV[cur][2..-1].to_sym]=ARGV[cur+1]
19
+ cur += 2
20
+ when "--ext"
21
+ opts[ARGV[cur].to_sym]=ARGV[cur+1]
22
+ cur += 2
23
+ end
24
+ end
25
+
26
+ file=ARGV[cur]
27
+ opts[:help]=true unless file
28
+ if opts[:help]
29
+ puts "rebase_url [--dir] [--from <from_path>] [--to <to_path>] [--ext <extension>] file"
30
+ else
31
+ ext=opts[:ext] ? "."+opts[:ext] : ""
32
+ files=opts[:dir] ? Dir[File.join(file,"*"+ext)] : [file]
33
+ ##p files
34
+ ##p opts
35
+ files.each do |filename|
36
+ content=File.read(filename)
37
+ File.open(filename,"w") do |f|
38
+ case opts[:mode]
39
+ when :href
40
+ f << content.gsub(/\ href="#{opts[:from]}/," href=\""+opts[:to])
41
+ else
42
+ f << content.gsub(/#{opts[:from]}/,opts[:to])
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ cmd=::File.expand_path('../../share/dyn-site/dyn-site.sh', __FILE__)+" "+ARGV.join(" ")
4
+
5
+ out=`/bin/bash -c "#{cmd}"`
6
+
7
+ puts out unless out.empty?
@@ -270,10 +270,11 @@ module Dyndoc
270
270
  user: nil #current_email
271
271
  }
272
272
 
273
- puts "watching "+ dyn_root+ " and " + dyn_public_edit_root
273
+ puts "watching "+ dyn_public_edit_root + " and " + dyn_root
274
274
  old_html_file=""
275
- ::FileWatcher.new([dyn_root,dyn_public_edit_root]).watch() do |filename, event|
276
- ##p [:filename,filename,event]
275
+ ::FileWatcher.new([dyn_public_edit_root,dyn_root]).watch() do |filename, event|
276
+ ##
277
+ p [:filename,filename,event]
277
278
  if [:changed,:updated,:new].include? event and File.extname(filename) == ".dyn"
278
279
  ##p [:filename_event,event,filename]
279
280
  if (lint_error=Dyndoc::Linter.check_file(filename)).empty?
@@ -304,27 +305,40 @@ module Dyndoc
304
305
 
305
306
  html_file=opts[:html_files][opts[:current_doc_tag]] # No more default # || html_files[""]
306
307
  ##p [:opts,opts,:current_doc_tag,opts[:current_doc_tag]]
307
- Dyndoc.cli_convert_from_file(dyn_file[1..-1],html_file, opts)
308
- ## fix html_file for _rmd, _adoc and _ttm
309
- if html_file =~ /^(.*)_(rmd|adoc|ttm)\.html$/
310
- html_file = $1+".html"
311
- end
312
- if html_file =~ /^(.*)_erb\.html$/
313
- erb_page=File.join(pages_root,$1)
314
- if File.exists? erb_page+"_erb.html"
315
- FileUtils.mv erb_page+"_erb.html",erb_page+".erb"
308
+ state=""
309
+ begin
310
+ Dyndoc.cli_convert_from_file(dyn_file[1..-1],html_file, opts)
311
+ ## fix html_file for _rmd, _adoc and _ttm
312
+ if html_file =~ /^(.*)_(rmd|adoc|ttm)\.html$/
313
+ html_file = $1+".html"
314
+ end
315
+ if html_file =~ /^(.*)_erb\.html$/
316
+ erb_page=File.join(pages_root,$1)
317
+ if File.exists? erb_page+"_erb.html"
318
+ FileUtils.mv erb_page+"_erb.html",erb_page+".erb"
319
+ end
320
+ html_file = "erb"+$1
321
+ end
322
+ puts dyn_file[1..-1]+(dyn_public_edit_file.empty? ? "" : "*")+" processed => "+html_file+" created!"
323
+ options[:first] = html_file != old_html_file
324
+ if html_file != old_html_file
325
+ old_html_file = html_file
326
+ url=File.join(base_url,html_file)
327
+ ## p [:url,url]
328
+ Dyndoc::Browser.load(url)
329
+ else
330
+ Dyndoc::Browser.reload
331
+ end
332
+ rescue
333
+ state="error: "
334
+ ensure
335
+ notify_file=filename.split("/")
336
+ if (ind=notify_file.index ".edit")
337
+ notify_file=notify_file[0..ind].join("/")
338
+ File.open(notify_file+"/notify.out","w") do |f|
339
+ f << state + filename
340
+ end
316
341
  end
317
- html_file = "erb"+$1
318
- end
319
- puts dyn_file[1..-1]+(dyn_public_edit_file.empty? ? "" : "*")+" processed => "+html_file+" created!"
320
- options[:first] = html_file != old_html_file
321
- if html_file != old_html_file
322
- old_html_file = html_file
323
- url=File.join(base_url,html_file)
324
- ## p [:url,url]
325
- Dyndoc::Browser.load(url)
326
- else
327
- Dyndoc::Browser.reload
328
342
  end
329
343
  end
330
344
  end
@@ -83,6 +83,10 @@ def DyndocTasks.dyn_yml(doc)
83
83
  dyntaskname += "_task.dyn" unless dyntaskname=~/_task.dyn$/
84
84
  dyntaskpath=dyntaskname
85
85
  is_dyntask=File.exists? dyntaskpath
86
+ unless is_dyntask
87
+ dyntaskpath=File.join(ENV["HOME"],".dyndoc-world","tasks",dyntaskname)
88
+ is_dyntask=File.exists? dyntaskpath
89
+ end
86
90
  unless is_dyntask
87
91
  dyntaskpath=File.join(ENV["HOME"],"dyndoc","tasks",dyntaskname)
88
92
  is_dyntask=File.exists? dyntaskpath
@@ -0,0 +1,75 @@
1
+ require 'yaml'
2
+
3
+ module DyndocWorld
4
+
5
+ @@root=nil
6
+ @@public=nil
7
+
8
+ def DyndocWorld.root(root=nil)
9
+ @@root=root if root
10
+ return @@root
11
+ end
12
+
13
+ def DyndocWorld.public_root(public_root=nil)
14
+ @@public=public_root if public_root
15
+ return @@public
16
+ end
17
+
18
+ def DyndocWorld.cfg(admin=nil)
19
+ cfg={}
20
+ secret = File.join(DyndocWorld.root,admin ? ".admin.yml" : ".secret.yml")
21
+ cfg = YAML::load_file(secret) if DyndocWorld.root and File.exists? secret
22
+ return cfg
23
+ end
24
+
25
+ ## access ##
26
+ ## prj is to give access for a user or a group of users
27
+ ## if prj or prj/secret is undefined it is accessible
28
+ def DyndocWorld.yml?(prj,yml)
29
+ admin=(prj=="admin")
30
+ cfg=DyndocWorld.cfg(admin)
31
+ cfg=cfg[prj] unless admin
32
+ return true unless cfg
33
+ ##DEBUG: p [:"yml?", cfg, yml, (cfg and yml and ((cfg["secret"] || "none") == (yml["secret"] || "none")) and yml["file"] and !(yml["file"].include? "../"))]
34
+ return (cfg and yml and ((cfg["secret"] || "none") == (yml["secret"] || "none")) and yml["file"] and !(yml["file"].include? "../"))
35
+ end
36
+
37
+ ## file ##
38
+ ## from yml
39
+ ## ex: public/<user>/<pathname>
40
+ ## edit/<user>/<pathname>
41
+ ## dynworld/<user>/<pathname>
42
+ def DyndocWorld.prj_file(yml,content)
43
+ success,prj_file=false,""
44
+ parts=yml["file"].split("/")
45
+ p [:parts,parts]
46
+ root=parts.shift
47
+ p [:root,root]
48
+ if ["public","edit","dynworld"].include? root
49
+ user=parts.shift
50
+ case root
51
+ when "public"
52
+ prj_file=File.join(DyndocWorld.public_root,"users",user)
53
+ prj_file=(Dir.exists? prj_file) ? File.join(prj_file,parts) : ""
54
+ when "edit"
55
+ prj_file=File.join(DyndocWorld.public_root,"users",user,".edit")
56
+ prj_file=(Dir.exists? prj_file) ? File.join(prj_file,parts) : ""
57
+ when "dynworld"
58
+ prj_file=File.join(DyndocWorld.root,user,parts)
59
+ end
60
+ end
61
+ p [:prj_file,prj_file]
62
+ unless prj_file.empty?
63
+ FileUtils.mkdir_p File.dirname prj_file
64
+ File.open(prj_file,"w") {|f|
65
+ if root == "edit"
66
+ f << yml.to_yaml
67
+ f << "---\n"
68
+ end
69
+ f << content.strip
70
+ }
71
+ success=true
72
+ end
73
+ return success
74
+ end
75
+ end
@@ -0,0 +1,54 @@
1
+ #!/bin/bash
2
+
3
+ cmd=$1
4
+ script="bin/.action.sh"
5
+
6
+ RootSrv=/home/ubuntu/RodaSrv
7
+
8
+ echo "## do not modify since automatically generated" > $script
9
+
10
+ case $cmd in
11
+ first)
12
+ ## Not necessary for docker
13
+ #mkdir -p ../../RodaSrv/edit
14
+ #mkdir -p ../../RodaSrv/public/users
15
+ ;;
16
+ init)
17
+ ## Create the RodaSrv folder
18
+ echo "mkdir -p /home/ubuntu/RodaSrv/edit" >> $script
19
+ echo "mkdir -p /home/ubuntu/RodaSrv/public" >> $script
20
+ echo "mkdir -p /home/ubuntu/RodaSrv/system" >> $script
21
+ ## Config file
22
+ echo "echo '---' > /home/ubuntu/dyndoc/etc/dyn-html.yml" >> $script
23
+ echo "echo 'root: /home/ubuntu/RodaSrv' >> /home/ubuntu/dyndoc/etc/dyn-html.yml" >> $script
24
+ docker-compose exec --user ubuntu website bash /home/ubuntu/bin/.action.sh
25
+ ;;
26
+ add)
27
+ # get RodaWebUser from environment variable
28
+ RodaWebUser=$2
29
+ if [ "$RodaWebUser" != "" ]; then
30
+ echo "mkdir -p ${RootSrv}/edit/${RodaWebUser}" >> $script
31
+ echo "mkdir -p ${RootSrv}/public/pages" >> $script
32
+ echo "mkdir -p ${RootSrv}/public/users/${RodaWebUser}/pages/${RodaWebUser}" >> $script
33
+ echo "cd ${RootSrv}/public/pages" >> $script
34
+ echo "ln -s ../users/${RodaWebUser}/pages/${RodaWebUser} ${RodaWebUser}" >> $script
35
+ docker-compose exec --user ubuntu website bash /home/ubuntu/bin/.action.sh
36
+ fi
37
+ ;;
38
+ status | start | stop)
39
+ docker-compose exec --user ubuntu website bash -c "/usr/local/bin/dyn-ctl $cmd"
40
+ ;;
41
+ bash)
42
+ docker-compose exec --user ubuntu website bash
43
+ ;;
44
+ build)
45
+ docker-compose build dyndoc-ruby
46
+ docker-compose build website
47
+ ;;
48
+ up)
49
+ docker-compose up -d website
50
+ ;;
51
+ down)
52
+ docker-compose down
53
+ ;;
54
+ esac
@@ -0,0 +1,31 @@
1
+ FROM ubuntu:$DyndocRubyUbuntu$
2
+ MAINTAINER "Cqls Team"
3
+
4
+ RUN groupadd -r ubuntu && useradd -r -g ubuntu ubuntu
5
+
6
+ RUN apt-get update && \
7
+ apt-get -y install sudo
8
+
9
+ RUN apt-get install -y curl wget locales
10
+
11
+ RUN locale-gen fr_FR.UTF-8
12
+ ENV LANG fr_FR.UTF-8
13
+ ENV LANGUAGE fr_FR:fr
14
+ ENV LC_ALL fr_FR.UTF-8
15
+
16
+ RUN bash -c "$(curl -fs https://cqls.dyndoc.fr/users/RCqls/Dyndoc/install/install-ubuntu16.sh)"
17
+
18
+ EXPOSE 9294
19
+
20
+ WORKDIR /home/ubuntu
21
+
22
+ VOLUME ["/home/ubuntu/bin"]
23
+
24
+ RUN chown -R ubuntu:ubuntu /home/ubuntu
25
+
26
+ USER ubuntu
27
+
28
+ RUN dyn-init
29
+
30
+ RUN dpm install rcqls/DyndocWebTools.dyn
31
+ RUN dpm link rcqls/DyndocWebTools.dyn
@@ -0,0 +1,9 @@
1
+ FROM rcqls/dyndoc-ruby
2
+ MAINTAINER "Cqls Team"
3
+
4
+ USER ubuntu
5
+
6
+ RUN mkdir -p /home/ubuntu/RodaSrv/public/edit
7
+ RUN mkdir -p /home/ubuntu/RodaSrv/public/users
8
+
9
+ ENTRYPOINT /usr/local/bin/dyn-ctl start && /bin/bash
@@ -0,0 +1,21 @@
1
+ version: '2'
2
+
3
+ services:
4
+ dyndoc-ruby:
5
+ build:
6
+ context: DockerFiles
7
+ dockerfile: Dockerfile-dyndoc
8
+ image: rcqls/dyndoc-ruby-$DyndocRubyUbuntu$
9
+
10
+ website:
11
+ build:
12
+ context: DockerFiles
13
+ dockerfile: Dockerfile-website
14
+ restart: always
15
+ volumes:
16
+ - $RodaSrvPublic$:/home/ubuntu/RodaSrv/public
17
+ - $RodaSrvSystem$:/home/ubuntu/RodaSrv/install
18
+ - ./bin:/home/ubuntu/bin
19
+ ports:
20
+ - $RodaSrvPort$:9294
21
+ tty: true
@@ -0,0 +1,167 @@
1
+ #!/bin/bash
2
+
3
+
4
+ RootSrv=$HOME/RodaSrv
5
+
6
+ if [ "$1" = "--root" ];then
7
+ shift
8
+ RootSrv=$1
9
+ if [ $RootSrv = "cfg" ]; then
10
+ RootSrv=`ruby -e 'require "yaml";puts YAML::load_file(File.join(ENV["HOME"],"dyndoc/etc/dyn-html.yml"))["root"]'`
11
+ fi
12
+ shift
13
+ fi
14
+
15
+ Cmd=$1
16
+
17
+ #echo "Command: $Cmd"
18
+
19
+ if [ "$Cmd" = "" ]; then
20
+ Cmd="help"
21
+ fi
22
+
23
+
24
+ case $Cmd in
25
+ set-root)
26
+ new-root=$2
27
+ ## Config file
28
+ echo "---" > $HOME/dyndoc/etc/dyn-html.yml
29
+ echo "root: $new-root" >> $HOME/dyndoc/etc/dyn-html.yml
30
+ ;;
31
+ help)
32
+ echo "Aide:"
33
+ echo "----"
34
+ echo " dyn-site [--root <cfg|ROOT>] first (création de l'arborescence de base)"
35
+ echo " dyn-site [--root <cfg|ROOT>] init [zip|link <PATH>](installation de tools et system)"
36
+ echo " dyn-site [--root <cfg|ROOT>] add <User> (ajout d'un utilisateur <User>)"
37
+ echo " dyn-site [--root <cfg|ROOT>] rebase <Conf> (cas de workshop où <Conf>=<User>)"
38
+ echo " dyn-site [--root <cfg|ROOT>] rebase-subdir <Subdir> <Prj> (Subdir=<User>/<PrjPath>)"
39
+ echo " dyn-site vscode [--update] (install vscode plugin for dyndoc)"
40
+ ## DANGEROUS!: echo " dyn-site set-root <new-root>"
41
+ ;;
42
+ first)
43
+ ## Not necessary for docker
44
+ mkdir -p $RootSrv/edit
45
+ mkdir -p $RootSrv/public/users
46
+ ;;
47
+ init)
48
+ installmode=$2
49
+ case $installmode in
50
+ zip)
51
+ ## Install Specfic stuff inside
52
+ mkdir -p $RootSrv/install/RodaSrvTools
53
+ cd ${RootSrv}/install
54
+ if ! [ -d DynRodaSystem ]; then git clone https://toltex-gogs.dyndoc.fr/rcqls/DynRodaSystem.git; fi
55
+ if ! [ -f RodaSrvTools.zip ]; then
56
+ wget https://toltex-seafile.dyndoc.fr/f/128ced4435/?raw=1 -O RodaSrvTools.zip
57
+ cd RodaSrvTools
58
+ unzip ../RodaSrvTools.zip
59
+ fi
60
+ ## Create links
61
+ cd ${RootSrv}
62
+ ln -sf install/DynRodaSystem system
63
+ cd public
64
+ ln -sf ../install/RodaSrvTools tools
65
+ ;;
66
+ link)
67
+ rodatools_path=$2
68
+ ## Create links
69
+ cd ${RootSrv}
70
+ ln -sf $rodatools_path/system system
71
+ cd public
72
+ ln -sf $rodatools_path/tools tools
73
+ esac
74
+ ;;
75
+ add)
76
+ RodaWebUser=$2
77
+ if [ "$RodaWebUser" != "" ]; then
78
+ mkdir -p ${RootSrv}/edit/${RodaWebUser}
79
+ mkdir -p ${RootSrv}/public/pages
80
+ mkdir -p ${RootSrv}/public/users/${RodaWebUser}/.pages
81
+ cd ${RootSrv}/public/pages
82
+ ln -s ../users/${RodaWebUser}/.pages ${RodaWebUser}
83
+ fi
84
+ ;;
85
+ rebase)
86
+ Conf=$2
87
+ if [ "${Conf}" = "" ]; then
88
+ exit
89
+ fi
90
+ PUBLIC_ROOT="$HOME/RodaSrv/public/users/${Conf}"
91
+ SITE_ROOT="$HOME/RodaSrv/.site/$Conf"
92
+ PAGES_ROOT="$SITE_ROOT/pages"
93
+ mkdir -p ${SITE_ROOT}
94
+ cp -R ${PUBLIC_ROOT}/* ${SITE_ROOT}/
95
+ cd ${PAGES_ROOT}
96
+ pages=$(ls *.html)
97
+ echo "pages to process: $pages"
98
+ for html in $pages
99
+ do
100
+ rebase_url --from /users/$Conf/ --to / $html
101
+ rebase_url --from /$Conf/ --to / $html
102
+ mv $html ..
103
+ done
104
+ cd $SITE_ROOT
105
+ rm -fr pages
106
+ ;;
107
+ rebase-subdir)
108
+ Subdir=$2
109
+ if [ "${Subdir}" = "" ]; then
110
+ echo "Subdir doit être non vide!"
111
+ exit
112
+ fi
113
+ Prj=$3
114
+ if [ "${Prj}" = "" ]; then
115
+ echo "Prj doit être non vide!"
116
+ exit
117
+ fi
118
+ PUBLIC_ASSETS="$HOME/RodaSrv/public/users/${Subdir}/${Prj}"
119
+ PUBLIC_PAGES="$HOME/RodaSrv/public/pages/${Subdir}/${Prj}"
120
+ SITE_ROOT="$HOME/RodaSrv/.site/$Prj"
121
+ PAGES_ROOT="$SITE_ROOT/pages"
122
+ if [ -d ${SITE_ROOT} ]; then
123
+ rm -fr ${SITE_ROOT}
124
+ fi
125
+ mkdir -p ${PAGES_ROOT}
126
+ cp -R ${PUBLIC_PAGES}/* ${PAGES_ROOT}/
127
+ cp -R ${PUBLIC_ASSETS}/* ${SITE_ROOT}/
128
+ cd ${PAGES_ROOT}
129
+ pages=$(find . -name '*.html')
130
+ echo "pages to process: $pages"
131
+ for html in $pages
132
+ do
133
+ rebase_url --from /users/${Subdir}/${Prj}/ --to / $html
134
+ rebase_url --from /${Subdir}/${Prj}/ --to / $html
135
+ done
136
+ cd $SITE_ROOT
137
+ mv pages/* .
138
+ rm -fr pages
139
+ ;;
140
+ vscode)
141
+ if [ -d ~/.vscode/extensions ]; then
142
+ cd ~/.vscode/extensions
143
+ mkdir tmp
144
+ cd tmp
145
+ git clone https://github.com/rcqls/dyndoc-syntax
146
+ cd ..
147
+ if [ -d dyndoc ]; then
148
+ if [ "$2" = "--update" ]; then
149
+ rm -fr dyndoc
150
+ mv tmp/dyndoc-syntax/vscode/dyndoc dyndoc
151
+ rm -fr tmp
152
+ fi
153
+ else
154
+ mv tmp/dyndoc-syntax/vscode/dyndoc dyndoc
155
+ rm -fr tmp
156
+ fi
157
+ fi
158
+ ;;
159
+ # deploy)
160
+ # Conf=$2
161
+ # url="sfdsmqrk@ftp.sfds.asso.fr:$Conf/"
162
+ # if [ "$3" != "" ]; then
163
+ # url="$3"
164
+ # fi
165
+ # rsync -az $SITE_ROOT/* $url
166
+ # ;;
167
+ esac
@@ -10,12 +10,10 @@ cfg.merge! YAML::load_file(cfg_yml) if File.exist? cfg_yml
10
10
  root = cfg["root"] || File.join(ENV["HOME"],"RCqls","RodaServer")
11
11
  $public_root = cfg["public_root"] || File.join(root ,"public")
12
12
  ##p [:public_root,$public_root]
13
- $dynworld_root=cfg["dynworld_root"] || File.join(ENV["HOME"],".dyndoc-world")
14
- $dynworld_tools=cfg["dynworld_tools"] || File.join(ENV["HOME"],"Gogs","dynworld")
15
- if Dir.exists? $dynworld_tools
16
- require File.join($dynworld_tools,"tools.rb")
17
- puts "Dynworld activated"
18
- end
13
+
14
+ require 'dyndoc-world'
15
+ DyndocWorld.root(cfg["dynworld_root"] || File.join(ENV["HOME"],".dyndoc-world"))
16
+ DyndocWorld.public_root($public_root)
19
17
 
20
18
  class App < Roda
21
19
  use Rack::Session::Cookie, :secret => (secret="Thanks like!")
@@ -45,24 +43,19 @@ class App < Roda
45
43
 
46
44
  r.post "file-save" do
47
45
  puts "file-save"
48
- prj,yml,@file,@content=r['prj'].strip,r['yml'].strip,r['file'].strip,r['content']
49
- p [prj,yml,@file,@content]
46
+ prj,yml,@content=r['prj'].strip,r['yml'].strip,r['content']
47
+ p [prj,yml,@content]
50
48
  success=false
51
49
  unless yml.empty?
52
50
  yml="---\n" + yml unless yml[0,4] == "---\n"
53
51
  yml=YAML::load(yml)
54
52
  p [:yml, yml]
55
53
  require 'fileutils'
56
- if @file and !(@file.include? "../") and (DyndocWorld.yml?(prj,yml))
57
- if Dir.exists? $dynworld_root
58
- prj_dir=DyndocWorld.prj_dir(prj,yml)
59
- dynworld_file=File.join($dynworld_root,prj_dir,@file)
60
- FileUtils.mkdir_p File.dirname dynworld_file
61
- File.open(dynworld_file,"w") {|f| f << @content.strip}
62
- success=true
63
- end
54
+ if DyndocWorld.yml?(prj,yml)
55
+ success=DyndocWorld.prj_file(yml,@content)
64
56
  end
65
57
  end
58
+ p [:success, "{success: " + success.to_s + "}"]
66
59
  "{success: " + success.to_s + "}"
67
60
  end
68
61
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dyndoc-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - RCqls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-11 00:00:00.000000000 Z
11
+ date: 2019-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: R4rb
@@ -187,6 +187,8 @@ executables:
187
187
  - dyn-ctl
188
188
  - dyn-4ever
189
189
  - dyn-yml
190
+ - dyn-rebase-url
191
+ - dyn-site
190
192
  extensions: []
191
193
  extra_rdoc_files: []
192
194
  files:
@@ -200,7 +202,9 @@ files:
200
202
  - bin/dyn-http
201
203
  - bin/dyn-init
202
204
  - bin/dyn-lint
205
+ - bin/dyn-rebase-url
203
206
  - bin/dyn-scan
207
+ - bin/dyn-site
204
208
  - bin/dyn-srv
205
209
  - bin/dyn-task
206
210
  - bin/dyn-x
@@ -213,6 +217,7 @@ files:
213
217
  - lib/dyndoc-html-servers.rb
214
218
  - lib/dyndoc-linter.rb
215
219
  - lib/dyndoc-tasks.rb
220
+ - lib/dyndoc-world.rb
216
221
  - lib/dyndoc/cli/interactive-client.rb
217
222
  - lib/dyndoc/srv/interactive-server.rb
218
223
  - lib/dyndoc/srv/tilt.rb
@@ -225,6 +230,11 @@ files:
225
230
  - share/demo/testBeamer.dyn
226
231
  - share/demo/testBeamer_lib.dyn
227
232
  - share/demo/test_atom.dyn
233
+ - share/dyn-site/docker/dyn-site.sh
234
+ - share/dyn-site/docker/files/Dockerfile-dyndoc
235
+ - share/dyn-site/docker/files/Dockerfile-website
236
+ - share/dyn-site/docker/files/docker-compose.yml
237
+ - share/dyn-site/dyn-site.sh
228
238
  - share/dyndoc.yml/README.md
229
239
  - share/dyndoc.yml/example.dyndoc.yml
230
240
  - share/dyntasks/clean_task.dyn