dyndoc-ruby 1.0.21 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/bin/dyn +7 -1
- data/bin/dyn-cli +2 -2
- data/bin/dyn-x +134 -0
- data/bin/dyn-yml +110 -0
- data/lib/dyndoc-convert.rb +3 -0
- data/lib/dyndoc-html-servers.rb +13 -5
- data/lib/dyndoc-linter.rb +5 -0
- data/share/html-srv/dyn-html-srv.ru +84 -8
- metadata +57 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e42fea0e78789262abc853bd7b2b328216b2a5f025a7dfcd161c367d57ceb23d
|
4
|
+
data.tar.gz: b30acf3518b75e7449c85f6a886e7f7b02ddc1fb61054726ba329ee524f3a70b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b0c2d715135a5f40309b679b2dd4e40cbfeb51b38672afeb1015b805693a77085f52ddd1a4ff0ab5511f970fbb161fcc0f74485fb8522dc07d62bfe324712ec
|
7
|
+
data.tar.gz: 1d2b63f650ac19af353cf70f1637e76c96b232234c2f9ccaaaf5f872f53b1eaf9b4066e665f0f80d33f4ed07b38582071a4b6692f4d0a34088f6196ebad123ae
|
data/bin/dyn
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'dyndoc/document'
|
4
4
|
|
5
|
+
puts "bin" ;p $0
|
5
6
|
## p Dyndoc.cfg_dir
|
6
7
|
|
7
8
|
## To be used for remote at the end
|
@@ -35,10 +36,15 @@ OptionParser.new do |opts|
|
|
35
36
|
|
36
37
|
opts.on('-t','--tags TAGS',Array,'filter tags') {|t| Settings["cfg_dyn.tag_tmpl"] = t}
|
37
38
|
|
38
|
-
opts.on('-C',"--
|
39
|
+
opts.on('-C',"--content_only", "content only mode (no header!)") do
|
39
40
|
Settings["cfg_dyn.model_doc"] = "Content"
|
40
41
|
end
|
41
42
|
|
43
|
+
opts.on('-x',"--exec_only", "exec only mode (no document!)") do
|
44
|
+
Settings["cfg_dyn.model_doc"] = "Content"
|
45
|
+
Settings["cfg_dyn.exec_mode"] = "yes"
|
46
|
+
end
|
47
|
+
|
42
48
|
opts.on('-c', '--cmd COMMAND','[a(rchive old)][r(emove old)][s(ave)][pdf(latex)]') {|c|
|
43
49
|
cmd =[:make_content]
|
44
50
|
cmd << :save_old if c.include? "a"
|
data/bin/dyn-cli
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
require 'dyndoc/cli/interactive-client.rb'
|
4
4
|
|
5
5
|
# USAGE:
|
6
|
-
#
|
7
|
-
#
|
6
|
+
# dyn-cli test.dyn[@127.0.0.1] [output_filename.html]
|
7
|
+
# dyn-cli test.dyn,layout.dyn[@127.0.0.1] [output_filename.html]
|
8
8
|
|
9
9
|
next_i=0
|
10
10
|
dyn_tag_tmpl=nil
|
data/bin/dyn-x
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'dyndoc/cli/interactive-client.rb'
|
4
|
+
|
5
|
+
# USAGE:
|
6
|
+
# dyn-x test.dyn[@127.0.0.1]
|
7
|
+
|
8
|
+
next_i=0
|
9
|
+
dyn_tag_tmpl=nil
|
10
|
+
## very limited tags system
|
11
|
+
if ARGV[0] =~ /\-t\=/
|
12
|
+
next_i=1
|
13
|
+
dyn_tag_tmpl="[#<]{#opt]"+ARGV[0][3..-1].strip+"[#opt}"
|
14
|
+
end
|
15
|
+
|
16
|
+
arg=ARGV[next_i]
|
17
|
+
dyn_output=ARGV[next_i + 1]
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
if arg and arg.include? "@"
|
22
|
+
arg,addr=arg.split("@")
|
23
|
+
else
|
24
|
+
addr="127.0.0.1"
|
25
|
+
end
|
26
|
+
|
27
|
+
dyn_file,dyn_layout,dyn_libs,dyn_pre_code,dyn_post_code=nil,nil,nil,nil,nil
|
28
|
+
|
29
|
+
if arg and arg.include? ","
|
30
|
+
dyn_file,dyn_layout=arg.split(",")
|
31
|
+
else
|
32
|
+
dyn_file=arg
|
33
|
+
if i=(dyn_file =~ /\_?(?:html|tex)?\.dyn$/)
|
34
|
+
dyn_layout=dyn_file[0...i]+"_layout.dyn" if File.exist? dyn_file[0...i]+"_layout.dyn"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
if !dyn_layout and File.exist? ".dyn_layout"
|
39
|
+
dyn_layout=File.read(".dyn_layout").strip
|
40
|
+
end
|
41
|
+
|
42
|
+
# Can be extended to other output?
|
43
|
+
if !dyn_layout and dyn_file =~ /\_(?:html|tex)(_[a-z,A-Z,0-9,-]*)\.dyn$/ # I guess this cpuld be very useful!
|
44
|
+
dyn_layout=$1 #layout class (not a path!) defined
|
45
|
+
end
|
46
|
+
|
47
|
+
# If you want a default layout put it inside ~/dyndoc/etc/dyn-cli/dyn_layout
|
48
|
+
if !dyn_layout and File.exist?(etc_dyn_layout=File.join(ENV["HOME"],"dyndoc","etc","dyn-cli","dyn_layout"))
|
49
|
+
dyn_layout=File.read(etc_dyn_layout).strip
|
50
|
+
end
|
51
|
+
|
52
|
+
# dyn library to require automatically
|
53
|
+
if !dyn_libs and File.exist? ".dynlibs"
|
54
|
+
dyn_libs=File.read(".dynlibs").strip
|
55
|
+
end
|
56
|
+
|
57
|
+
if !dyn_libs and File.exist?(etc_dyn_libs=File.join(ENV["HOME"],"dyndoc","etc","dyn-cli","dyn_libs"))
|
58
|
+
dyn_libs=File.read(etc_dyn_libs).strip
|
59
|
+
end
|
60
|
+
|
61
|
+
# very similar to dyn_libs but can preload any dyndoc
|
62
|
+
if i=(dyn_file =~ /\_?(?:html|tex)?\.dyn$/)
|
63
|
+
dyn_pre_code=File.read(dyn_file[0...i]+"_pre.dyn") if File.exist? dyn_file[0...i]+"_pre.dyn"
|
64
|
+
dyn_post_code=File.read(dyn_file[0...i]+"_post.dyn") if File.exist? dyn_file[0...i]+"_post.dyn"
|
65
|
+
end
|
66
|
+
|
67
|
+
if !dyn_pre_code and File.exist?(etc_dyn_pre_code=".dyn_pre_code")
|
68
|
+
etc_dyn_pre_code=File.read(etc_dyn_pre_code).strip
|
69
|
+
dyn_pre_code=File.read(etc_dyn_pre_code) if File.exist? etc_dyn_pre_code
|
70
|
+
end
|
71
|
+
|
72
|
+
if !dyn_libs and File.exist?(etc_dyn_pre_code=File.join(ENV["HOME"],"dyndoc","etc","dyn-cli","dyn_pre_code"))
|
73
|
+
etc_dyn_pre_code=File.read(etc_dyn_pre_code).strip
|
74
|
+
dyn_pre_code=File.read(etc_dyn_pre_code) if File.exist? etc_dyn_pre_code
|
75
|
+
end
|
76
|
+
|
77
|
+
# very similar to dyn_libs but can preload any dyndoc
|
78
|
+
if i=(dyn_file =~ /\_?(?:html|tex)?\.dyn$/)
|
79
|
+
dyn_pre_code=File.read(dyn_file[0...i]+"_pre.dyn") if File.exist? dyn_file[0...i]+"_pre.dyn"
|
80
|
+
dyn_post_code=File.read(dyn_file[0...i]+"_post.dyn") if File.exist? dyn_file[0...i]+"_post.dyn"
|
81
|
+
end
|
82
|
+
|
83
|
+
# similar to pre_code but for post_code
|
84
|
+
if !dyn_post_code and File.exist?(etc_dyn_post_code=".dyn_post_code")
|
85
|
+
etc_dyn_post_code=File.read(etc_dyn_post_code).strip
|
86
|
+
dyn_post_code=File.read(etc_dyn_post_code) if File.exist? etc_dyn_post_code
|
87
|
+
end
|
88
|
+
|
89
|
+
if !dyn_post_code and File.exist?(etc_dyn_post_code=File.join(ENV["HOME"],"dyndoc","etc","dyn-cli","dyn_post_code"))
|
90
|
+
etc_dyn_post_code=File.read(etc_dyn_post_code).strip
|
91
|
+
dyn_post_code=File.read(etc_dyn_post_code) if File.exist? etc_dyn_post_code
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
dyn_file=nil unless dyn_file and File.exist? dyn_file
|
96
|
+
if dyn_layout and !File.exist? dyn_layout
|
97
|
+
dyn_layout_path = ""
|
98
|
+
dyn_layout_path << File.read(etc_dyn_cli_layout_path).strip if File.exist?(etc_dyn_cli_layout_path=File.join(ENV["HOME"],"dyndoc","etc","dyn_cli_layout_path"))
|
99
|
+
dyn_layout_path << (dyn_layout_path.empty? ? "" : ";") << File.join(ENV["HOME"],"dyndoc","etc","dyn-cli","layout")
|
100
|
+
dyn_layouts=dyn_layout_path.split(";").map{|p| (File.exists? (tmp=File.join(p,dyn_layout+".dyn"))) ? tmp : nil }.compact
|
101
|
+
dyn_layout=dyn_layouts[0] #can be nil!
|
102
|
+
end
|
103
|
+
|
104
|
+
if dyn_file
|
105
|
+
code=File.read(dyn_file)
|
106
|
+
if dyn_libs or dyn_pre_code
|
107
|
+
code_pre = ""
|
108
|
+
code_pre += dyn_pre_code + "\n" if dyn_pre_code
|
109
|
+
code_pre += '[#require]'+"\n"+dyn_libs if dyn_libs
|
110
|
+
code = code_pre + '[#main][#>]' + code
|
111
|
+
end
|
112
|
+
code += "\n" + dyn_post_code if dyn_post_code
|
113
|
+
code = dyn_tag_tmpl+code if dyn_tag_tmpl
|
114
|
+
dyndoc_start=[:dyndoc_libs,:dyndoc_layout]
|
115
|
+
## tag tmpl attempt to communicate to the server
|
116
|
+
if dyn_tag_tmpl
|
117
|
+
##TODO: :dyndoc_tag_tmpl to add to dyndoc_start
|
118
|
+
## but also to dyndoc-server-simple.rb
|
119
|
+
end
|
120
|
+
|
121
|
+
cli=Dyndoc::InteractiveClient.new(code,File.expand_path(dyn_file),addr,dyndoc_start)
|
122
|
+
|
123
|
+
if dyn_layout
|
124
|
+
cli=Dyndoc::InteractiveClient.new(File.read(dyn_layout),"",addr) #File.expand_path(dyn_layout),addr)
|
125
|
+
end
|
126
|
+
|
127
|
+
if dyn_output and Dir.exist? File.dirname(dyn_output)
|
128
|
+
File.open(dyn_output,"w") do |f|
|
129
|
+
f << cli.content
|
130
|
+
end
|
131
|
+
else
|
132
|
+
puts cli.content
|
133
|
+
end
|
134
|
+
end
|
data/bin/dyn-yml
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'dyndoc/document'
|
4
|
+
|
5
|
+
args=ARGV.select{|name|
|
6
|
+
if (name[0,2]!="--" and name.include? "=")
|
7
|
+
key,*val=name.split("=")
|
8
|
+
val=val.join("=")
|
9
|
+
Settings["cfg_dyn.user_input"] << [key,val]
|
10
|
+
false
|
11
|
+
else
|
12
|
+
true
|
13
|
+
end
|
14
|
+
}
|
15
|
+
|
16
|
+
args=["-h"] if args.empty?
|
17
|
+
|
18
|
+
require 'optparse'
|
19
|
+
|
20
|
+
OptionParser.new do |opts|
|
21
|
+
opts.banner = "Usage: dyndoc-compile.rb [options]"
|
22
|
+
|
23
|
+
opts.on("-d", "--docs one,two,three", Array, "list of documents to compile") do |list|
|
24
|
+
Settings["cfg_dyn.doc_list"] = list
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on("-f", "--format ", "format of the dyndoc document") do |format|
|
28
|
+
Settings["cfg_dyn.format_doc"] = format.to_sym
|
29
|
+
end
|
30
|
+
|
31
|
+
opts.on('-t','--tags TAGS',Array,'filter tags') {|t| Settings["cfg_dyn.tag_tmpl"] = t}
|
32
|
+
|
33
|
+
opts.on('-C',"--content_only", "content only mode (no header!)") do
|
34
|
+
Settings["cfg_dyn.model_doc"] = "Content"
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on('-x',"--exec_only", "exec only mode (no document!)") do
|
38
|
+
Settings["cfg_dyn.model_doc"] = "Content"
|
39
|
+
Settings["cfg_dyn.exec_mode"] = "yes"
|
40
|
+
end
|
41
|
+
|
42
|
+
opts.on('-c', '--cmd COMMAND','[a(rchive old)][r(emove old)][s(ave)][pdf(latex)]') {|c|
|
43
|
+
cmd =[:make_content]
|
44
|
+
cmd << :save_old if c.include? "a"
|
45
|
+
cmd << :rm_old if c.include? "r"
|
46
|
+
cmd << :save if c.include? "s"
|
47
|
+
## cmd << :cat if c.include? "c"
|
48
|
+
cmd << :pdf if c =~ /(E)?pdf([1-3])?/ #if c.include? "pdf"
|
49
|
+
Settings["cfg_dyn.options.pdflatex_echo"]=true if $1 # useable for log sytem (to introduce possibly later)
|
50
|
+
Settings["cfg_dyn.options.pdflatex_nb_pass"]=$2.to_i if $2
|
51
|
+
## cmd << :png if c.include? "png"
|
52
|
+
## cmd << :view if c.include? "v"
|
53
|
+
## cmd << :save << :view if c.include? "x"
|
54
|
+
## cmd =[:cat] if cmd.empty? #and cfg_dyn[:model_doc]=="content"
|
55
|
+
## cmd = [:pdf] if c=="pdf" #only pdflatex
|
56
|
+
Settings["cfg_dyn.cmd_doc"] = cmd
|
57
|
+
}
|
58
|
+
|
59
|
+
opts.on("-l", "--list", "list of documents available") do
|
60
|
+
Settings["cfg_dyn.cmd_doc"] = [:list]
|
61
|
+
end
|
62
|
+
|
63
|
+
opts.on("-j", "--jl", "import julia") do
|
64
|
+
Settings["cfg_dyn.langs"] << :jl
|
65
|
+
end
|
66
|
+
|
67
|
+
# opts.on("-r", "--remote", "pandoc or pdflatex (dyn)task performed remotely") do
|
68
|
+
# Settings["cfg_dyn.remote_dyntask"] = true
|
69
|
+
# end
|
70
|
+
|
71
|
+
opts.on('-D','--debug','debug mode') do
|
72
|
+
Settings['cfg_dyn.debug']=true
|
73
|
+
end
|
74
|
+
|
75
|
+
opts.on("-p", "--pandoc ", "filter for pandoc (tex2docx,...)") do |f|
|
76
|
+
#p [:pandoc,f]
|
77
|
+
Settings["cfg_dyn.pandoc_filter"] = f
|
78
|
+
end
|
79
|
+
|
80
|
+
# opts.on('--docker',"docker mode") do
|
81
|
+
# Settings["cfg_dyn.docker_mode"]=true
|
82
|
+
# end
|
83
|
+
|
84
|
+
end.parse!(args)
|
85
|
+
|
86
|
+
## ARGV is consumed before except
|
87
|
+
doc=args[0]
|
88
|
+
|
89
|
+
doc += "_dyn.yml" unless doc =~ /_dyn.yml$/
|
90
|
+
require 'yaml'
|
91
|
+
require 'fileutils'
|
92
|
+
|
93
|
+
cfg_yml=YAML::load_file(doc)
|
94
|
+
|
95
|
+
doc =~ /^(.*)_dyn.yml$/
|
96
|
+
docname=$1
|
97
|
+
|
98
|
+
if dyntaskname=cfg_yml["dyntask"]
|
99
|
+
puts dyntaskname
|
100
|
+
if File.exists? dyntaskname
|
101
|
+
dynfile=docname+".dyn"
|
102
|
+
FileUtils.cp dyntaskname, dynfile
|
103
|
+
cfg_yml["params"].each do |key,val|
|
104
|
+
Settings["cfg_dyn.user_input"] << [key,val]
|
105
|
+
end
|
106
|
+
|
107
|
+
d=Dyndoc::TemplateDocument.new(dynfile)
|
108
|
+
d.make_all
|
109
|
+
end
|
110
|
+
end
|
data/lib/dyndoc-convert.rb
CHANGED
@@ -18,6 +18,9 @@ module Dyndoc
|
|
18
18
|
if html_file =~ /^(.*)_(rmd|adoc|ttm)\.html$/
|
19
19
|
html_file = $1+".html"
|
20
20
|
end
|
21
|
+
if html_file =~ /^(.*)_erb\.html$/
|
22
|
+
html_file = $1+".erb"
|
23
|
+
end
|
21
24
|
|
22
25
|
if html_file and Dir.exist? File.dirname(html_file)
|
23
26
|
File.open(html_file,"w") do |f|
|
data/lib/dyndoc-html-servers.rb
CHANGED
@@ -3,10 +3,10 @@ require 'pathname'
|
|
3
3
|
require 'yaml'
|
4
4
|
require 'filewatcher'
|
5
5
|
|
6
|
-
#
|
7
|
-
|
8
|
-
|
9
|
-
#
|
6
|
+
#if RUBY_VERSION >= "2.4"
|
7
|
+
class FileWatcher < Filewatcher
|
8
|
+
end
|
9
|
+
#end
|
10
10
|
|
11
11
|
module Dyndoc
|
12
12
|
module Browser
|
@@ -271,7 +271,7 @@ module Dyndoc
|
|
271
271
|
|
272
272
|
puts "watching "+ dyn_root
|
273
273
|
old_html_file=""
|
274
|
-
::
|
274
|
+
::FileWatcher.new(dyn_root).watch() do |filename, event|
|
275
275
|
##p [:filename,filename,event]
|
276
276
|
if [:changed,:updated,:new].include? event and File.extname(filename) == ".dyn"
|
277
277
|
##p [:filename_event,event,filename]
|
@@ -296,11 +296,19 @@ module Dyndoc
|
|
296
296
|
if html_file =~ /^(.*)_(rmd|adoc|ttm)\.html$/
|
297
297
|
html_file = $1+".html"
|
298
298
|
end
|
299
|
+
if html_file =~ /^(.*)_erb\.html$/
|
300
|
+
erb_page=File.join(pages_root,$1)
|
301
|
+
if File.exists? erb_page+"_erb.html"
|
302
|
+
FileUtils.mv erb_page+"_erb.html",erb_page+".erb"
|
303
|
+
end
|
304
|
+
html_file = "erb"+$1
|
305
|
+
end
|
299
306
|
puts dyn_file[1..-1]+" processed => "+html_file+" created!"
|
300
307
|
options[:first] = html_file != old_html_file
|
301
308
|
if html_file != old_html_file
|
302
309
|
old_html_file = html_file
|
303
310
|
url=File.join(base_url,html_file)
|
311
|
+
## p [:url,url]
|
304
312
|
Dyndoc::Browser.load(url)
|
305
313
|
else
|
306
314
|
Dyndoc::Browser.reload
|
data/lib/dyndoc-linter.rb
CHANGED
@@ -20,6 +20,11 @@ module Dyndoc
|
|
20
20
|
Dyndoc::Linter.simplify_dyndoc_tags(tags)
|
21
21
|
break
|
22
22
|
end
|
23
|
+
if (tags[i][1] == "{@"+tags[i+1][1][2..-2]+"]" and tags[i+1][1] == "[@"+tags[i][1][2..-2]+"}") or (tags[i][1][0]=="{" and tags[i+1][1]=="[@}")
|
24
|
+
tags.delete_at i+1;tags.delete_at i
|
25
|
+
Dyndoc::Linter.simplify_dyndoc_tags(tags)
|
26
|
+
break
|
27
|
+
end
|
23
28
|
end
|
24
29
|
return tags
|
25
30
|
end
|
@@ -20,12 +20,14 @@ class App < Roda
|
|
20
20
|
plugin :multi_route
|
21
21
|
###Dir[File.expand_path("../routes/*.rb",__FILE__)].each{|f| require f}
|
22
22
|
plugin :header_matchers
|
23
|
+
plugin :json
|
24
|
+
plugin :json_parser
|
23
25
|
plugin :render,
|
24
|
-
:views => File.
|
26
|
+
:views => File.join($public_root,"views"),
|
25
27
|
:escape=>true,
|
26
28
|
:check_paths=>true,
|
27
|
-
:allowed_paths=>[File.
|
28
|
-
|
29
|
+
:allowed_paths=>[File.join($public_root,"views"),$public_root]
|
30
|
+
plugin :route_csrf
|
29
31
|
route do |r|
|
30
32
|
|
31
33
|
# GET / request
|
@@ -33,6 +35,18 @@ class App < Roda
|
|
33
35
|
r.redirect "/hello"
|
34
36
|
end
|
35
37
|
|
38
|
+
r.post "dyndoc-yml" do
|
39
|
+
puts "dyndoc-yml"
|
40
|
+
@yml,@content=r['yml'],r['content']
|
41
|
+
p [@yml,@content]
|
42
|
+
require 'fileutils'
|
43
|
+
if @yml
|
44
|
+
dynappsdir=File.join(ENV["HOME"],".dyndoc-apps")
|
45
|
+
File.open(File.join(dynappsdir,@yml),"w") {|f| f << @content.strip} if Dir.exists? dynappsdir
|
46
|
+
end
|
47
|
+
r.redirect "/hello"
|
48
|
+
end
|
49
|
+
|
36
50
|
#r.multi_route
|
37
51
|
|
38
52
|
# /hello branch
|
@@ -77,23 +91,85 @@ class App < Roda
|
|
77
91
|
end
|
78
92
|
=end
|
79
93
|
|
94
|
+
r.on "dropzone" do
|
95
|
+
|
96
|
+
r.post "file-upload" do
|
97
|
+
uploaded_io = r[:file]
|
98
|
+
##
|
99
|
+
p [:uploaded_io, uploaded_io]
|
100
|
+
@upload_dir=r["upload_dir"]
|
101
|
+
p [:file_upload_dir,@upload_dir]
|
102
|
+
# FileUtils.mkdir_p File.join(@upload_dir_root,@upload_dir)
|
103
|
+
# uploaded_io[:filename].gsub("'","_") if uploaded_io[:filename].include? "'"
|
104
|
+
# File.open(File.join(@upload_dir_root,@upload_dir, uploaded_io[:filename]), 'wb') do |file|
|
105
|
+
# file.write(uploaded_io[:tempfile].read)
|
106
|
+
# end
|
107
|
+
"{success: true}"
|
108
|
+
end
|
109
|
+
|
110
|
+
r.post "file-delete" do
|
111
|
+
@upload_dir=r["upload_dir"]
|
112
|
+
p @upload_dir
|
113
|
+
# deleted_file=File.join(@upload_dir_root,@upload_dir,r[:file_name])
|
114
|
+
# ##p deleted_file
|
115
|
+
# FileUtils.rm(deleted_file)
|
116
|
+
"{success: true}"
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
80
121
|
r.get do
|
122
|
+
check_csrf!
|
81
123
|
page=r.remaining_path
|
124
|
+
p [:captures,r.remaining_path,r.captures,r.scope,r.params]
|
82
125
|
static_root=File.join($public_root,"pages")
|
126
|
+
|
127
|
+
## Added for erb
|
128
|
+
is_erb = (page[0...4] == "/erb")
|
129
|
+
if is_erb
|
130
|
+
page=page[4..-1]
|
131
|
+
@params=r.params
|
132
|
+
end
|
133
|
+
|
134
|
+
## Added to protect page
|
135
|
+
protect = nil
|
136
|
+
if (page[0...8] == "/protect")
|
137
|
+
page=page[8..-1]
|
138
|
+
if page =~ /^\/([^\/]*)\/(.*)$/
|
139
|
+
protect, page = $1, '/' + $2
|
140
|
+
end
|
141
|
+
p [:protect, protect, page]
|
142
|
+
end
|
143
|
+
|
83
144
|
##p [:page,File.join(static_root,"**",page+".html")]
|
84
|
-
|
145
|
+
|
146
|
+
pattern=(page=~/[^\.]*\.(?:R|Rmd|css|js|htm|html|rb|red|r|jpeg|jpg|png|gif|pdf)/) ? page : page+(is_erb ? ".erb" : ".html")
|
147
|
+
|
85
148
|
html_files=Dir[File.join(static_root,"**",pattern)]
|
149
|
+
html_files=Dir[File.join(static_root,"*","**",pattern)] if html_files.empty?
|
86
150
|
|
87
151
|
## try index.html in directory
|
88
152
|
html_files=Dir[File.join(static_root,"**",page,"index.html")] if html_files.empty?
|
153
|
+
html_files=Dir[File.join(static_root,"*","**",page,"index.html")] if html_files.empty?
|
154
|
+
|
155
|
+
##DEBUG:
|
156
|
+
# a=File.join(static_root,"**",page,"index.html")
|
157
|
+
# p [a,Dir[a]]
|
158
|
+
# a=File.join(static_root,"*","**",page,"index.html")
|
159
|
+
# p [a,Dir[a]]
|
160
|
+
|
161
|
+
##DEBUG: p html_files
|
89
162
|
|
90
|
-
##p html_files
|
91
163
|
unless html_files.empty?
|
92
164
|
html_file="pages/"+Pathname(html_files[0]).relative_path_from(Pathname(static_root)).to_s
|
93
|
-
if File.extname(html_file)
|
94
|
-
html_file=File.join(File.dirname(html_file),File.basename(html_file,
|
165
|
+
if [".html",".erb"].include? (html_file_ext=File.extname(html_file))
|
166
|
+
html_file=File.join(File.dirname(html_file),File.basename(html_file,html_file_ext))
|
95
167
|
p html_file
|
96
|
-
|
168
|
+
if is_erb
|
169
|
+
erb_yml=File.join($public_root,html_file+"_erb.yml")
|
170
|
+
@cfg_erb=(File.exists? erb_yml) ? YAML::load_file(erb_yml) : {}
|
171
|
+
end
|
172
|
+
render html_file, :engine=> (is_erb ? "erb" : 'html'), :views=>$public_root
|
97
173
|
else
|
98
174
|
r.redirect html_file
|
99
175
|
end
|
metadata
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyndoc-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
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: 2019-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: R4rb
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
17
20
|
- - ">="
|
18
21
|
- !ruby/object:Gem::Version
|
19
22
|
version: 1.0.0
|
@@ -21,6 +24,9 @@ dependencies:
|
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.0'
|
24
30
|
- - ">="
|
25
31
|
- !ruby/object:Gem::Version
|
26
32
|
version: 1.0.0
|
@@ -28,6 +34,9 @@ dependencies:
|
|
28
34
|
name: dyndoc-ruby-core
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '1.0'
|
31
40
|
- - ">="
|
32
41
|
- !ruby/object:Gem::Version
|
33
42
|
version: 1.0.0
|
@@ -35,6 +44,9 @@ dependencies:
|
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.0'
|
38
50
|
- - ">="
|
39
51
|
- !ruby/object:Gem::Version
|
40
52
|
version: 1.0.0
|
@@ -42,6 +54,9 @@ dependencies:
|
|
42
54
|
name: dyndoc-ruby-doc
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '1.0'
|
45
60
|
- - ">="
|
46
61
|
- !ruby/object:Gem::Version
|
47
62
|
version: 1.0.0
|
@@ -49,6 +64,9 @@ dependencies:
|
|
49
64
|
prerelease: false
|
50
65
|
version_requirements: !ruby/object:Gem::Requirement
|
51
66
|
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
52
70
|
- - ">="
|
53
71
|
- !ruby/object:Gem::Version
|
54
72
|
version: 1.0.0
|
@@ -56,6 +74,9 @@ dependencies:
|
|
56
74
|
name: dyndoc-ruby-exec
|
57
75
|
requirement: !ruby/object:Gem::Requirement
|
58
76
|
requirements:
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0.1'
|
59
80
|
- - ">="
|
60
81
|
- !ruby/object:Gem::Version
|
61
82
|
version: 0.1.0
|
@@ -63,6 +84,9 @@ dependencies:
|
|
63
84
|
prerelease: false
|
64
85
|
version_requirements: !ruby/object:Gem::Requirement
|
65
86
|
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.1'
|
66
90
|
- - ">="
|
67
91
|
- !ruby/object:Gem::Version
|
68
92
|
version: 0.1.0
|
@@ -70,6 +94,9 @@ dependencies:
|
|
70
94
|
name: asciidoctor
|
71
95
|
requirement: !ruby/object:Gem::Requirement
|
72
96
|
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '1.5'
|
73
100
|
- - ">="
|
74
101
|
- !ruby/object:Gem::Version
|
75
102
|
version: 1.5.3
|
@@ -77,6 +104,9 @@ dependencies:
|
|
77
104
|
prerelease: false
|
78
105
|
version_requirements: !ruby/object:Gem::Requirement
|
79
106
|
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '1.5'
|
80
110
|
- - ">="
|
81
111
|
- !ruby/object:Gem::Version
|
82
112
|
version: 1.5.3
|
@@ -84,6 +114,9 @@ dependencies:
|
|
84
114
|
name: redcarpet
|
85
115
|
requirement: !ruby/object:Gem::Requirement
|
86
116
|
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '3.3'
|
87
120
|
- - ">="
|
88
121
|
- !ruby/object:Gem::Version
|
89
122
|
version: 3.3.4
|
@@ -91,6 +124,9 @@ dependencies:
|
|
91
124
|
prerelease: false
|
92
125
|
version_requirements: !ruby/object:Gem::Requirement
|
93
126
|
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '3.3'
|
94
130
|
- - ">="
|
95
131
|
- !ruby/object:Gem::Version
|
96
132
|
version: 3.3.4
|
@@ -98,20 +134,29 @@ dependencies:
|
|
98
134
|
name: filewatcher
|
99
135
|
requirement: !ruby/object:Gem::Requirement
|
100
136
|
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '1.0'
|
101
140
|
- - ">="
|
102
141
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
142
|
+
version: 1.0.1
|
104
143
|
type: :runtime
|
105
144
|
prerelease: false
|
106
145
|
version_requirements: !ruby/object:Gem::Requirement
|
107
146
|
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '1.0'
|
108
150
|
- - ">="
|
109
151
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
152
|
+
version: 1.0.1
|
111
153
|
- !ruby/object:Gem::Dependency
|
112
154
|
name: foreverb
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|
114
156
|
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0.3'
|
115
160
|
- - ">="
|
116
161
|
- !ruby/object:Gem::Version
|
117
162
|
version: 0.3.3
|
@@ -119,6 +164,9 @@ dependencies:
|
|
119
164
|
prerelease: false
|
120
165
|
version_requirements: !ruby/object:Gem::Requirement
|
121
166
|
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0.3'
|
122
170
|
- - ">="
|
123
171
|
- !ruby/object:Gem::Version
|
124
172
|
version: 0.3.3
|
@@ -137,6 +185,7 @@ executables:
|
|
137
185
|
- dyn-auto
|
138
186
|
- dyn-ctl
|
139
187
|
- dyn-4ever
|
188
|
+
- dyn-yml
|
140
189
|
extensions: []
|
141
190
|
extra_rdoc_files: []
|
142
191
|
files:
|
@@ -152,6 +201,8 @@ files:
|
|
152
201
|
- bin/dyn-lint
|
153
202
|
- bin/dyn-scan
|
154
203
|
- bin/dyn-srv
|
204
|
+
- bin/dyn-x
|
205
|
+
- bin/dyn-yml
|
155
206
|
- install/README.md
|
156
207
|
- install/dyn-upstart.sh
|
157
208
|
- install/dyndoc_install_ubuntu.sh
|
@@ -429,7 +480,7 @@ files:
|
|
429
480
|
homepage: http://cqls.upmf-grenoble.fr
|
430
481
|
licenses:
|
431
482
|
- MIT
|
432
|
-
- GPL-2
|
483
|
+
- GPL-2.0
|
433
484
|
metadata: {}
|
434
485
|
post_install_message:
|
435
486
|
rdoc_options: []
|
@@ -448,7 +499,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
448
499
|
requirements:
|
449
500
|
- none
|
450
501
|
rubyforge_project:
|
451
|
-
rubygems_version: 2.6
|
502
|
+
rubygems_version: 2.7.6
|
452
503
|
signing_key:
|
453
504
|
specification_version: 4
|
454
505
|
summary: R and Ruby in text document
|