aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/sysenv.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/sysenv.rb')
-rw-r--r--lib/sisu/v3/sysenv.rb170
1 files changed, 142 insertions, 28 deletions
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 7463cb4b..ed2d74dc 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -808,7 +808,8 @@ module SiSU_Env
end
msg=''
msg=" && echo 'OK: #{@input} -> #{@output}'" unless @cmd =~/q/
- puts "rsync -az#{vb} #{action} #{@input} #{@output}" if @cmd =~/[vVM]/
+ rsync_cmd="rsync -az#{vb} #{action} #{@input} #{@output}"
+ puts rsync_cmd if @cmd =~/[vVM]/
dir_change,dir_return='',''
if chdir \
&& chdir != Dir.pwd
@@ -817,7 +818,7 @@ module SiSU_Env
end
dir_change
system("
- rsync -az#{vb} #{action} #{@input} #{@output} #{msg}
+ #{rsync_cmd} #{msg}
")
dir_return
else puts "\tWARN: #{program} not found"
@@ -2952,8 +2953,8 @@ WOK
def document
self.remote_host_base.each do |remote_conn|
local_gen=@source_path
- local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
- local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
+ #local_gen_image="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image"
+ #local_gen_image_external="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external"
remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/."
remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp
src_txt=@opt.fnc
@@ -2966,54 +2967,82 @@ WOK
# System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync
delete_extra_files='--delete' # '--delete-after'
inp=[]
- if @opt.cmd =~/h/ \
+ if (@opt.cmd =~/h/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.html_scroll.dir)
inp << @f.output_path.html_seg.rel << @f.place_file.html_scroll.rel
end
- if @opt.cmd =~/w/ \
+ if (@opt.cmd =~/w/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.html_concordance.dir)
inp << @f.place_file.html_concordance.rel
end
- if @opt.cmd =~/e/ \
+ if (@opt.cmd =~/e/ \
+ || @opt.cmd =~/^-R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.epub.dir)
inp << @f.place_file.epub.rel
end
- if @opt.cmd =~/o/ \
+ if (@opt.cmd =~/o/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.odt.dir)
inp << @f.place_file.odt.rel
end
- if @opt.cmd =~/b/ \
+ if (@opt.cmd =~/b/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.xhtml.dir)
inp << @f.place_file.xhtml.rel
end
- if @opt.cmd =~/x/ \
+ if (@opt.cmd =~/x/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.xml_sax.dir)
inp << @f.place_file.xml_sax.rel
end
- if @opt.cmd =~/X/ \
+ if (@opt.cmd =~/X/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.xml_dom.dir)
inp << @f.place_file.xml_dom.rel
end
- if @opt.cmd =~/[at]/ \
+ if (@opt.cmd =~/[at]/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.txt.dir)
inp << @f.place_file.txt.rel
end
- if @opt.cmd =~/N/ \
+ if (@opt.cmd =~/i/ \
+ || @opt.cmd =~/^-[mqvVM]*i[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.manpage.dir)
+ inp << @f.place_file.manpage.rel
+ end
+ if (@opt.cmd =~/I/ \
+ || @opt.cmd =~/^-[mqvVM]*I[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.info.dir)
+ inp << @f.place_file.info.rel
+ end
+ if (@opt.cmd =~/N/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.hash_digest.dir)
inp << @f.place_file.hash_digest.rel
end
- if @opt.cmd =~/s/ \
+ if (@opt.cmd =~/s/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.src.dir)
inp << @f.place_file.src.rel
end
- if @opt.cmd =~/S/ \
+ if (@opt.cmd =~/S/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.sisupod.dir)
inp << @f.place_file.sisupod.rel
end
- if @opt.cmd =~/p/
+ if (@opt.cmd =~/p/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/)
inp << @f.output_path.pdf.rel + '/' + @opt.fnb + '*'
end
- if @opt.cmd =~/y/ \
+ if (@opt.cmd =~/Q/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
+ && FileTest.file?(@f.place_file.qrcode_md.dir)
+ inp << @f.place_file.qrcode_md.rel << @f.place_file.qrcode_title.rel
+ end
+ if (@opt.cmd =~/y/ \
+ || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \
&& FileTest.file?(@f.place_file.manifest.dir)
inp << @f.place_file.manifest.rel
end
@@ -3022,19 +3051,19 @@ WOK
else ''
end
local_css,images,images_external,images_system='','','',''
+ images_gen=images=images_skin=images_system=local_css=''
if @opt.cmd =~/[hwbxX]/ \
- and defined? @md.ec[:image] \
- and not @md.ec[:image].empty?
+ && (defined? @md.ec[:image]) \
+ && (@md.ec[:image].length > 0)
images=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/")
- images_external="#{local_gen_image_external}/" + @md.ec[:image].join(" #{local_gen_image_external}/")
end
- images_gen=images=images_skin=images_system=local_css=''
if @opt.cmd =~/[yhwbxX]/ \
- and defined? @md.ec[:image] \
- and not @md.ec[:image].empty?
+ && (defined? @md.ec[:image]) \
+ && (@md.ec[:image].length > 0)
local_css=@f.output_path.css.rel
images_system='_sisu/image_sys'
- if @f.output_path.images.rel.length > 0
+ if @f.output_path.images.rel.length > 0 \
+ && images_from_skin.length > 0
images_skin=@f.place_file.images.rel + '/' + images_from_skin.join(" #{@f.output_path.images.rel}/")
end
end
@@ -3199,9 +3228,9 @@ WOK
fnb=@fns[m,1]
end
def make_file(path,filename)
- if File.writable?("#{path}/."); File.new("#{path}/#{filename}",'w+')
- else SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn
- end
+ (File.writable?("#{path}/.")) \
+ ? File.new("#{path}/#{filename}",'w+')
+ : (SiSU_Screen::Ansi.new('',"is the file or directory writable?, could not create #{filename}").warn)
end
def touch_file(path,filename)
if File.writable?("#{path}/.");
@@ -3375,12 +3404,24 @@ WOK
fn=base_filename.texinfo
file=make_file(path,fn)
end
+ def info
+ path=output_path.texinfo.dir
+ make_path(path)
+ fn=base_filename.info
+ file=make_file(path,fn)
+ end
def hash_digest
path=output_path.hash_digest.dir
make_path(path)
fn=base_filename.hash_digest
file=make_file(path,fn)
end
+ def qrcode
+ path=output_path.qrcode.dir
+ make_path(path)
+ fn=base_filename.qrcode
+ make_file(path,fn)
+ end
def manifest
path=output_path.manifest.dir
make_path(path)
@@ -3594,6 +3635,33 @@ WOK
end
self
end
+ def info
+ def dir
+ output_path.texinfo.dir + '/' + base_filename.info
+ end
+ def rel
+ output_path.texinfo.rel + '/' + base_filename.info
+ end
+ self
+ end
+ def qrcode_title
+ def dir
+ output_path.qrcode.dir + '/' + base_filename.qrcode_title
+ end
+ def rel
+ output_path.qrcode.rel + '/' + base_filename.qrcode_title
+ end
+ self
+ end
+ def qrcode_md
+ def dir
+ output_path.qrcode.dir + '/' + base_filename.qrcode_md
+ end
+ def rel
+ output_path.qrcode.rel + '/' + base_filename.qrcode_md
+ end
+ self
+ end
def manifest
def dir
output_path.manifest.dir + '/' + base_filename.manifest
@@ -3758,7 +3826,7 @@ WOK
@md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
end
end
- def texinfo
+ def info
ft='info'
if @env.output_dir_structure.by_language_code?
@md.fnb + '.' + ft
@@ -3766,6 +3834,14 @@ WOK
@md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
end
end
+ def texinfo
+ ft='texinfo'
+ if @env.output_dir_structure.by_language_code?
+ @md.fnb + '.' + ft
+ else
+ @md.fnb + '.' + @md.opt.f_pth[:lng_is] + '.' + ft
+ end
+ end
def hash_digest
ft='.txt'
if @env.output_dir_structure.by_language_code?
@@ -3786,6 +3862,26 @@ WOK
'sitemap' + @md.lang_code_insert + ft
end
end
+ def qrcode_title
+ ft='.title.png'
+ if @env.output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif @env.output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else #fix
+ 'sisu_manifest' + @md.lang_code_insert + ft
+ end
+ end
+ def qrcode_md
+ ft='.md.png'
+ if @env.output_dir_structure.by_language_code?
+ @md.fnb + ft
+ elsif @env.output_dir_structure.by_filetype?
+ @md.fnb + @md.lang_code_insert + ft
+ else #fix
+ 'sisu_manifest' + @md.lang_code_insert + ft
+ end
+ end
def manifest_txt
ft='.txt'
if @env.output_dir_structure.by_language_code?
@@ -4411,6 +4507,24 @@ WOK
end
self
end
+ def qrcode
+ def ft
+ 'manifest/qrcode'
+ end
+ def dir
+ set_path(ft).dir.abc
+ end
+ def url
+ set_path(ft).url.abc
+ end
+ def rel
+ set_path(ft).rel.abc
+ end
+ def rcp
+ set_path(ft).rcp.abc
+ end
+ self
+ end
def harvest
def ft
'site_metadata'