diff options
Diffstat (limited to 'lib/sisu/current/src_shared.rb')
-rw-r--r-- | lib/sisu/current/src_shared.rb | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/lib/sisu/current/src_shared.rb b/lib/sisu/current/src_shared.rb index a6c41c22..05d22da3 100644 --- a/lib/sisu/current/src_shared.rb +++ b/lib/sisu/current/src_shared.rb @@ -59,11 +59,13 @@ module SiSU_Source class SiSUpodSource require_relative 'se' # se.rb require_relative 'se_hub_particulars' # se_hub_particulars.rb + require_relative 'utils_composite' # utils_composite.rb + include SiSU_Composite_Doc_Utils # composite doc, .ssm, extract all related insert files, array of filenames test def initialize(opt,build=nil,place=nil) @opt=opt @date=SiSU_Env::InfoDate.new.dt @env=SiSU_Env::InfoEnv.new(opt.fns) - @ver=SiSU_Env::InfoVersion.instance.get_version + #@ver=SiSU_Env::InfoVersion.instance.get_version @v=(@opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) \ ? 'v' : '' @@ -74,7 +76,6 @@ module SiSU_Source processing_sisupod.make path_pod=processing_sisupod.paths[:sisupod] path_pod_fnb=processing_sisupod.paths[:fnb] - @doc_import_list=[] FileUtils::mkdir_p(path_pod) unless FileTest.directory?(path_pod) @path_pod={ fnb: path_pod_fnb, @@ -102,8 +103,7 @@ module SiSU_Source end unless @opt.fns.empty? directories - file_array=IO.readlines(@opt.fno,'') - doc_import_list=pod_source_build(file_array) #this needs to be built in case of multi-lingual for all of them, before single pass tar + doc_import_list=composite_and_imported_filenames_array(@opt.fno) doc_import_list=[@opt.fno, doc_import_list].flatten image_extraction(doc_import_list) language_versions @@ -165,25 +165,37 @@ module SiSU_Source images=images.uniq images.each do |i| if FileTest.file?("#{images_pwd}/#{i}") - FileUtils::cp("#{images_pwd}/#{i}","#{@path_pod[:image]}/#{i}") + FileUtils::cp( + "#{images_pwd}/#{i}", + "#{@path_pod[:image]}/#{i}" + ) else STDERR.puts \ - %{\t*WARN* did not find image - "#{images_pwd}/#{i}" [#{__FILE__}:#{__LINE__}]} + %{\t*WARN* did not find image - } \ + + %{"#{images_pwd}/#{i}" } \ + + %{[#{__FILE__}:#{__LINE__}]} end end else STDERR.puts \ - %{\t*WARN* did not find - #{images_pwd} #{@path_pod[:image]} [#{__FILE__}:#{__LINE__}]} + %{\t*WARN* did not find - } \ + + %{#{images_pwd} #{@path_pod[:image]} } \ + + %{[#{__FILE__}:#{__LINE__}]} end end if doc_import_list.length > 0 \ and @opt.fno =~/\.ssm$/ doc_import_list.each do |f| if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f}") - FileUtils::cp("#{@opt.base_path}#{doc_import_dir}/#{f}","#{@path_pod[:doc]}/#{f}") + FileUtils::cp( + "#{@opt.base_path}#{doc_import_dir}/#{f}", + "#{@path_pod[:doc]}/#{f}" + ) else STDERR.puts \ - %{\t*WARN* did not find image - "#{@opt.base_path}#{doc_import_dir}/#{f}" [#{__FILE__}:#{__LINE__}]} + %{\t*WARN* did not find image - } \ + + %{"#{@opt.base_path}#{doc_import_dir}/#{f}" } \ + + %{[#{__FILE__}:#{__LINE__}]} end end end @@ -194,17 +206,22 @@ module SiSU_Source if x[:f] \ and x[:f].length > 0 #store multiple document language versions, sisupod x[:f].each do |f| - FileUtils::mkdir_p(@path_pod[:doc]) unless FileTest.directory?(@path_pod[:doc]) + FileUtils::mkdir_p(@path_pod[:doc]) \ + unless FileTest.directory?(@path_pod[:doc]) if f[:f] =~/\~(\S{2,3})\.ss[tm]$/ lng_f=$1 if @opt.lng == lng_f if @opt.fno =~/\.ssm$/ if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}") - FileUtils::cp("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}", - "#{@path_pod[:doc]}/#{f[:n]}") + FileUtils::cp( + "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}", + "#{@path_pod[:doc]}/#{f[:n]}" + ) else STDERR.puts \ - %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + %{\t*WARN* did not find - } \ + + %{"#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" } \ + + %{[#{__FILE__}:#{__LINE__}]} end else if FileTest.file?("#{@opt.base_path}/#{f[:f]}") @@ -218,23 +235,31 @@ module SiSU_Source else :no end if cpy == :yes - FileUtils::cp("#{@opt.base_path}/#{f[:f]}", - "#{@path_pod[:doc]}/#{f[:n]}") + FileUtils::cp( + "#{@opt.base_path}/#{f[:f]}", + "#{@path_pod[:doc]}/#{f[:n]}" + ) end else STDERR.puts \ - %{\t*WARN* did not find - "#{@opt.base_path}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + %{\t*WARN* did not find - } \ + + %{"#{@opt.base_path}/#{f[:f]}" } \ + + %{[#{__FILE__}:#{__LINE__}]} end end end else if @opt.fno =~/\.ssm$/ if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}") - FileUtils::cp_r("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}", - "#{@path_pod[:doc]}/#{f[:n]}") + FileUtils::cp_r( + "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}", + "#{@path_pod[:doc]}/#{f[:n]}" + ) else STDERR.puts \ - %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + %{\t*WARN* did not find - } \ + + %{"#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" } \ + + %{[#{__FILE__}:#{__LINE__}]} end else if FileTest.file?("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}") @@ -248,12 +273,16 @@ module SiSU_Source else :no end if cpy == :yes - FileUtils::cp("#{@opt.base_path}#{doc_import_dir}/#{f[:f]}", - "#{@path_pod[:doc]}/#{f[:n]}") + FileUtils::cp( + "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}", + "#{@path_pod[:doc]}/#{f[:n]}" + ) end else STDERR.puts \ - %{\t*WARN* did not find - "#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" [#{__FILE__}:#{__LINE__}]} + %{\t*WARN* did not find - } \ + + %{"#{@opt.base_path}#{doc_import_dir}/#{f[:f]}" } \ + + %{[#{__FILE__}:#{__LINE__}]} end end end @@ -263,35 +292,6 @@ module SiSU_Source def directories SiSU_Env::InfoEnv.new.sisupod_v4(@opt) end - def ssm_doc_import_list(f) - if @opt.fno =~/\.ss[mi]$/ - doc_import_list=[] - if f =~@rgx_doc_import - doc_import_list << f.scan(@rgx_doc_import) - end - doc_import_list.flatten.each do |i| - if i =~/.ssi/ - file_array=IO.readlines(i,'') - pod_source_build(file_array) - end - end - end - doc_import_list.uniq.flatten - end - def pod_source_build(file_array) - @pwd=Dir.pwd - @rgx_doc_import=/^<<\s*(\S+?\.ss[ti])/ - doc_import_list=[] - file_array.each do |f| #% work area - if f !~/^%+\s/ - if @opt.fno =~/\.ss[mi]$/ - @doc_import_list << ssm_doc_import_list(f) - doc_import_list=@doc_import_list.flatten.uniq - end - end - end - doc_import_list - end end end __END__ |