From fed01af686fb007454eafff9127b16a6516b50c0 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 17 Jun 2012 22:38:31 -0400 Subject: v3: shared_sisupod_source, common build for sisu (markup) source representations * to be used by sisupod.txz, git, (and src) * sisupod_make (--sisupod) * share_source (--source) NOTE not used git at present * changed representation of shared sisu source, include related files in directory rather than just markup file [reason for version bump] NOTE there are no changes to sisu markup (only the sharing of source files) --- lib/sisu/v3/hub.rb | 79 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 28 deletions(-) (limited to 'lib/sisu/v3/hub.rb') diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index d5ab7bdd..f221c9a8 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -64,12 +64,11 @@ module SiSU class OptionLoopFiles def initialize(opt) @opt=opt - @r=Px[:lng_lst].join('|') + @r=Px[:lng_lst_rgx] end def loop_files_on_given_option @opt.files.each_with_index do |fno,i| - @opt.fns=fno - @opt.fno=fno + @opt.fno,@opt.fns=fno,fno @opt.f_pth=@opt.f_pths[i] if fno !~/\.-sst$/ @opt.pth=@opt.paths[i] @@ -113,7 +112,7 @@ module SiSU end end def manifest_on_files_translated - r=Px[:lng_lst].join('|') + r=Px[:lng_lst_rgx] number_of_files={} @opt.files.each_with_index do |fns,i| fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') @@ -385,14 +384,6 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on SiSU_DAL::Source.new(@opt).read end end - if @opt.act[:share_source][:set]==:on - if @opt.fno =~/\.ssm$/ - SiSU_Screen::Ansi.new(@opt.cmd,'WARNING: share text source (--source) not available for composite files (.ssm),', 'composite (.ssm) source documents may be shared as a sisupod (--sisupod) (.txz)').warn unless @opt.cmd =~/q/ - else - requires('share_src') # -s share_src.rb - SiSU_Markup::Source.new(@opt).read - end - end if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q requires('qrcode') # -Q qrcode.rb SiSU_QRcode::Source.new(@opt).read @@ -468,34 +459,66 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on end end def post_loop_files_on_given_option_do - if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod - requires('sisupod_make') # -S sisupod_make.rb + if @opt.act[:share_source][:set]==:on \ + or @opt.act[:sisupod][:set]==:on \ + or @opt.act[:git][:set]==:on begin + requires('shared_sisupod_source') OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_Doc::Source.new(@opt).read + SiSU_Source::SiSUpodSource.new(@opt).read + end + if @opt.act[:share_source][:set]==:on +#REDO + requires('share_src') # -s share_src.rb + begin + ensure + OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do + SiSU_Markup::Source.new(@opt).read + end + end + end + if @opt.act[:sisupod][:set]==:on #% --sisupod, -S make sisupod + requires('sisupod_make') # -S sisupod_make.rb + begin + ensure + OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do + SiSU_Doc::Source.new(@opt).sisupod_tar_xz + end + end + end + if @opt.act[:git][:set]==:on #% --git, -g sisu git + requires('git') # -g git.rb + begin + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Git::Source.new(@opt).read + end + ensure + OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do + SiSU_Git::Source.new(@opt).git_commit + end + end end ensure - OptionLoopFiles.new(@opt).loop_files_on_given_option_bundle do - SiSU_Doc::Source.new(@opt).sisupod_tar_xz + path_pod=@env.processing_path.processing_sisupod(@opt).paths + unless @opt.cmd =~/M/ + FileUtils::rm_rf("#{path_pod[:sisupod]}/*") if FileTest.directory?(path_pod[:sisupod]) + #FileUtils::rm_rf("#{path_pod[:fnb]}/*") if FileTest.directory?(path_pod[:fnb]) end end end - if @opt.act[:images][:set]==:on #% --images, -j - requires('shared_images') - OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_Images::Source.new(@opt).read # -j shared_images.rb - end - end if @opt.act[:po4a][:set]==:on #% --po4a, -P requires('po4a') - OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_Po4a::Source.new(@opt).read # -P po4a.rb + begin + OptionLoopFiles.new(@opt).loop_files_on_given_option do + SiSU_Po4a::Source.new(@opt).read # -P po4a.rb + end + ensure end end - if @opt.act[:git][:set]==:on #% --git, -g sisu git - requires('git') + if @opt.act[:images][:set]==:on #% --images, -j + requires('shared_images') OptionLoopFiles.new(@opt).loop_files_on_given_option do - SiSU_Git::Source.new(@opt).read # -g git.rb + SiSU_Images::Source.new(@opt).read # -j shared_images.rb end end if @opt.cmd =~/T/ #% -T termsheet/standard form -- cgit v1.2.3