From 18467732fa544e1e9a2d6c7df82ee41bb4ec0dc4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Sep 2011 07:34:24 -0400 Subject: v2: remote, image source url fix --- lib/sisu/v2/remote.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v2/remote.rb b/lib/sisu/v2/remote.rb index 32bc336d..d737dad6 100644 --- a/lib/sisu/v2/remote.rb +++ b/lib/sisu/v2/remote.rb @@ -149,7 +149,7 @@ module SiSU_Remote images.sort! @msg,@msgs='downloading images:', [ images.join(',') ] @tell.call.warn unless @opt.cmd =~/q/ - SiSU_Assemble::Remote_image.new.download_images(image_download_url,images) + SiSU_Assemble::Remote_image.new.download_images(image_download_url[0],images) @msg,@msgs='downloading done',nil @tell.call.warn unless @opt.cmd =~/q/ end -- cgit v1.2.3 From 8edbb1387588fadd3469a450dd00362c4455d639 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Sep 2011 07:37:00 -0400 Subject: v2 v3: param, matching of date, years 1400 - 21\d\d --- lib/sisu/v2/param.rb | 12 ++++++------ lib/sisu/v3/param.rb | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index 656490d9..60663830 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -120,9 +120,9 @@ module SiSU_Param def all s=nil if @author - s ||=((@date =~/([12][890]\d{2})/ ) \ - ? ("Copyright (C) #{$1} #{@author}") \ - : ('Copyright (C)' + @author)) #matches years 1800 through 20\d\d 2004w19 + s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ + ? ("Copyright (C) #{$1} #{@author}") + : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d end s end @@ -133,9 +133,9 @@ module SiSU_Param def all s=nil if @author - s ||=((@date =~/([12][890]\d{2})/ ) \ - ? ("Copyright (C) #{$1} #{@author}") \ - : ('Copyright (C)' + @author)) #matches years 1800 through 20\d\d 2004w19 + s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ + ? ("Copyright (C) #{$1} #{@author}") + : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d end s end diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index f9d7ecb0..3911f85e 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -131,9 +131,9 @@ module SiSU_Param def all s=nil if @author - s ||=((@date =~/([12][890]\d{2})/ ) \ + s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ ? ("Copyright (C) #{$1} #{@author}") - : ('Copyright (C)' + @author)) #matches years 1800 through 20\d\d 2004w19 + : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d end s end @@ -144,9 +144,9 @@ module SiSU_Param def all s=nil if @author - s ||=((@date =~/([12][890]\d{2})/ ) \ + s ||=((@date =~/((?:1[4-9]|2[01])\d{2})/ ) \ ? ("Copyright (C) #{$1} #{@author}") - : ('Copyright (C)' + @author)) #matches years 1800 through 20\d\d 2004w19 + : ('Copyright (C)' + @author)) #matches years 1400 through 21\d\d end s end -- cgit v1.2.3 From 5048519fbbe92da19a395e79561cb2bcd6542e7d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Sep 2011 07:39:11 -0400 Subject: v3: cosmetic, minor --- lib/sisu/v3/html_segments.rb | 3 ++- lib/sisu/v3/param.rb | 7 +++++-- lib/sisu/v3/remote.rb | 6 +++--- lib/sisu/v3/sysenv.rb | 6 +++--- 4 files changed, 13 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb index 67bfa319..60b4312e 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -435,7 +435,8 @@ module SiSU_HTML_seg dob=format_seg.no_paranum end end - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==4 @@seg[:main] << %{\n
\n} @@seg[:main] << dob_html diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 3911f85e..e2cffa9b 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -87,7 +87,8 @@ module SiSU_Param @pstorefile="#{@env.processing_path.dal}/#{@fns}.pstore" end def get - if @opt.f_pth[:pth] != Dir.pwd #BUG check + if @opt.f_pth \ + and @opt.f_pth[:pth] != Dir.pwd #BUG check # you may need to change Dir.pwd to @opt.f_pth[:pth] where the latter # has a path value that is different, however, f_pth is not always set! p '-- bug alert -- ' @@ -287,7 +288,9 @@ module SiSU_Param a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m) @h=build_hash(a) def author - @h['author']=(@h['author'] ? @h['author'] : @h['main']) + @h['author']=(@h['author'] \ + ? @h['author'] + : @h['main']) names=name_format(@h['author']) s=names[:name_str] l,n=Db[:col_name],'creator.author' diff --git a/lib/sisu/v3/remote.rb b/lib/sisu/v3/remote.rb index 1e974f9c..a3b9a62e 100644 --- a/lib/sisu/v3/remote.rb +++ b/lib/sisu/v3/remote.rb @@ -64,9 +64,9 @@ module SiSU_Remote def initialize(opt) @opt=opt @dir=SiSU_Env::Info_env.new(@opt.fns) - @put=unless @opt.fns =~/\.ssm\.sst$/; @opt.fns - else @opt.fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm') - end + @put=(@opt.fns =~/\.ssm\.sst$/) \ + ? @opt.fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm') + : @opt.fns @remote=SiSU_Env::Info_remote.new(@opt) end def rsync diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 7463cb4b..79ae61af 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -3199,9 +3199,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}/."); -- cgit v1.2.3 From 794c20f31b0ca3b5be1307233b5dced92c3bc13f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Sep 2011 07:43:50 -0400 Subject: v3: hub, processing options, remove cruft --- lib/sisu/v3/hub.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 088fb309..8bd1cb7a 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -348,7 +348,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ SiSU_Harvest::Source.new(@opt).read # -h -H html.rb elsif @opt.mod.inspect =~/--convert|--to|--from/ require_relative 'sst_convert_markup' # sst_convert_markup.rb - elsif @opt.cmd =~/([AabCcDdeFfGgHhIiJjkLMmNnOoPpQqRrSsTtUuVvwWXxYyZ_0-9])/ \ + elsif @opt.cmd =~/([abCcDdeFGgHhIikLMmNnoPpQqRrSsTtUuVvWwXxYyZ_0-9])/ \ and @opt.cmd =~/^-/ \ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ -- cgit v1.2.3 From 344270faca3b8179c5d45e0abede70df841635c7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Sep 2011 07:45:01 -0400 Subject: v3: info files, fix output; remote, include info file & manpage (when selected) --- lib/sisu/v3/manifest.rb | 28 ++++++++++++++-------------- lib/sisu/v3/sysenv.rb | 33 ++++++++++++++++++++++++++++++++- lib/sisu/v3/texinfo.rb | 27 ++++++++++++++++----------- lib/sisu/v3/urls.rb | 2 +- 4 files changed, 63 insertions(+), 27 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index adc048ef..cb25781f 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -360,6 +360,20 @@ module SiSU_Manifest id,file='XML DOM',@f.base_filename.xml_dom summarize(id,file,pth,rel,url) end + if FileTest.file?(@f.place_file.info.dir)==true + pth=@f.output_path.texinfo.dir + rel=@f.output_path.texinfo.rel_sm + url=@f.output_path.texinfo.url + id,file='Info file',@f.base_filename.info + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.manpage.dir)==true + pth=@f.output_path.manpage.dir + rel=@f.output_path.manpage.rel_sm + url=@f.output_path.manpage.url + id,file='Manpage',@f.base_filename.manpage + summarize(id,file,pth,rel,url) + end if FileTest.file?(@f.place_file.txt.dir)==true if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)' elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)' @@ -383,20 +397,6 @@ module SiSU_Manifest pth,rel,url='','','' summarize(id,file,pth,rel,url) end - if FileTest.file?(@f.place_file.manpage.dir)==true - pth=@f.output_path.manpage.dir - rel=@f.output_path.manpage.rel_sm - url=@f.output_path.manpage.url - id,file='Manpage',@f.base_filename.manpage - summarize(id,file,pth,rel,url) - end - if FileTest.file?(@f.place_file.texinfo.dir)==true - pth=@f.output_path.texinfo.dir - rel=@f.output_path.texinfo.rel_sm - url=@f.output_path.texinfo.url - id,file='Texinfo',@f.base_filename.texinfo - summarize(id,file,pth,rel,url) - end if FileTest.file?(@f.place_file.hash_digest.dir)==true pth=@f.output_path.hash_digest.dir rel=@f.output_path.hash_digest.rel_sm diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 79ae61af..ad831489 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -2998,6 +2998,14 @@ WOK && FileTest.file?(@f.place_file.txt.dir) inp << @f.place_file.txt.rel end + if @opt.cmd =~/i/ \ + && FileTest.file?(@f.place_file.manpage.dir) + inp << @f.place_file.manpage.rel + end + if @opt.cmd =~/I/ \ + && FileTest.file?(@f.place_file.info.dir) + inp << @f.place_file.info.rel + end if @opt.cmd =~/N/ \ && FileTest.file?(@f.place_file.hash_digest.dir) inp << @f.place_file.hash_digest.rel @@ -3375,6 +3383,12 @@ 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) @@ -3594,6 +3608,15 @@ 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 manifest def dir output_path.manifest.dir + '/' + base_filename.manifest @@ -3758,7 +3781,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 +3789,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? diff --git a/lib/sisu/v3/texinfo.rb b/lib/sisu/v3/texinfo.rb index ab1b7c98..f0331513 100644 --- a/lib/sisu/v3/texinfo.rb +++ b/lib/sisu/v3/texinfo.rb @@ -98,7 +98,7 @@ module SiSU_TexInfo def song begin tool=(@opt.cmd =~/[MVv]/) \ - ? "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.texinfo}" + ? "#{@env.program.texinfo} #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}" : "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" tell=@opt.cmd=~/[MVvz]/ \ && @opt.cmd !~/q/ \ @@ -133,6 +133,7 @@ module SiSU_TexInfo @md,@data=md,data @env=SiSU_Env::Info_env.new(@md.fns) @vz=SiSU_Env::Get_init.instance.skin + @f=SiSU_Env::SiSU_file.new(@md) end def songsheet begin @@ -142,6 +143,7 @@ module SiSU_TexInfo @data=tail output makeinfo #KEEP reinstate when fixed #% + place_info rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.cmd,$!,$@).rescue ensure end @@ -363,19 +365,15 @@ module SiSU_TexInfo def output data=@data data.compact! - filename=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo} - filename_texinfo=File.new(filename,'w+') - puts filename if @md.opt.cmd =~/M/ - data.each {|s| (filename_texinfo.puts s,"\n") if s} - filename_texinfo.close - file_info_src=%{#{@env.processing_path.texi}/#{@md.fnb}.info} - file_info="#{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.texinfo}" - SiSU_Env::SiSU_file.new(@md).mkdir - system("cp #{file_info_src} #{file_info}") + filename_texinfo=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo} + file_texinfo=File.new(filename_texinfo,'w+') + puts filename_texinfo if @md.opt.cmd =~/M/ + data.each {|s| (file_texinfo.puts s,"\n") if s} + file_texinfo.close end def makeinfo if @md.fns =~/\.(?:-|ssm\.)?sst$/ - m=/(.+?)\.([_-]?sst)$/.match(@md.fns) + m=/(.+?)\.((?:-|ssm\.)?sst)$/.match(@md.fns) fnb,sfx=m[1],m[2] pwd=Dir.pwd case sfx @@ -387,6 +385,13 @@ module SiSU_TexInfo end Dir.chdir(pwd) end + def place_info + unless FileTest.directory?(@f.output_path.texinfo.dir) + mkdir_p(@f.output_path.texinfo.dir) + end + info_src=%{#{@env.processing_path.texi}/#{@md.fnb}.info} + system("cp #{info_src} #{@f.place_file.info.dir}") + end end end end diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index a6612175..d0193da4 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -181,7 +181,7 @@ module SiSU_urls SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","#{@prog.manpage_viewer} #{@md.file.output_path.manpage.dir}/#{@md.file.base_filename.manpage}").result end def pinfo(x,y) - SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","pinfo -f #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.texinfo}").result + SiSU_Screen::Ansi.new(@opt.cmd,"[#{@opt.f_pth[:lng_is]}] -#{x}","pinfo -f #{@md.file.output_path.texinfo.dir}/#{@md.file.base_filename.info}").result end def po4a def po(x,y) -- cgit v1.2.3 From b1d08ced020a74c5871b20ad4de57b533e3a4c2e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Sep 2011 08:07:27 -0400 Subject: v3: qrcode, sisu generated manifest output, treat as such * place qrcode images in directory under manifest (manifest/qrcode) * fix remote placement of qrcode images when requested --- lib/sisu/v3/manifest.rb | 11 ++++----- lib/sisu/v3/qrcode.rb | 6 ++--- lib/sisu/v3/sysenv.rb | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index cb25781f..d1e01f58 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -416,11 +416,10 @@ module SiSU_Manifest end end def qrc_image - pth="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" - fn=@f.base_filename.manifest_txt - img_md="#{@md.file.output_path.html.rel_image}/qrc_md.#{fn}.png" - img_title="#{@md.file.output_path.html.rel_image}/qrc_title.#{fn}.png" - if FileTest.file?("#{pth}/qrc_md.#{fn}.png")==true + fn=@md.fnb + img_md="qrcode/#{fn}.md.png" + img_title="qrcode/#{fn}.title.png" + if FileTest.file?(@f.place_file.qrcode_md.dir)==true @manifest[:html] <<<

QR code SiSU document metadata:

@@ -430,7 +429,7 @@ module SiSU_Manifest WOK end - if FileTest.file?("#{pth}/qrc_title.#{fn}.png")==true + if FileTest.file?(@f.place_file.qrcode_title.dir)==true @manifest[:html] <<<

QR code document title info:

diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb index e244231e..1b741a48 100644 --- a/lib/sisu/v3/qrcode.rb +++ b/lib/sisu/v3/qrcode.rb @@ -110,7 +110,7 @@ module SiSU_QRcode @language=l[:n] @translate=SiSU_Translate::Source.new(@md,@language) @brace_url=SiSU_Viz::Skin.new.url_decoration - @dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + @f.make_path(@f.output_path.qrcode.dir) end def output_metadata fn=@f.base_filename.manifest_txt @@ -128,7 +128,7 @@ module SiSU_QRcode #system(%{ # cat #{pt}/#{fn} | qrencode -s 3 -o qrcm.autonomy_markup0.png #}) - cmd=SiSU_Env::System_call.new(mn,"#{@dest}/qrc_md.#{fn}.png",@md.opt.cmd) + cmd=SiSU_Env::System_call.new(mn,@f.place_file.qrcode_md.dir,@md.opt.cmd) cmd.qrencode #system(%{ # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_md.#{fn}.png @@ -140,7 +140,7 @@ module SiSU_QRcode @manifest[:txt_title].each do |x| mn += x end - cmd=SiSU_Env::System_call.new(mn,"#{@dest}/qrc_title.#{fn}.png",@md.opt.cmd) + cmd=SiSU_Env::System_call.new(mn,@f.place_file.qrcode_title.dir,@md.opt.cmd) cmd.qrencode #system(%{ # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_title.#{fn}.png diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index ad831489..b5a10614 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -3021,6 +3021,10 @@ WOK if @opt.cmd =~/p/ inp << @f.output_path.pdf.rel + '/' + @opt.fnb + '*' end + if @opt.cmd =~/Q/ \ + && 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/ \ && FileTest.file?(@f.place_file.manifest.dir) inp << @f.place_file.manifest.rel @@ -3395,6 +3399,12 @@ WOK 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) @@ -3617,6 +3627,24 @@ WOK 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 @@ -3817,6 +3845,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? @@ -4442,6 +4490,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' -- cgit v1.2.3 From 0081730547d53f86744f61f772657c34e8c5149b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 24 Sep 2011 08:12:12 -0400 Subject: v3: remote, src & sisupod processing, and rsync placement --- lib/sisu/v3/composite.rb | 8 +++-- lib/sisu/v3/hub.rb | 50 +++++++++++++++++-------------- lib/sisu/v3/options.rb | 64 +++++++++++++++++++++++++++++++++------- lib/sisu/v3/remote.rb | 4 ++- lib/sisu/v3/sisupod_make.rb | 17 ----------- lib/sisu/v3/sysenv.rb | 71 ++++++++++++++++++++++++++++----------------- 6 files changed, 134 insertions(+), 80 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v3/composite.rb b/lib/sisu/v3/composite.rb index 33c15cc0..b269cc39 100644 --- a/lib/sisu/v3/composite.rb +++ b/lib/sisu/v3/composite.rb @@ -70,10 +70,11 @@ module SiSU_Assemble images[0]=dir images end - def download_images(download_from,images_array) + def download_images(images_info) path="#{@env.processing_path.processing}/external_document/image" mkdir_p(path) unless FileTest.directory?(path) - images_array.each do |i| + download_from=images_info.shift + images_info.each do |i| image="#{path}/#{i}" imagefile=File.new(image,'w+') open("#{download_from}/#{i}") do |g| @@ -226,7 +227,8 @@ module SiSU_Assemble @@imager.each do |d,i| i.flatten! i.uniq! - download_images(d,i) + image_info=d + i + download_images(mage_info.flatten) end end tuned_file diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 8bd1cb7a..584845ba 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -156,11 +156,20 @@ module SiSU break else put=fns.gsub(/(.+)?\.ssm\.sst$/,'\1.ssm') - @opt.fns=fns - @opt.pth=@opt.paths[i] - @opt.f_pth=@opt.f_pths[i] - @opt.lng=@opt.lngs[i] - @@pwd=@opt.pth + if fns !~/\.-sst$/ + @opt.fns=fns + @opt.pth=@opt.paths[i] + @opt.f_pth=@opt.f_pths[i] + @opt.lng=@opt.lngs[i] + @@pwd=@opt.pth + else + @opt.fns=fns + @opt.pth=Dir.pwd + @opt.f_pth=@opt.f_pths[i] #@opt.f_pth= { pth: Dir.pwd } + @opt.lng='en' + #@opt.lng=@opt.lngs[i] + @@pwd=@opt.pth + end Dir.chdir(@opt.pth) #watch env=SiSU_Env::Info_env.new(fns) if @req !~/(?:urls|remote)$/ @@ -427,12 +436,12 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ path_image='./_sisu/processing/external_document/image' path_skin='./_sisu/processing/external_document/skin/doc' @get_s,@get_p,@get_pl=[],[],[] - re_s=/((?:https?|file):\/\/\S+?\.sst)$/ + re_s=/(\S+?\.-sst)$/ re_p3=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.txz|sisupod(?:\.txz)?|\.ssp))/ re_pl3=/^(\/\S+?\.ss[mt]\.txz)/ @opt.files.each do |fns| if fns =~re_s - @get_s << re_s.match(fns)[1] if re_s + @get_s << @opt.f_pths[0][:url] end if fns =~re_p3 @get_p << re_p3.match(fns)[1] if re_p3 @@ -441,21 +450,18 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ @get_pl << re_pl3.match(fns)[1] if re_p3 end end - re_p2=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\.ssp))/ - re_pl2=/^(\/\S+?\.ss[mt]\.zip)/ - @opt.files.each do |fns| - if fns =~re_s - @get_s << re_s.match(fns)[1] if re_s - end - if fns =~re_p2 - @get_p << re_p2.match(fns)[1] if re_p2 - end - if fns =~re_pl2 - @get_pl << re_pl2.match(fns)[1] if re_p2 - end - end - if @get_s.length > 0 #% remote markup file .sst - require_relative 'remote' # remote.rb + #re_p2=/((?:https?|file):\/\/\S+?(?:\/\S+?\.ss[mt]\.zip|sisupod(?:\.zip)?|\.ssp))/ + #re_pl2=/^(\/\S+?\.ss[mt]\.zip)/ + #@opt.files.each do |fns| + # if fns =~re_p2 + # @get_p << re_p2.match(fns)[1] if re_p2 + # end + # if fns =~re_pl2 + # @get_pl << re_pl2.match(fns)[1] if re_p2 + # end + #end + if @get_s.length > 0 #% remote markup file .sst + require_relative 'remote' # remote.rb SiSU_Remote::Get.new(@opt,@get_s).fns Operations.new.counter end diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index eeca31ec..ffd0da0f 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -192,6 +192,7 @@ module SiSU_commandline c,w='','' m,f,pth,z,lng,lngs=[],[],[],[],[],[] a=s.split(/\s+/) + r_l=Px[:lng_lst].join('|') a.uniq.each do |x| if x =~/^-[a-z0-5]+/i \ or x =~/^--\S+/ @@ -203,8 +204,51 @@ module SiSU_commandline end elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip))$/ if x =~/^(?:https?|file):\/\/\S+/ \ - or x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/ \ - && FileTest.file?(x) + and x =~/\S+?\.ss[mt]$/ + r_url=/(http:\/\/\S+?\/\S+?\/src(?:\/(?:#{r_l}))?)\// + url_base = (x[r_url,1]) + url = x + y=x.gsub(/http:\/\/\S+?\/\S+?\/src\//,'') + t=/(#{r_l})\/[^\/]+?\.ss[tm]$/ + l_p = (y[t,1]) \ + ? y[t,1] + : nil + lng << l_p + lngs << if l_p + l_p + elsif x =~/~(#{r_l})\.ss[tm]/ + $1 + else lng_base + end + r_f=/(?:#{r_l})\/([^\/]+?\.ss[tm])$/ + fn = (y[r_f,1]) \ + ? y[r_f,1] + : y + fn.gsub!(/\.((?:ssm\.)?sst)/,'.-\1') + fullname=Dir.pwd + '/' + fn + pt=Pathname.new(fullname) + pth << Dir.pwd + r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/ + lng_is =if l_p + l_p + elsif x =~/~(#{r_l})\.ss[tm]/ + $1 + else lng_base + end + f_pths << { + pth: pt.split[0].realpath.to_s, + f: pt.split[1].to_s, + pth_stub: pt.split[0].realpath.to_s[r_u,1], + lng: (pt.split[0].realpath.to_s[t,1]) \ + ? pt.split[0].realpath.to_s[t,1] + : nil, + lng_is: lng_is, + url_base: url_base, + url: url + } + f << fn + elsif x =~/^(?:https?|file):\/\/\S+/ \ + and x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/ x=x.gsub(/^file:\/\//,'') f << x elsif FileTest.file?(x) @@ -212,34 +256,34 @@ module SiSU_commandline pt=Pathname.new(x) pth << pt.split[0].realpath.to_s #remove? f << pt.split[1].to_s #remove? - r=Px[:lng_lst].join('|') - u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ - t=/.+\/(#{r})$/ + r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/ + t=/.+\/(#{r_l})$/ l_p = (pt.split[0].realpath.to_s[t,1]) \ ? pt.split[0].realpath.to_s[t,1] : nil - #: '' lng << l_p lngs << if l_p l_p - elsif x =~/~(#{r})\.ss[tm]/ + elsif x =~/~(#{r_l})\.ss[tm]/ $1 else lng_base end lng_is =if l_p l_p - elsif x =~/~(#{r})\.ss[tm]/ + elsif x =~/~(#{r_l})\.ss[tm]/ $1 else lng_base end f_pths << { pth: pt.split[0].realpath.to_s, f: pt.split[1].to_s, - pth_stub: pt.split[0].realpath.to_s[u,1], + pth_stub: pt.split[0].realpath.to_s[r_u,1], lng: (pt.split[0].realpath.to_s[t,1]) \ ? pt.split[0].realpath.to_s[t,1] : nil, - lng_is: lng_is + lng_is: lng_is, + url_base: nil, + url: nil } # Dir.chdir(pt.split[0].realpath) else puts "file not found: #{x}" diff --git a/lib/sisu/v3/remote.rb b/lib/sisu/v3/remote.rb index a3b9a62e..2e055707 100644 --- a/lib/sisu/v3/remote.rb +++ b/lib/sisu/v3/remote.rb @@ -149,7 +149,9 @@ module SiSU_Remote images.sort! @msg,@msgs='downloading images:', [ images.join(',') ] @tell.call.warn unless @opt.cmd =~/q/ - SiSU_Assemble::Remote_image.new.download_images(image_download_url,images) + image_info=image_download_url + images + SiSU_Assemble::Remote_image.new.download_images(image_info) + #SiSU_Assemble::Remote_image.new.download_images(image_download_url,images) @msg,@msgs='downloading done',nil @tell.call.warn unless @opt.cmd =~/q/ end diff --git a/lib/sisu/v3/sisupod_make.rb b/lib/sisu/v3/sisupod_make.rb index dd6c89c2..e2ac4f51 100644 --- a/lib/sisu/v3/sisupod_make.rb +++ b/lib/sisu/v3/sisupod_make.rb @@ -303,23 +303,6 @@ module SiSU_Doc SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz not built").blue_tab end end - def sisupod_zip - mkdir_p(@file.output_path.sisupod.dir) unless FileTest.directory?(@file.output_path.sisupod.dir) - if FileTest.directory?(@env.processing_path.processing) - Dir.chdir(@env.processing_path.processing) - system(%{ - echo "SiSU sisupod #{@ver[:version]}" > sisu_zip.txt - zip -qz #{@zipfile}.zip sisu_zip.txt < sisu_zip.txt - zip -qr #{@zipfile}.zip sisupod - mv #{@zipfile}.zip #{@file.place_file.sisupod.dir} & - rm -r sisupod/* - }) - Dir.chdir(@env.path.pwd) - SiSU_Screen::Ansi.new('',"#{@zipfile}.zip").blue_tab if @opt.cmd =~/[MVv]/ - else - SiSU_Screen::Ansi.new('',"#{@zipfile}.zip not built").blue_tab - end - end end end __END__ diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index b5a10614..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,66 +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 =~/i/ \ + 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/ \ + 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/ \ + 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 =~/Q/ \ + 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/ \ + if (@opt.cmd =~/y/ \ + || @opt.cmd =~/^-[mqvVM]*R[mqvVM]*$/) \ && FileTest.file?(@f.place_file.manifest.dir) inp << @f.place_file.manifest.rel end @@ -3034,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 -- cgit v1.2.3