dyndoc-ruby 1.3.4 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dyndoc-html-servers.rb +47 -23
- data/lib/dyndoc-servers-cfg.rb +24 -0
- data/lib/dyndoc-world.rb +81 -0
- data/lib/dyndoc/cli/interactive-client.rb +2 -1
- data/lib/dyndoc/srv/interactive-server.rb +2 -1
- data/share/html-srv/dyn-html-srv.ru +9 -16
- metadata +4 -9
- data/bin/dyn-site +0 -7
- data/share/dyn-site/docker/dyn-site.sh +0 -54
- data/share/dyn-site/docker/files/Dockerfile-dyndoc +0 -31
- data/share/dyn-site/docker/files/Dockerfile-website +0 -9
- data/share/dyn-site/docker/files/docker-compose.yml +0 -21
- data/share/dyn-site/dyn-site.sh +0 -167
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb2f3e831ea517eaff9fc31d345306051d56fb4c2a8c501ffd6e57cacb7e31b1
|
4
|
+
data.tar.gz: 0002b697759d5ada6085ef5ab02040e0e9c83bf19c864fb250ea210382ec5be1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecc7fef24adac129da5b2fe4753d183f62fdbbf31ba4638d2da20e5dbad11d423dc54f329b3caa9b8229985f1e87567e544c3a81530e777f052acc0192b88c3f
|
7
|
+
data.tar.gz: 2169eb881e4d9a25fea6b3d7fd1ce8b791c5708d6c1e6e8ab66c22fb68f2f6c6fea5b442cf3f3e7d11fc60fd0058331650fc5ce5cdb948fe00b1ee4e20f1059c
|
data/lib/dyndoc-html-servers.rb
CHANGED
@@ -2,6 +2,7 @@ require 'dyndoc/init/home'
|
|
2
2
|
require 'pathname'
|
3
3
|
require 'yaml'
|
4
4
|
require 'filewatcher'
|
5
|
+
require 'dyndoc-servers-cfg'
|
5
6
|
|
6
7
|
#if RUBY_VERSION >= "2.4"
|
7
8
|
class FileWatcher < Filewatcher
|
@@ -228,12 +229,15 @@ module Dyndoc
|
|
228
229
|
|
229
230
|
def HtmlServers.dyn_http_server(host=nil,port=nil)
|
230
231
|
require 'thin'
|
231
|
-
dyn_html_srv_ru=
|
232
|
+
dyn_html_srv_ru="/home/ubuntu/tools/dyn-html/srv.ru" # DyndocDockerSite guest-tools folder
|
233
|
+
dyn_html_srv_ru=File.join(ENV["HOME"],"dyndoc","html-srv","dyn.ru") unless File.exists? dyn_html_srv_ru
|
234
|
+
dyn_html_srv_ru=File.expand_path("../../share/html-srv/dyn-html-srv.ru",__FILE__) unless File.exists? dyn_html_srv_ru
|
235
|
+
|
232
236
|
arg=["-R",dyn_html_srv_ru]
|
233
237
|
if HtmlServers.cfg["html-srv-port"]
|
234
238
|
arg += ["-p",HtmlServers.cfg["html-srv-port"].to_s]
|
235
239
|
else
|
236
|
-
arg += ["-p",port ||
|
240
|
+
arg += ["-p",(port || DyndocServers.dyn_http_port? || 9294).to_s]
|
237
241
|
end
|
238
242
|
if host
|
239
243
|
arg += ["-a",host]
|
@@ -245,6 +249,23 @@ module Dyndoc
|
|
245
249
|
Thin::Runner.new(arg).run!
|
246
250
|
end
|
247
251
|
|
252
|
+
def HtmlServers.create_html_page(dyn_file,html_file,opts,pages_root)
|
253
|
+
|
254
|
+
Dyndoc.cli_convert_from_file(dyn_file[1..-1],html_file, opts)
|
255
|
+
## fix html_file for _rmd, _adoc and _ttm
|
256
|
+
if html_file =~ /^(.*)_(rmd|adoc|ttm)\.html$/
|
257
|
+
html_file = $1+".html"
|
258
|
+
end
|
259
|
+
if html_file =~ /^(.*)_erb\.html$/
|
260
|
+
erb_page=File.join(pages_root,$1)
|
261
|
+
if File.exists? erb_page+"_erb.html"
|
262
|
+
FileUtils.mv erb_page+"_erb.html",erb_page+".erb"
|
263
|
+
end
|
264
|
+
html_file = "erb"+$1
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
268
|
+
|
248
269
|
def HtmlServers.dyn_html_filewatcher(cfg={}) #cfg
|
249
270
|
require 'dyndoc-convert'
|
250
271
|
require 'dyndoc-edit'
|
@@ -261,7 +282,7 @@ module Dyndoc
|
|
261
282
|
pages_root = File.join(public_root ,"pages")
|
262
283
|
current_email = cfg["email"] || HtmlServers.cfg["email"] || "rdrouilh@gmail.com" #default email user can be overriden by -u option
|
263
284
|
host=(cfg["html-srv-host"] || HtmlServers.cfg["html-srv-host"] || "http://localhost").to_s
|
264
|
-
port=(cfg["html-srv-port"] || HtmlServers.cfg["html-srv-port"] || "9294").to_s
|
285
|
+
port=(cfg["html-srv-port"] || HtmlServers.cfg["html-srv-port"] || DyndocServers.dyn_http_port? || "9294").to_s
|
265
286
|
base_url= host+":"+port
|
266
287
|
|
267
288
|
opts = {
|
@@ -305,27 +326,30 @@ module Dyndoc
|
|
305
326
|
|
306
327
|
html_file=opts[:html_files][opts[:current_doc_tag]] # No more default # || html_files[""]
|
307
328
|
##p [:opts,opts,:current_doc_tag,opts[:current_doc_tag]]
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
329
|
+
state=""
|
330
|
+
begin
|
331
|
+
HtmlServers.create_html_page(dyn_file,html_file,opts,pages_root)
|
332
|
+
|
333
|
+
puts dyn_file[1..-1]+(dyn_public_edit_file.empty? ? "" : "*")+" processed => "+html_file+" created!"
|
334
|
+
options[:first] = html_file != old_html_file
|
335
|
+
if html_file != old_html_file
|
336
|
+
old_html_file = html_file
|
337
|
+
url=File.join(base_url,html_file)
|
338
|
+
## p [:url,url]
|
339
|
+
Dyndoc::Browser.load(url)
|
340
|
+
else
|
341
|
+
Dyndoc::Browser.reload
|
342
|
+
end
|
343
|
+
rescue => e
|
344
|
+
state="error: #{e.message} =>"
|
345
|
+
ensure
|
346
|
+
notify_file=filename.split("/")
|
347
|
+
if (ind=notify_file.index ".edit")
|
348
|
+
notify_file=notify_file[0..ind].join("/")
|
349
|
+
File.open(notify_file+"/notify.out","w") do |f|
|
350
|
+
f << state + filename
|
351
|
+
end
|
317
352
|
end
|
318
|
-
html_file = "erb"+$1
|
319
|
-
end
|
320
|
-
puts dyn_file[1..-1]+(dyn_public_edit_file.empty? ? "" : "*")+" processed => "+html_file+" created!"
|
321
|
-
options[:first] = html_file != old_html_file
|
322
|
-
if html_file != old_html_file
|
323
|
-
old_html_file = html_file
|
324
|
-
url=File.join(base_url,html_file)
|
325
|
-
## p [:url,url]
|
326
|
-
Dyndoc::Browser.load(url)
|
327
|
-
else
|
328
|
-
Dyndoc::Browser.reload
|
329
353
|
end
|
330
354
|
end
|
331
355
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
module DyndocServers
|
3
|
+
@@cfg=nil
|
4
|
+
@@servers_cfg_file=File.join(ENV["HOME"],".dyndoc-servers.yml")
|
5
|
+
def DyndocServers.cfg
|
6
|
+
unless @@cfg
|
7
|
+
@@cfg=(File.exist? @@servers_cfg_file) ? ::YAML::load_file(@@servers_cfg_file) : {}
|
8
|
+
end
|
9
|
+
@@cfg
|
10
|
+
end
|
11
|
+
|
12
|
+
def DyndocServers.dyn_cli_port?
|
13
|
+
DyndocServers.cfg["ports"] ? @@cfg["ports"]["dyn-cli"] : nil
|
14
|
+
end
|
15
|
+
|
16
|
+
def DyndocServers.dyn_srv_port?
|
17
|
+
DyndocServers.cfg["ports"] ? @@cfg["ports"]["dyn-srv"] : nil
|
18
|
+
end
|
19
|
+
|
20
|
+
def DyndocServers.dyn_http_port?
|
21
|
+
DyndocServers.cfg["ports"] ? @@cfg["ports"]["dyn-http"] : nil
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/dyndoc-world.rb
ADDED
@@ -0,0 +1,81 @@
|
|
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.prj_file?(yml)
|
29
|
+
prj=yml["prj"] || yml["project"] || "default"
|
30
|
+
admin=(prj=="admin")
|
31
|
+
cfg=DyndocWorld.cfg(admin)
|
32
|
+
cfg=cfg[prj] unless admin
|
33
|
+
return nil unless cfg and yml["file"]
|
34
|
+
parts=yml["file"].split("/")
|
35
|
+
p [:parts,parts]
|
36
|
+
root=parts.shift
|
37
|
+
p [:root,root]
|
38
|
+
user=parts.shift
|
39
|
+
##DEBUG: p [:"yml?", cfg, yml, (cfg and yml and ((cfg["secret"] || "none") == (yml["secret"] || "none")) and yml["file"] and !(yml["file"].include? "../"))]
|
40
|
+
if (cfg and yml and ((cfg["secret"] || "none") == (yml["secret"] || "none")) and yml["file"] and !(yml["file"].include? "../")) and ((cfg["users"] || []).include? user)
|
41
|
+
prj_file=nil
|
42
|
+
if ["public","edit","dynworld"].include? root
|
43
|
+
prj_subdir=cfg["subdir"] || ""
|
44
|
+
case root
|
45
|
+
when "public"
|
46
|
+
prj_file=File.join(DyndocWorld.public_root,"users",user)
|
47
|
+
prj_file=(Dir.exists? prj_file) ? File.join(prj_file,prj_subdir,parts) : ""
|
48
|
+
when "edit"
|
49
|
+
prj_file=File.join(DyndocWorld.public_root,"users",user,".edit")
|
50
|
+
prj_file=(Dir.exists? prj_file) ? File.join(prj_file,prj_subdir,parts) : ""
|
51
|
+
when "dynworld"
|
52
|
+
prj_file=File.join(DyndocWorld.root,user,prj_subdir,parts)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
p [:prj_file,prj_file]
|
57
|
+
return prj_file
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
## file ##
|
62
|
+
## from yml
|
63
|
+
## ex: public/<user>/<pathname>
|
64
|
+
## edit/<user>/<pathname>
|
65
|
+
## dynworld/<user>/<pathname>
|
66
|
+
def DyndocWorld.save_prj_file(prj_file,content)
|
67
|
+
FileUtils.mkdir_p File.dirname prj_file
|
68
|
+
File.open(prj_file,"w") {|f|
|
69
|
+
f << content.strip
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
def DyndocWorld.open_prj_file(prj_file)
|
74
|
+
res={success: false}
|
75
|
+
if File.exists? prj_file
|
76
|
+
res[:content]=File.read(prj_file)
|
77
|
+
res[:success]=true
|
78
|
+
end
|
79
|
+
return res
|
80
|
+
end
|
81
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "socket"
|
2
|
+
require 'dyndoc-servers-cfg'
|
2
3
|
|
3
4
|
module Dyndoc
|
4
5
|
|
@@ -11,7 +12,7 @@ module Dyndoc
|
|
11
12
|
## reinit is an array
|
12
13
|
def initialize(cmd,tmpl_filename,addr="127.0.0.1",reinit=[],port=7777)
|
13
14
|
|
14
|
-
@addr,@port,@cmd,@tmpl_filename=addr,port,cmd,tmpl_filename
|
15
|
+
@addr,@port,@cmd,@tmpl_filename=addr,DyndocServers.dyn_cli_port? || port,cmd,tmpl_filename
|
15
16
|
##p [:tmpl_filename,@tmpl_filename,@cmd]
|
16
17
|
## The layout needs to be reintailized for new dyndoc file but not for the layout (of course)!
|
17
18
|
dyndoc_cmd="dyndoc"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'socket' # Get sockets from stdlib
|
2
2
|
require "dyndoc-core"
|
3
3
|
require 'dyndoc-converter'
|
4
|
+
require 'dyndoc-servers-cfg'
|
4
5
|
|
5
6
|
|
6
7
|
module Dyndoc
|
@@ -67,7 +68,7 @@ module Dyndoc
|
|
67
68
|
end
|
68
69
|
|
69
70
|
def init_server
|
70
|
-
@server = TCPServer.new('0.0.0.0',7777)
|
71
|
+
@server = TCPServer.new('0.0.0.0',DyndocServers.dyn_srv_port? || 7777)
|
71
72
|
end
|
72
73
|
|
73
74
|
def run
|
@@ -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
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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,@
|
49
|
-
p [prj,yml,@
|
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
|
57
|
-
|
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.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RCqls
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: R4rb
|
@@ -188,7 +188,6 @@ executables:
|
|
188
188
|
- dyn-4ever
|
189
189
|
- dyn-yml
|
190
190
|
- dyn-rebase-url
|
191
|
-
- dyn-site
|
192
191
|
extensions: []
|
193
192
|
extra_rdoc_files: []
|
194
193
|
files:
|
@@ -204,7 +203,6 @@ files:
|
|
204
203
|
- bin/dyn-lint
|
205
204
|
- bin/dyn-rebase-url
|
206
205
|
- bin/dyn-scan
|
207
|
-
- bin/dyn-site
|
208
206
|
- bin/dyn-srv
|
209
207
|
- bin/dyn-task
|
210
208
|
- bin/dyn-x
|
@@ -216,7 +214,9 @@ files:
|
|
216
214
|
- lib/dyndoc-edit.rb
|
217
215
|
- lib/dyndoc-html-servers.rb
|
218
216
|
- lib/dyndoc-linter.rb
|
217
|
+
- lib/dyndoc-servers-cfg.rb
|
219
218
|
- lib/dyndoc-tasks.rb
|
219
|
+
- lib/dyndoc-world.rb
|
220
220
|
- lib/dyndoc/cli/interactive-client.rb
|
221
221
|
- lib/dyndoc/srv/interactive-server.rb
|
222
222
|
- lib/dyndoc/srv/tilt.rb
|
@@ -229,11 +229,6 @@ files:
|
|
229
229
|
- share/demo/testBeamer.dyn
|
230
230
|
- share/demo/testBeamer_lib.dyn
|
231
231
|
- share/demo/test_atom.dyn
|
232
|
-
- share/dyn-site/docker/dyn-site.sh
|
233
|
-
- share/dyn-site/docker/files/Dockerfile-dyndoc
|
234
|
-
- share/dyn-site/docker/files/Dockerfile-website
|
235
|
-
- share/dyn-site/docker/files/docker-compose.yml
|
236
|
-
- share/dyn-site/dyn-site.sh
|
237
232
|
- share/dyndoc.yml/README.md
|
238
233
|
- share/dyndoc.yml/example.dyndoc.yml
|
239
234
|
- share/dyntasks/clean_task.dyn
|
data/bin/dyn-site
DELETED
@@ -1,54 +0,0 @@
|
|
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
|
@@ -1,31 +0,0 @@
|
|
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
|
@@ -1,21 +0,0 @@
|
|
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
|
data/share/dyn-site/dyn-site.sh
DELETED
@@ -1,167 +0,0 @@
|
|
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
|