dyndoc-ruby-core 1.5.3 → 1.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dyndoc/Std/File.dyn +1 -1
- data/dyndoc/Std/Test.dyn +8 -8
- data/dyndoc/Tools/R/Fig.dyn +5 -5
- data/dyndoc/Tools/Tex/Verb.dyn +1 -1
- data/dyndoc/Tools/Web/Html.dyn +1 -1
- data/lib/dyndoc/base/envir.rb +2 -2
- data/lib/dyndoc/base/filter/filter_mngr.rb +9 -11
- data/lib/dyndoc/base/filter/server.rb +3 -3
- data/lib/dyndoc/base/tags/part_tag.rb +3 -3
- data/lib/dyndoc/base/tags/tag_mngr.rb +2 -2
- data/lib/dyndoc/base/tmpl/eval.rb +1 -1
- data/lib/dyndoc/base/utils.rb +5 -5
- data/lib/dyndoc/common/file.rb +1 -1
- data/lib/dyndoc/common/utils.rb +6 -6
- data/lib/dyndoc/common/uv.rb +1 -1
- data/lib/dyndoc/init/config.rb +11 -11
- data/lib/dyndoc/init/home.rb +1 -1
- data/lib/dyndoc/plugins/tex/tex_eval.rb +2 -2
- data/lib/dyndoc-core.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fb6e0f32f5d4c083d5cfabc088dd66daf5253f27934cc7298b0d8a211c36170
|
4
|
+
data.tar.gz: 9c9409f0ee35b5bf599732c597e51477232c0c5e36f04c0d9b378ad912d14ae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fd360190c30ac2b18e141a90dd27eb25d788e3090aaf4f0302bc4f038a10bbd5cdd303af28ac18f5ea1fc1f44eec1d9a3d3ad9c7cb71556f7a7597b70a25dff
|
7
|
+
data.tar.gz: e436d46917f463898664264590dfcabb9ad273fb4654c375983be25a344ea52fd7d6033387a5281eddbe8ea7c1baf3d1922c06ab28af07905a8fa5271c73f0bf
|
data/dyndoc/Std/File.dyn
CHANGED
@@ -31,7 +31,7 @@ This doc mode is used to know if it is obtained by web
|
|
31
31
|
[#}
|
32
32
|
|
33
33
|
{#def]cqlsweb_path[#,]path[][#,]root[/export/cqlsWeb]
|
34
|
-
[#rb>]dyndocWeb_path=(File.
|
34
|
+
[#rb>]dyndocWeb_path=(File.exist? File.join(ENV["HOME"],"dyndoc","web")) ? File.join(ENV["HOME"],"dyndoc","web") : #{=root}
|
35
35
|
File.join(dyndocWeb_path,#{=path})
|
36
36
|
[#def}
|
37
37
|
|
data/dyndoc/Std/Test.dyn
CHANGED
@@ -142,9 +142,9 @@ Object for testing dyn code
|
|
142
142
|
[#rb<]
|
143
143
|
expectedFile=File.join(#{=.dir},<key:>)
|
144
144
|
|
145
|
-
<expected:> = File.read(expectedFile) if <expected:>.empty? and File.
|
145
|
+
<expected:> = File.read(expectedFile) if <expected:>.empty? and File.exist?(expectedFile)
|
146
146
|
|
147
|
-
unless File.
|
147
|
+
unless File.exist?(expectedFile)
|
148
148
|
File.open(expectedFile,"w") do |f|
|
149
149
|
#puts "result"; p #{=result}
|
150
150
|
f << <result:>
|
@@ -165,9 +165,9 @@ end
|
|
165
165
|
[#rb<]
|
166
166
|
expectedFile=File.join(#{=.dir},<key:>)
|
167
167
|
|
168
|
-
<expected:> = File.read(expectedFile) if <expected:>.empty? and File.
|
168
|
+
<expected:> = File.read(expectedFile) if <expected:>.empty? and File.exist?(expectedFile)
|
169
169
|
|
170
|
-
unless File.
|
170
|
+
unless File.exist?(expectedFile)
|
171
171
|
File.open(expectedFile,"w") do |f| #do not remove!!!!!
|
172
172
|
#puts "result"; p #{=result}
|
173
173
|
f << <result:>
|
@@ -189,18 +189,18 @@ result=File.join(#{=.dir},<key:>+".png")
|
|
189
189
|
[#rb<]
|
190
190
|
unless <expected:>.empty?
|
191
191
|
tmpExpected=File.join(#{=.dir},<expected:>)
|
192
|
-
<expected:> = tmpExpected if !File.
|
192
|
+
<expected:> = tmpExpected if !File.exist?(<expected:>) and File.exist?(tmpExpected)
|
193
193
|
else
|
194
194
|
tmpExpected = File.join(#{=.dir},<key:>+"-expected.png")
|
195
|
-
if File.
|
195
|
+
if File.exist? tmpExpected
|
196
196
|
<expected:> = tmpExpected
|
197
|
-
elsif File.
|
197
|
+
elsif File.exist?(result)
|
198
198
|
<expected:> = tmpExpected
|
199
199
|
require 'fileutils'
|
200
200
|
FileUtils.cp(result,<expected:>)
|
201
201
|
end
|
202
202
|
end
|
203
|
-
raise "Boom! expected image file "+<expected:>+" does not exists!" unless File.
|
203
|
+
raise "Boom! expected image file "+<expected:>+" does not exists!" unless File.exist?(<expected:>)
|
204
204
|
<.tests@> << <key:>
|
205
205
|
#p <.codes@>
|
206
206
|
<.report@>[<key:>]={:type=>:imgR,:code=>code,:expected=> <expected:> ,:result=> result,:file=> <file:>,:descr => <descr:>}
|
data/dyndoc/Tools/R/Fig.dyn
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
[#rb<]
|
25
25
|
require 'fileutils'
|
26
26
|
imgdir=File.expand_path(File.dirname(#{=img}))
|
27
|
-
FileUtils.mkdir_p(imgdir) unless File.
|
27
|
+
FileUtils.mkdir_p(imgdir) unless File.exist? imgdir
|
28
28
|
rcode=#{=rcode}.strip
|
29
29
|
Utils.clean_eol(rcode)
|
30
30
|
[#rb>]img[File.expand_path(#{=img})]
|
@@ -34,7 +34,7 @@
|
|
34
34
|
:{rcode}
|
35
35
|
dev.off()
|
36
36
|
}[#in]#{Renvir}[#}
|
37
|
-
[#?] #{include} [#>]{#if]{#dyndoc_mode#} == :web[#>]{#if](File.
|
37
|
+
[#?] #{include} [#>]{#if]{#dyndoc_mode#} == :web[#>]{#if](File.exist? #{=img}) and (File.stat(#{=img}).size>0)[#>]<img src="{#cqlsweb_public_imgName]#{img}[#}" alt="rfig"/>[#else]<p>Error in the following figure R code!</p><code><pre>:{rcode}</pre></code>[#if}[#else][\includegraphics[#{optTex}]{#{img}}][#if}
|
38
38
|
[#}
|
39
39
|
|
40
40
|
{#hide] WITH SHORTHANDOFF
|
@@ -59,7 +59,7 @@
|
|
59
59
|
[#rb<]
|
60
60
|
require 'fileutils'
|
61
61
|
imgdir=File.expand_path(File.dirname(#{=img}))
|
62
|
-
FileUtils.mkdir_p(imgdir) unless File.
|
62
|
+
FileUtils.mkdir_p(imgdir) unless File.exist? imgdir
|
63
63
|
rcode=#{=rcode}.strip
|
64
64
|
Utils.clean_eol(rcode)
|
65
65
|
[#rb>]img[File.expand_path(#{=img})]
|
@@ -71,7 +71,7 @@
|
|
71
71
|
:{rcode}
|
72
72
|
dev.off()
|
73
73
|
}[#in]#{Renvir}[#}
|
74
|
-
[#?] #{include} [#>]{#if]{#dyndoc_mode#} == :web[#>]{#if](File.
|
74
|
+
[#?] #{include} [#>]{#if]{#dyndoc_mode#} == :web[#>]{#if](File.exist? #{=img}) and (File.stat(#{=img}).size>0)[#>]<img src="{#cqlsweb_public_imgName]#{img}[#}" alt="rfig"/>[#else]<p>Error in the following figure R code!</p><code><pre>:{rcode}</pre></code>[#if}[#else][{#if]#{shorthandoff}==:ok[#>]{\shorthandoff{:}[#if}\includegraphics[#{optTex}]{#{img}}{#if]#{shorthandoff}==:ok[#>]}[#if}][#if}
|
75
75
|
[#} [#hide}
|
76
76
|
|
77
77
|
|
@@ -129,7 +129,7 @@
|
|
129
129
|
[#rb<]
|
130
130
|
require 'fileutils'
|
131
131
|
imgdir=File.expand_path("~/dyndoc/tmp")
|
132
|
-
FileUtils.mkdir_p(imgdir) unless File.
|
132
|
+
FileUtils.mkdir_p(imgdir) unless File.exist? imgdir
|
133
133
|
rcode=#{=rcode}.strip
|
134
134
|
Utils.clean_eol(rcode)
|
135
135
|
img=File.join(imgdir,"last.svg")
|
data/dyndoc/Tools/Tex/Verb.dyn
CHANGED
@@ -4,7 +4,7 @@ Pour package latex réfléchir comment faire?
|
|
4
4
|
[#rb<]
|
5
5
|
syntax,render=#{=syntax}.strip.downcase,#{=render}.strip
|
6
6
|
#Dyndoc.warn "Syntax", syntax,render
|
7
|
-
#if File.
|
7
|
+
#if File.exist? File.join(ENV["HOME"],"dyndoc","share","uv")
|
8
8
|
#require File.join(ENV["HOME"],"dyndoc","share","uv","uv")
|
9
9
|
require 'dyndoc/common/uv'
|
10
10
|
syntax=File.join(Uv.syntax_path,syntax+".syntax")
|
data/dyndoc/Tools/Web/Html.dyn
CHANGED
@@ -41,7 +41,7 @@ To test the different format! (see method format for TemplateManager in parse_do
|
|
41
41
|
[#rb<]#require "uv"
|
42
42
|
syntax,render=#{=syntax}.strip.downcase,#{=render}.strip
|
43
43
|
## Dyndoc.warn "syntax",syntax
|
44
|
-
#if File.
|
44
|
+
#if File.exist? File.join(ENV["HOME"],"dyndoc","share","uv")
|
45
45
|
#require File.join(ENV["HOME"],"dyndoc","share","uv","uv")
|
46
46
|
require 'dyndoc/common/uv'
|
47
47
|
syntax=File.join(Uv.syntax_path,syntax+".syntax")
|
data/lib/dyndoc/base/envir.rb
CHANGED
@@ -103,8 +103,8 @@ module Dyndoc
|
|
103
103
|
# ACCESS Envir ###############################
|
104
104
|
|
105
105
|
##########################
|
106
|
-
# return curElt if
|
107
|
-
# return curEnv if
|
106
|
+
# return curElt if exist? and text
|
107
|
+
# return curEnv if exist? and !text
|
108
108
|
# if text then check if the element is textElt
|
109
109
|
##########################
|
110
110
|
def Envir.elt_defined?(envir,keys,text=nil)
|
@@ -378,8 +378,7 @@ module Dyndoc
|
|
378
378
|
$dyn_logger.write("ERROR R: #{txt} was not properly evaluated!\n") unless Dyndoc.cfg_dyn[:dyndoc_mode]==:normal
|
379
379
|
res=txt
|
380
380
|
end
|
381
|
-
#
|
382
|
-
puts "#{txt} in #{@rEnvir[0]} is #{res}"
|
381
|
+
#puts "#{txt} in #{@rEnvir[0]} is #{res}"
|
383
382
|
when ":r","#r"
|
384
383
|
return txt if @mode==:pre
|
385
384
|
res=RServer.safe_output(txt2,@rEnvir[0],:pretty=>true)
|
@@ -388,8 +387,7 @@ module Dyndoc
|
|
388
387
|
$dyn_logger.write("ERROR R: #{txt} was not properly evaluated!\n") unless Dyndoc.cfg_dyn[:dyndoc_mode]==:normal
|
389
388
|
res=txt
|
390
389
|
end
|
391
|
-
#
|
392
|
-
puts "#{txt} in #{@rEnvir[0]} is #{res}"
|
390
|
+
#puts "#{txt} in #{@rEnvir[0]} is #{res}"
|
393
391
|
when ":jl","#jl"
|
394
392
|
return txt if @mode==:pre
|
395
393
|
## puts "#jl:"+txt2
|
@@ -540,14 +538,14 @@ module Dyndoc
|
|
540
538
|
return res unless out_type
|
541
539
|
case out_type
|
542
540
|
when ":=",":rb=",":Rb=","#rb=","#Rb="
|
543
|
-
|
544
|
-
|
545
|
-
#puts out_type;p res;p res.inspect
|
546
|
-
|
547
|
-
|
548
|
-
|
541
|
+
# if res.is_a? String
|
542
|
+
# res.inspect
|
543
|
+
# #puts out_type;p res;p res.inspect
|
544
|
+
# elsif res.is_a? Array and res.length==1
|
545
|
+
# res[0].inspect
|
546
|
+
# else
|
549
547
|
res.inspect
|
550
|
-
end
|
548
|
+
# end
|
551
549
|
when ":",":rb",":Rb","#rb","#Rb"
|
552
550
|
#puts "convert [rb]:";p res
|
553
551
|
if res.is_a? Array
|
@@ -585,7 +585,7 @@ module Dyndoc
|
|
585
585
|
evalOk &= (R4rb << cod )
|
586
586
|
}
|
587
587
|
end
|
588
|
-
cptImg += 1 if File.
|
588
|
+
cptImg += 1 if File.exist? imgfile+(cptImg+1).to_s+".#{@@device}"
|
589
589
|
#p evalOk;p code;R4rb << "print(geterrmessage())";R4rb << "if(exists(\".output\") ) print(.output)"
|
590
590
|
if evalOk
|
591
591
|
txt=(@@out < '.output' ) ##.join("\n").split(/\n/)
|
@@ -648,7 +648,7 @@ module Dyndoc
|
|
648
648
|
R4rb << "dev.off()"
|
649
649
|
imgCopy.each{|e|
|
650
650
|
FileUtils.mkdir_p File.dirname(e[:out]) unless File.exist? File.dirname(e[:out])
|
651
|
-
if File.
|
651
|
+
if File.exist? e[:in]
|
652
652
|
FileUtils.mv(e[:in],e[:out])
|
653
653
|
else
|
654
654
|
Dyndoc.warn "WARNING! #{e[:in]} does not exists for #{e[:out]}"
|
@@ -807,7 +807,7 @@ module Dyndoc
|
|
807
807
|
def RServer.init_filter
|
808
808
|
dyndocTools="~/dyndoc" #Same as DYNDOCROOT as default
|
809
809
|
# DYNDOCTOOLS is possibly defined inside the launcher of DyndocStudio (Mac and linux).
|
810
|
-
dyndocTools=ENV["DYNDOCTOOLS"] if ENV["DYNDOCTOOLS"] and File.
|
810
|
+
dyndocTools=ENV["DYNDOCTOOLS"] if ENV["DYNDOCTOOLS"] and File.exist? ENV["DYNDOCTOOLS"]
|
811
811
|
## if RUBY_ENGINE (ruby,jruby,rbx) defined (actually, not defined for 1.8.7)
|
812
812
|
if Object.constants.map{|e| e.to_s}.include? "RUBY_ENGINE"
|
813
813
|
version = RbConfig::CONFIG["exec_prefix"].split(File::Separator)[-1]
|
@@ -12,12 +12,12 @@ module Dyndoc
|
|
12
12
|
## global aliases
|
13
13
|
@@alias=""
|
14
14
|
@@sys_alias=File.join(Dyndoc.cfg_dir[:sys],"alias")
|
15
|
-
@@alias << File.read(@@sys_alias).chomp << "\n" if File.
|
15
|
+
@@alias << File.read(@@sys_alias).chomp << "\n" if File.exist? @@sys_alias
|
16
16
|
@@home_alias=File.join(Dyndoc.cfg_dir[:home],'alias')
|
17
|
-
@@alias << File.read(@@home_alias).chomp << "\n" if File.
|
17
|
+
@@alias << File.read(@@home_alias).chomp << "\n" if File.exist? @@home_alias
|
18
18
|
if Dyndoc.cfg_dir[:file]
|
19
19
|
@@file_alias=File.join(Dyndoc.cfg_dir[:file],'.dyn_alias')
|
20
|
-
@@alias << File.read(@@file_alias).chomp << "\n" if File.
|
20
|
+
@@alias << File.read(@@file_alias).chomp << "\n" if File.exist? @@file_alias
|
21
21
|
end
|
22
22
|
PartTag.make_alias(aliases,@@alias.chomp.split("\n"))
|
23
23
|
end
|
@@ -12,10 +12,10 @@ module Dyndoc
|
|
12
12
|
## global aliases
|
13
13
|
@@alias=""
|
14
14
|
@@etc_alias=File.join(Dyndoc.cfg_dir[:etc],"alias")
|
15
|
-
@@alias << File.read(@@etc_alias).chomp << "\n" if File.
|
15
|
+
@@alias << File.read(@@etc_alias).chomp << "\n" if File.exist? @@etc_alias
|
16
16
|
if Dyndoc.cfg_dir[:file]
|
17
17
|
@@file_alias=File.join(Dyndoc.cfg_dir[:file],'.dyn_alias')
|
18
|
-
@@alias << File.read(@@file_alias).chomp << "\n" if File.
|
18
|
+
@@alias << File.read(@@file_alias).chomp << "\n" if File.exist? @@file_alias
|
19
19
|
end
|
20
20
|
TagManager.make_alias(aliases,@@alias.chomp.split("\n"))
|
21
21
|
end
|
@@ -202,7 +202,7 @@ module Dyndoc
|
|
202
202
|
=end
|
203
203
|
# REPLACEMENT of ABOVE!
|
204
204
|
unless @libs.keys.include? tmpl
|
205
|
-
if tmpl and File.
|
205
|
+
if tmpl and File.exist? tmpl
|
206
206
|
input=Dyndoc.read_content_file(tmpl)
|
207
207
|
@libs[tmpl]=input
|
208
208
|
filter.envir["_FILENAME_"]=tmpl.dup #register name of template!!!
|
data/lib/dyndoc/base/utils.rb
CHANGED
@@ -273,8 +273,8 @@ module Dyndoc
|
|
273
273
|
def Utils.saved_content_fetch_variables_from_file(filename,tmplMngr=nil)
|
274
274
|
return unless tmplMngr
|
275
275
|
#p filename
|
276
|
-
return unless out_rsrc=Dyndoc::Utils.
|
277
|
-
return unless File.
|
276
|
+
return unless out_rsrc=Dyndoc::Utils.out_rsrc_exist?(filename)
|
277
|
+
return unless File.exist?(saved_contents_file=File.join(out_rsrc,SAVED_CONTENTS_FILE)) ##normally, autogenerated!
|
278
278
|
#p out_rsrc
|
279
279
|
## fetch the contents by reading and parsing unsing the global filter!
|
280
280
|
#puts "saved_contents_file";p saved_contents_file
|
@@ -297,7 +297,7 @@ module Dyndoc
|
|
297
297
|
def Utils.saved_content_add_as_variable(var,result,filename) #var is dyndoc variable
|
298
298
|
##p filename
|
299
299
|
out_rsrc=Dyndoc::Utils.mkdir_out_rsrc(filename)
|
300
|
-
unless File.
|
300
|
+
unless File.exist? File.join(out_rsrc,SAVED_CONTENTS_FILE)
|
301
301
|
File.open(File.join(out_rsrc,SAVED_CONTENTS_FILE),"a") do |f|
|
302
302
|
f << "[#%] File automatically generated! Remove it for regenerating it!\n"
|
303
303
|
end
|
@@ -311,8 +311,8 @@ module Dyndoc
|
|
311
311
|
end
|
312
312
|
|
313
313
|
def Utils.saved_content_delete_as_variable(var,filename)
|
314
|
-
return unless out_rsrc=Dyndoc::Utils.
|
315
|
-
return unless File.
|
314
|
+
return unless out_rsrc=Dyndoc::Utils.out_rsrc_exist?(filename)
|
315
|
+
return unless File.exist?(saved_contents_file=File.join(out_rsrc,SAVED_CONTENTS_FILE))
|
316
316
|
saved_contents=File.read(saved_contents_file)
|
317
317
|
## Normally, no problem since no [#=] inside result!
|
318
318
|
saved_contents_new=saved_contents.gsub(/\[\#\=\]\s*#{var}\s*\[.*\]\s*\[\#\=\]/m,"[#=]")
|
data/lib/dyndoc/common/file.rb
CHANGED
@@ -12,7 +12,7 @@ module Dyndoc
|
|
12
12
|
|
13
13
|
def Dyndoc.find_subpath_before(subpath,before)
|
14
14
|
l=before.length+1
|
15
|
-
return [before[0..l],subpath] if File.
|
15
|
+
return [before[0..l],subpath] if File.exist? File.join(before[0..l],subpath) while (l-=1)>=0
|
16
16
|
return nil
|
17
17
|
end
|
18
18
|
|
data/lib/dyndoc/common/utils.rb
CHANGED
@@ -18,20 +18,20 @@ module Dyndoc
|
|
18
18
|
end
|
19
19
|
|
20
20
|
module Utils
|
21
|
-
def Utils.
|
21
|
+
def Utils.cfg_file_exist?(tmpl)
|
22
22
|
name=File.join(File.dirname(tmpl),File.basename(tmpl,".*"))
|
23
|
-
([".cfg_dyn",".dyn_cfg"].map{|ext| name+ext}.select{|f| File.
|
23
|
+
([".cfg_dyn",".dyn_cfg"].map{|ext| name+ext}.select{|f| File.exist? f})[0]
|
24
24
|
end
|
25
25
|
|
26
|
-
def Utils.
|
26
|
+
def Utils.lib_file_exist?(tmpl)
|
27
27
|
name=File.join(File.dirname(tmpl),File.basename(tmpl,".*"))
|
28
|
-
(["_lib.dyn",".dyn_lib"].map{|ext| name+ext}.select{|f| File.
|
28
|
+
(["_lib.dyn",".dyn_lib"].map{|ext| name+ext}.select{|f| File.exist? f})[0]
|
29
29
|
end
|
30
30
|
|
31
|
-
def Utils.
|
31
|
+
def Utils.out_rsrc_exist?(tmpl)
|
32
32
|
name=File.join(File.dirname(tmpl),File.basename(tmpl,".*"))
|
33
33
|
## if not a directory it is the zipped version! TODO!
|
34
|
-
([".dyn_out",".dyn_rsrc"].map{|ext| name+ext}.select{|f| File.
|
34
|
+
([".dyn_out",".dyn_rsrc"].map{|ext| name+ext}.select{|f| File.exist? f})[0]
|
35
35
|
end
|
36
36
|
|
37
37
|
def Utils.mkdir_out_rsrc(tmpl)
|
data/lib/dyndoc/common/uv.rb
CHANGED
@@ -32,7 +32,7 @@ module Dyndoc
|
|
32
32
|
def self.load(output, style = nil, line_numbers = false, headers = false)
|
33
33
|
style ||= Uv.default_style
|
34
34
|
renderer = File.join( Uv.render_path, output,"#{style}.render")
|
35
|
-
raise( ArgumentError, "Output for #{output} in #{style} style is not yet implemented" ) unless File.
|
35
|
+
raise( ArgumentError, "Output for #{output} in #{style} style is not yet implemented" ) unless File.exist?(renderer)
|
36
36
|
options = YAML.load_file(renderer)
|
37
37
|
processor = RenderProcessor.new(options, line_numbers, headers)
|
38
38
|
yield processor if block_given?
|
data/lib/dyndoc/init/config.rb
CHANGED
@@ -83,7 +83,7 @@ module Dyndoc
|
|
83
83
|
def Dyndoc.init_dyndoc_library_path
|
84
84
|
|
85
85
|
[File.join(FileUtils.pwd,".dyndoc_library_path"),File.join(FileUtils.pwd,"dyndoc_library_path.txt"),File.join(@@cfg_dir[:etc],"dyndoc_library_path")].each do |dyndoc_library_path|
|
86
|
-
if File.
|
86
|
+
if File.exist? dyndoc_library_path
|
87
87
|
path=File.read(dyndoc_library_path).strip
|
88
88
|
path=path.split(Dyndoc::PATH_SEP).map{|pa| File.expand_path(pa)}.join(Dyndoc::PATH_SEP)
|
89
89
|
if !ENV["DYNDOC_LIBRARY_PATH"] or ENV["DYNDOC_LIBRARY_PATH"].empty?
|
@@ -140,11 +140,11 @@ module Dyndoc
|
|
140
140
|
@@append={}
|
141
141
|
tmp=[]
|
142
142
|
sys_append=File.join( @@cfg_dir[:etc],"alias")
|
143
|
-
tmp += File.readlines(sys_append) if File.
|
143
|
+
tmp += File.readlines(sys_append) if File.exist? sys_append
|
144
144
|
home_append=File.join(@@cfg_dir[:etc],'alias')
|
145
|
-
tmp += File.readlines(home_append) if File.
|
145
|
+
tmp += File.readlines(home_append) if File.exist? home_append
|
146
146
|
file_append=File.join(@@cfg_dir[:file],'.dyn_alias')
|
147
|
-
tmp += File.readlines(file_append) if File.
|
147
|
+
tmp += File.readlines(file_append) if File.exist? file_append
|
148
148
|
tmp.map{|l|
|
149
149
|
if l.include? ">"
|
150
150
|
l2=l.strip
|
@@ -159,14 +159,14 @@ module Dyndoc
|
|
159
159
|
## more useable than this !!!
|
160
160
|
def Dyndoc.absolute_path(filename,pathenv)
|
161
161
|
#puts "ici";p filename
|
162
|
-
return filename if File.
|
162
|
+
return filename if File.exist? filename
|
163
163
|
paths=pathenv##.split(":")
|
164
164
|
#puts "absolute_path:filname";p filename
|
165
165
|
name=nil
|
166
166
|
paths.each{|e|
|
167
167
|
f=File.expand_path(File.join([e,filename]))
|
168
168
|
#p f
|
169
|
-
if (File.
|
169
|
+
if (File.exist? f)
|
170
170
|
name=f
|
171
171
|
break
|
172
172
|
end
|
@@ -220,11 +220,11 @@ module Dyndoc
|
|
220
220
|
## dynamically get pathenv!!!!
|
221
221
|
def Dyndoc.get_pathenv(rootDoc=nil,with_currentRoot=true)
|
222
222
|
pathenv = Dyndoc.init_pathenv
|
223
|
-
pathenv += PATH_SEP + File.join(@@dyn_gem_path,"dyndoc") + PATH_SEP + File.join(@@dyn_gem_path,"dyndoc","Std") if File.
|
223
|
+
pathenv += PATH_SEP + File.join(@@dyn_gem_path,"dyndoc") + PATH_SEP + File.join(@@dyn_gem_path,"dyndoc","Std") if File.exist? File.join(@@dyn_gem_path,"dyndoc")
|
224
224
|
# high level of priority since provided by user
|
225
225
|
pathenv += PATH_SEP + Dyndoc.user_root_doc if Dyndoc.user_root_doc
|
226
226
|
pathenv += PATH_SEP + ENV["DYNDOC_LIBRARY_PATH"] if ENV["DYNDOC_LIBRARY_PATH"] and !ENV["DYNDOC_LIBRARY_PATH"].empty?
|
227
|
-
pathenv += PATH_SEP + File.join(Dyndoc.cfg_dir[:root_path],"library") if File.
|
227
|
+
pathenv += PATH_SEP + File.join(Dyndoc.cfg_dir[:root_path],"library") if File.exist? File.join(@@cfg_dir[:root_path],"library")
|
228
228
|
pathenv += PATH_SEP + @@cfg_dir[:current_doc_path] if with_currentRoot and !@@cfg_dir[:current_doc_path].empty?
|
229
229
|
pathenv += PATH_SEP + rootDoc if rootDoc and !rootDoc.empty?
|
230
230
|
pathenv += PATH_SEP + Dyndoc.cfg_dyn[:root_doc] unless Dyndoc.cfg_dyn[:root_doc].empty?
|
@@ -285,8 +285,8 @@ module Dyndoc
|
|
285
285
|
name=name.gsub(/(?:#{dtags.map{|e| "_#{e}_" }.join("|")})/,"")
|
286
286
|
end
|
287
287
|
#puts "name";p name
|
288
|
-
#file
|
289
|
-
if File.
|
288
|
+
#file exist?
|
289
|
+
if File.exist? name
|
290
290
|
return name
|
291
291
|
elsif name.scan(/([^\.]*)(#{@@tmplExt.map{|e| e[1]}.flatten.uniq.map{|e| Regexp.escape(e)}.join("|")})+$/)[0]
|
292
292
|
pathenv=Dyndoc.get_pathenv(Dyndoc.cfg_dyn[:root_doc],false) #RMK: do not know if false really matters here (introduced just in case in get_pathenv!!!)
|
@@ -299,7 +299,7 @@ module Dyndoc
|
|
299
299
|
|
300
300
|
def Dyndoc.make_dir(dir)
|
301
301
|
tmp=File.expand_path(dir)
|
302
|
-
FileUtils.mkdir_p(tmp) unless File.
|
302
|
+
FileUtils.mkdir_p(tmp) unless File.exist? tmp
|
303
303
|
end
|
304
304
|
|
305
305
|
end
|
data/lib/dyndoc/init/home.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Dyndoc
|
2
2
|
def Dyndoc.home
|
3
3
|
dyndoc_home = File.join(ENV['HOME'],'dyndoc')
|
4
|
-
dyndoc_home = File.read(File.join(ENV['HOME'],'.dyndoc_home')).strip if File.
|
4
|
+
dyndoc_home = File.read(File.join(ENV['HOME'],'.dyndoc_home')).strip if File.exist? File.join(ENV['HOME'],'.dyndoc_home')
|
5
5
|
dyndoc_home = File.expand_path(dyndoc_home)
|
6
6
|
#puts "dyndoc_home: "+ dyndoc_home
|
7
7
|
dyndoc_home
|
@@ -30,10 +30,10 @@ module Dyndoc
|
|
30
30
|
txt=echo_verb(txt,header)
|
31
31
|
else
|
32
32
|
filename=File.expand_path(filename)
|
33
|
-
if (!File.
|
33
|
+
if (!File.exist?(filename))
|
34
34
|
require 'fileutils'
|
35
35
|
tmp=File.dirname(filename)
|
36
|
-
FileUtils.mkdir_p(tmp) unless File.
|
36
|
+
FileUtils.mkdir_p(tmp) unless File.exist? tmp
|
37
37
|
f=File.open(filename,"w")
|
38
38
|
txt=filter.apply(b[1...-1].join("\n"))
|
39
39
|
txt=echo_verb(txt,header)
|
data/lib/dyndoc-core.rb
CHANGED
@@ -57,7 +57,7 @@ Settings.finally do |c|
|
|
57
57
|
end
|
58
58
|
|
59
59
|
# The settings in this file will be merged with the above
|
60
|
-
if File.
|
60
|
+
if File.exist? (dyndoc_yml=File.join(ENV["HOME"],".dyndoc.yml"))
|
61
61
|
Settings.read dyndoc_yml
|
62
62
|
end
|
63
63
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyndoc-ruby-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CQLS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: configliere
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
requirements:
|
216
216
|
- none
|
217
|
-
rubygems_version: 3.
|
217
|
+
rubygems_version: 3.4.5
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: R and Ruby in text document
|