aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/sisupod_make.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/sisupod_make.rb')
-rw-r--r--lib/sisu/v3/sisupod_make.rb57
1 files changed, 28 insertions, 29 deletions
diff --git a/lib/sisu/v3/sisupod_make.rb b/lib/sisu/v3/sisupod_make.rb
index ac584925..b4ef43de 100644
--- a/lib/sisu/v3/sisupod_make.rb
+++ b/lib/sisu/v3/sisupod_make.rb
@@ -69,30 +69,28 @@ module SiSU_Doc
@env=SiSU_Env::InfoEnv.new(@opt.fns)
@ver=SiSU_Env::InfoVersion.instance.get_version
@ans=SiSU_Response::Response.new
- pod_path="#{@env.processing_path.processing}/sisupod"
+ pod_path="#{@env.processing_path.processing_sisupod(@opt)}"
@v=(@opt.cmd =~/[VM]/) ? 'v' : ''
@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
@file=@particulars.file
@local_path="#{@file.output_path.sisupod.dir}"
- @zipfile=(@opt.fns =~/\.ssm\.sst$/) \
- ? @opt.fns.gsub(/(?:\~\S{2,3})?\.ssm\.sst$/,'.ssm')
- : @opt.fns.gsub(/(?:\~\S{2,3})?(\.sst)$/,'\1')
+ @zipfile=@opt.fno.gsub(/(?:\~\S{2,3})?(\.ss[tm])$/,'\1')
FileUtils::mkdir_p(pod_path) unless FileTest.directory?(pod_path)
- FileUtils::rm_rf("#{@env.processing_path.processing}sisupod/*") if FileTest.directory?("#{@env.processing_path.processing}sisupod")
+ FileUtils::rm_rf("#{@env.processing_path.processing_sisupod(@opt)}/*") if FileTest.directory?("#{@env.processing_path.processing_sisupod(@opt)}")
end
def read
unless @opt.cmd =~/q/
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (txz)',@opt.fns).green_hi_blue
- : SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (txz)',@opt.fns).green_title_hi
+ @opt.cmd=~/[MVv]/ \
+ ? SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (txz)',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.cmd,'Share SiSU Document (txz)',"[#{@opt.f_pth[:lng_is]}] #{@opt.fno}").green_title_hi
end
unless @opt.fns.empty?
- unless @opt.cmd =~/q/
+ if @opt.cmd=~/[MVv]/
SiSU_Screen::Ansi.new(@opt.cmd,'Make sisu document (txz) and place in output directory',"#{@opt.fns} -> file://#{@file.output_path.sisupod.dir}/#{@zipfile}.txz").warn if @opt.cmd =~/[MVv]/
end
directories
sisupod_build
- sisupod_xz
+ #sisupod_tar_xz
else
if @opt.cmd =~/[MVv]/
SiSU_Screen::Ansi.new(@opt.cmd,'Make (zip (txz)) of sisu work directory',"#{@env.stub_pwd}\_#{@date}.txz").warn
@@ -141,7 +139,7 @@ module SiSU_Doc
"#{@env.path.pwd}/_sisu/skin",
"#{@env.path.home}/.sisu/skin",
'/etc/sisu/skin',
- "#{@env.processing_path.processing}/external_document/skin"
+ "#{@env.processing_path.processing_sisupod(@opt)}/external_document/skin"
]
sk_doc,sk_dir="doc/#{skin}.rb","dir/skin_#{@env.stub_pwd}.rb"
skin_path.each do |v| #document skin priority 1
@@ -174,10 +172,7 @@ module SiSU_Doc
@rgx_image=/(?:^|[^_\\])\{\s*(\S+?\.(?:png|jpg|gif))/
@rgx_skin=/^\s+:skin:\s+(\S+)/
@rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/
- use_file=@opt.fns =~/(?:\.ssm|\.ssm\.sst)$/ \
- ? @opt.fns.gsub(/\.ssm\.sst$/,'.ssm')
- : @opt.fns
- file_array=IO.readlines(use_file,'')
+ file_array=IO.readlines(@opt.fno,'')
skin,images,doc_import=[],[],[]
doc_import_dir=@opt.sub_location
file_array.each do |f| #% work area
@@ -188,7 +183,7 @@ module SiSU_Doc
and f =~@rgx_image
images=images_extract(f,images)
end
- if use_file =~/\.ssm$/
+ if @opt.fno =~/\.ssm$/
doc_import << f.scan(@rgx_doc_import) if f =~@rgx_doc_import
end
end
@@ -213,7 +208,8 @@ module SiSU_Doc
else
skin_source=select_skin
end
- docskin_place="#{@env.processing_path.processing}/sisupod/doc/_sisu/skin/#{skin_source[:type]}"
+ docskin_place="#{@env.processing_path.processing_sisupod(@opt)}/doc/_sisu/skin/#{skin_source[:type]}"
+ FileUtils::mkdir_p(docskin_place)
if skin_source[:type] =~/dir/
docskin_with_path="#{docskin_place}/skin_#{@env.stub_pwd}.rb"
docskin=[docskin_with_path.gsub(/.+?\/(skin_\S+?)\.rb/,'\1')]
@@ -241,9 +237,10 @@ module SiSU_Doc
images=images.flatten.uniq
images.delete_if {|x| x =~/https?:\/\// }
#images=images.sort
- path_pod="#{@env.processing_path.processing}/sisupod"
- path_pod_conf="#{@env.processing_path.processing}/sisupod/_sisu"
+ path_pod="#{@env.processing_path.processing_sisupod(@opt)}"
+ path_pod_conf="#{@env.processing_path.processing_sisupod(@opt)}/_sisu"
images_path_pod="#{path_pod}/image"
+ FileUtils::mkdir_p(images_path_pod)
#unattractive hard coding ... !
image_path='_sisu/image'
images_pwd="#{@env.path.pwd}/#{image_path}"
@@ -265,29 +262,31 @@ module SiSU_Doc
end
end
if doc_import.length > 0 \
- and use_file =~/\.ssm$/
+ and @opt.fno =~/\.ssm$/
doc_import.each do |f|
- FileUtils::cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f}","#{@env.processing_path.processing}/sisupod/doc/#{@opt.lng}/#{f}")
+ FileUtils::cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f}","#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f}")
end
end
x=@env.document_language_versions_found #check multiple document language versions (param not used)
if x[:f] \
and x[:f].length > 0 #store multiple document language versions, sisupod
x[:f].each do |f|
- (use_file =~/\.ssm$/) \
- ? FileUtils::cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}","#{@env.processing_path.processing}/sisupod/doc/#{f[:l]}/#{f[:n]}")
- : FileUtils::cp_r("#{@env.path.pwd}/#{f[:f]}","#{@env.processing_path.processing}/sisupod/doc/#{f[:l]}/#{f[:n]}")
+ pth="#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}"
+ FileUtils::mkdir_p(pth) unless FileTest.directory?(pth)
+ (@opt.fno =~/\.ssm$/) \
+ ? FileUtils::cp_r("#{@env.path.pwd}#{doc_import_dir}/#{f[:f]}","#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f[:n]}")
+ : FileUtils::cp_r("#{@env.path.pwd}/#{f[:f]}","#{@env.processing_path.processing_sisupod(@opt)}/doc/#{@opt.lng}/#{f[:n]}")
end
end #NB not all possibilies met, revisit, also in case of composite file may wish to add README
end
- def sisupod_xz
+ def sisupod_tar_xz
FileUtils::mkdir_p(@file.output_path.sisupod.dir) unless FileTest.directory?(@file.output_path.sisupod.dir)
tree=(@opt.cmd =~/[vVM]/ \
&& SiSU_Env::SystemCall.new.program_found?('tree')) \
? 'tree sisupod'
: ''
- if FileTest.directory?(@env.processing_path.processing)
- Dir.chdir(@env.processing_path.processing)
+ if FileTest.directory?(@env.processing_path.processing_sisupod(@opt))
+ Dir.chdir("#{@env.processing_path.root_dir}/#{@env.processing_path.user}/pods/#{@opt.fns}")
system(%{
#{tree}
tar -cJf #{@zipfile}.txz sisupod
@@ -296,9 +295,9 @@ module SiSU_Doc
FileUtils::mv("#{@zipfile}.txz",@file.place_file.sisupod.dir)
FileUtils::rm_r(Dir.glob("sisupod/*"))
Dir.chdir(@env.path.pwd)
- SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz").blue_tab unless @opt.cmd =~/q/
+ SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz").blue_tab if @opt.cmd=~/[MVv]/
else
- SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz not built").blue_tab
+ SiSU_Screen::Ansi.new('',"#{@opt.fns}.txz not built").blue_tab if @opt.cmd=~/[MVv]/
end
end
end