From d6f18ae946f5a10346e426eba2a4e73e38b464fc Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 23 May 2011 22:22:35 -0400 Subject: v3: sysenv, rsync, embedded: rsync to remote host alt output structures, fix --- data/doc/sisu/CHANGELOG_v3 | 9 +- lib/sisu/v3/embedded.rb | 18 +- lib/sisu/v3/remote.rb | 12 +- lib/sisu/v3/sysenv.rb | 500 ++++++++++++++++++++++++--------------------- 4 files changed, 287 insertions(+), 252 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 75cbf5d8..a52a6d38 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -22,9 +22,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.10.orig.tar.gz * copyright (minor) touch, dates for setup.rb - * sysenv, rsync, get rid of annoying new nag to terminal (-v reporting - Dir.pwd), prevent attempt to change directory unless different directory - requested + * sysenv, rsync, embedded + * rsync to remote host alternative output structures, fix + (remove blocking test path) + * get rid of annoying new nag to terminal (-v reporting + Dir.pwd), prevent attempt to change directory unless different directory + requested * param, html, epub, xml, simplify file-naming convention with language code (language code occurs in fixed location within file-name, could previously diff --git a/lib/sisu/v3/embedded.rb b/lib/sisu/v3/embedded.rb index f6049cec..fad1fb29 100644 --- a/lib/sisu/v3/embedded.rb +++ b/lib/sisu/v3/embedded.rb @@ -70,6 +70,7 @@ module SiSU_Embedded @env=SiSU_Env::Info_env.new(@md.fns) @rhost=SiSU_Env::Info_remote.new(@opt).remote_host_base @base_src_dir=@opt.f_pth[:pth].sub(/\/#{@opt.f_pth[:lng]}$/,'') + @f=SiSU_Env::SiSU_file.new(@md) end def read songsheet @@ -85,18 +86,21 @@ module SiSU_Embedded end def images src="#{@base_src_dir}/_sisu/image" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + src_img='_sisu/image' + ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}" + img_dir="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" @rhost.each do |remote_conn| rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image" + remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp if @md.opt.cmd.inspect =~/[vVMR]/ \ and FileTest.directory?(src) - mkdir_p(ldest) unless FileTest.directory?(ldest) - src_ec="#{src}/" + @md.ec[:image].join(" #{src}/") + mkdir_p(img_dir) unless FileTest.directory?(img_dir) + src_ec=@f.place_file.images.rel + '/' + @md.ec[:image].join(" #{@f.output_path.images.rel}/") unless @opt.fns =~/\.-sst$/ - SiSU_Env::System_call.new(src_ec,"#{ldest}/.",'q').rsync - if @md.opt.cmd.inspect =~/R/ #rsync to remote image directory - SiSU_Env::System_call.new(src_ec,"#{rdest}/.",'q').rsync - end + SiSU_Env::System_call.new(src_ec,ldest,'q').rsync('--relative',@opt.base_path) + #if @md.opt.cmd.inspect =~/R/ #rsync to remote image directory + # SiSU_Env::System_call.new(src_ec,remote_rel,'q').rsync('--relative') + #end end end end diff --git a/lib/sisu/v3/remote.rb b/lib/sisu/v3/remote.rb index d3e4d653..5537d7b4 100644 --- a/lib/sisu/v3/remote.rb +++ b/lib/sisu/v3/remote.rb @@ -71,15 +71,15 @@ module SiSU_Remote end def rsync SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.rsync + @remote.rsync.document end def rsync_base SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.rsync_base + @remote.rsync.site_base end def rsync_base_sync SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','rsync and sync').dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.rsync_base_sync + @remote.rsync.site_base_sync end def rsync_sitemaps SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement sitemaps ->','rsync').dark_grey_title_hi unless @opt.cmd =~/q/ @@ -91,15 +91,15 @@ module SiSU_Remote end def scp SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->',@put).dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.scp + @remote.scp.document end def scp_base SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement of base site ->','excluding images').dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.scp_base + @remote.scp.site_base end def scp_base_all SiSU_Screen::Ansi.new(@opt.cmd,'Remote placement ->','complete').dark_grey_title_hi unless @opt.cmd =~/q/ - @remote.scp_base_all + @remote.scp.site_base_all end end class Get diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index df86904b..a35a9eef 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -523,12 +523,13 @@ module SiSU_Env @m end def filename(code,name,suffix) - d=SiSU_Env::Info_env.new(@fns) - fnl=d.i18n.lang_filename(code) - if code - "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}" - else "#{name}#{suffix}" - end + #d=SiSU_Env::Info_env.new(@fns) + #fnl=d.i18n.lang_filename(code) + "#{name}#{suffix}" + #if code + # "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}" + #else "#{name}#{suffix}" + #end end def lang(code) @fn={ @@ -789,14 +790,14 @@ module SiSU_Env dir_change,dir_return='','' if chdir \ && chdir != Dir.pwd - dir_change="cd #{chdir}" - dir_return='cd -' + dir_change=Dir.chdir(chdir) + dir_return=Dir.pwd end + dir_change system(" - #{dir_change} rsync -az#{vb} #{action} #{@input} #{@output} #{msg} - #{dir_return} ") + dir_return else puts "\tWARN: #{program} not found" end end @@ -2458,7 +2459,7 @@ WOK end class File_map < Info_env attr_accessor :local_sisu_source - def initialize(opt='') #watch + def initialize(opt='') #watch / REVIEW super() @opt=opt #,opt.fns,opt.cmd @env=(@opt.fns && !(@opt.fns.empty?) \ @@ -2725,250 +2726,277 @@ WOK remote_host_base_general end def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built - self.remote_host_base.each do |remote_conn| - local_gen=@source_path - remote_gen=case @opt.cmd - when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u - when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." - else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - end - local_epub=@source_path_epub - local_src=@source_path_src - local_pod=@source_path_pod - remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/." - remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." - remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." - src_txt=@opt.fnc - src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') - if (local_gen =~/\S/ \ - and local_gen !~/\/\//) \ - and (remote_gen =~/\S/ \ - and remote_gen !~/\/\//) \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - System_call.new(local_gen,remote_gen).scp - if FileTest.file?("#{local_src}/#{src_txt}") - System_call.new("#{local_src}/#{src_txt}",remote_src).scp + def document + self.remote_host_base.each do |remote_conn| + local_gen=@source_path + remote_gen=case @opt.cmd + when /u/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u + when /[abhHNopwxXy]/; "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." + else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." end - if FileTest.file?("#{local_pod}/#{src_pod}") - System_call.new("#{local_src}/#{src_pod}",remote_pod).scp + local_epub=@source_path_epub + local_src=@source_path_src + local_pod=@source_path_pod + remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/." + remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." + remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." + src_txt=@opt.fnc + src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') + if (local_gen =~/\S/ \ + and local_gen !~/\/\//) \ + and (remote_gen =~/\S/ \ + and remote_gen !~/\/\//) \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + System_call.new(local_gen,remote_gen).scp + if FileTest.file?("#{local_src}/#{src_txt}") + System_call.new("#{local_src}/#{src_txt}",remote_src).scp + end + if FileTest.file?("#{local_pod}/#{src_pod}") + System_call.new("#{local_src}/#{src_pod}",remote_pod).scp + end + if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") + System_call.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp + end + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "#{local_gen} -> #{remote_gen}" + if FileTest.file?("#{local_src}/#{src_doc}") + puts "#{local_src}/#{src_doc}* -> #{remote_src}" + end + if FileTest.file?("#{local_pod}/#{src_doc}.zip") + puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" + end + else + puts 'suspect scp request, ignored' + puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" + puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end - if FileTest.file?("#{local_epub}/#{@opt.fnb}.epub") - System_call.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp + end + end + def site_base #base site + self.remote_host_base.each do |remote_conn| + local=@source_path + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + if defined? @rc['permission_set']['remote_base_site'] \ + and @rc['permission_set']['remote_base_site'] \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + puts "begin scp_base: #{local} -> #{remote}" + System_call.new("#{local}/#{@env.path.style}/",remote).scp + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "begin scp_base: #{local} -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "#{local_gen} -> #{remote_gen}" - if FileTest.file?("#{local_src}/#{src_doc}") - puts "#{local_src}/#{src_doc}* -> #{remote_src}" + end + end + def site_base_all #base site + self.remote_host_base.each do |remote_conn| + local=@source_path + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + if defined? @rc['permission_set']['remote_base_site'] \ + and @rc['permission_set']['remote_base_site'] \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + puts "begin scp_base_all: #{local} -> #{remote}" + System_call.new("#{local}/_sisu/image_sys/",remote).scp + System_call.new("#{local}/_sisu/image/",remote).scp + System_call.new("#{local}/#{@env.path.style}/",remote).scp + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "scp_base_all: #{local} -> #{remote}" + puts "#{local}/_sisu/image_sys/ -> #{remote}" + puts "#{local}/_sisu/image/ -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end - if FileTest.file?("#{local_pod}/#{src_doc}.zip") - puts "#{local_pod}/#{src_doc}* -> #{remote_pod}" + end + end + self + end + def images_from_skin + skin=Info_skin.new(@md).select + skin_array=nil + skin_images_array=[] + if skin + skin_array=IO.readlines(skin,"\n") + skin_array.each do |l| + if l !~/^#/ + if l =~/([a-z0-9._-]+\.(?:png|jpg|gif))/i + skin_images_array << $1 + end end - else - puts 'suspect scp request, ignored' - puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" - puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end end + skin_images_array end def rsync - 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" - remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - remote_images="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image/." - remote_images_external="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/image_external/." - local_epub=@source_path_epub - local_src=@source_path_src - local_pod=@source_path_pod - remote_epub="#{remote_conn[:name]}/#{@env.path.stub_epub}/." - remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." - remote_pod="#{remote_conn[:name]}/#{@env.path.stub_pod}/." - src_txt=@opt.fnc - src_pod=@opt.fncb.gsub(/(\.ss[mt])(?:\.sst)?$/,'\1.zip') - if (local_gen =~/\S/ \ - and local_gen !~/\/\//) \ - and (remote_gen =~/\S/ \ - and remote_gen !~/\/\//) \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - delete_extra_files='--delete' # '--delete-after' - inp=[] - begin - local_dirs=%{-f"+ */" -f"- *" #{@md.file.output_path.base.dir}/*} - System_call.new(local_dirs,remote_gen,@opt.cmd).rsync - rescue - local_dirs=%{--include='*/' --exclude='*' @md.file.output_path.base.dir} - System_call.new(local_dirs,remote_gen,@opt.cmd).rsync - end - if @opt.cmd =~/h/ \ - && FileTest.file?(@md.file.place_file.html_scroll.dir) - inp << @md.file.output_path.html_seg.rel << @md.file.place_file.html_scroll.rel - end - if @opt.cmd =~/w/ \ - && FileTest.file?(@md.file.place_file.html_concordance.dir) - inp << @md.file.place_file.html_concordance.rel - end - if @opt.cmd =~/e/ \ - && FileTest.file?(@md.file.place_file.epub.dir) - inp << @md.file.place_file.epub.rel - end - if @opt.cmd =~/o/ \ - && FileTest.file?(@md.file.place_file.odt.dir) - inp << @md.file.place_file.odt.rel - end - if @opt.cmd =~/b/ \ - && FileTest.file?(@md.file.place_file.xhtml.dir) - inp << @md.file.place_file.xhtml.rel - end - if @opt.cmd =~/x/ \ - && FileTest.file?(@md.file.place_file.xml_sax.dir) - inp << @md.file.place_file.xml_sax.rel - end - if @opt.cmd =~/X/ \ - && FileTest.file?(@md.file.place_file.xml_dom.dir) - inp << @md.file.place_file.xml_dom.rel - end - if @opt.cmd =~/[at]/ \ - && FileTest.file?(@md.file.place_file.txt.dir) - inp << @md.file.place_file.txt.rel - end - if @opt.cmd =~/N/ \ - && FileTest.file?(@md.file.place_file.hash_digest.dir) - inp << @md.file.place_file.hash_digest.rel - end - if @opt.cmd =~/s/ \ - && FileTest.file?(@md.file.place_file.src.dir) - inp << @md.file.place_file.src.rel - end - if @opt.cmd =~/S/ \ - && FileTest.file?(@md.file.place_file.sisupod.dir) - inp << @md.file.place_file.sisupod.rel - end - if @opt.cmd =~/p/ - inp << @md.file.output_path.pdf.rel + '/' + @opt.fnb + '*' - end - if @opt.cmd =~/y/ \ - && FileTest.file?(@md.file.place_file.manifest.dir) - inp << @md.file.place_file.manifest.rel - end - if inp.length > 0 - local_gen=inp.join(' ') - remote_rel=remote_conn[:name] + '/' + @md.file.output_path.stub.rcp - remote_rel='/home/ralph/tst' - System_call.new(local_gen,remote_rel,@opt.cmd).rsync('--relative',@md.file.output_path.base.dir) - end - if FileTest.file?("#{local_src}/#{src_txt}") + @f=SiSU_Env::SiSU_file.new(@md) + 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" + remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote_rel=remote_conn[:name] + '/' + @f.output_path.stub.rcp + src_txt=@opt.fnc + if (local_gen =~/\S/ \ + and local_gen !~/\/\//) \ + and (remote_gen =~/\S/ \ + and remote_gen !~/\/\//) \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ # System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync - if defined? @md.ec[:image] and not @md.ec[:image].empty? - images="#{local_gen_image}/" + @md.ec[:image].join(" #{local_gen_image}/") -# System_call.new(images,remote_images,@opt.cmd).rsync + delete_extra_files='--delete' # '--delete-after' + inp=[] + if @opt.cmd =~/h/ \ + && 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/ \ + && FileTest.file?(@f.place_file.html_concordance.dir) + inp << @f.place_file.html_concordance.rel + end + if @opt.cmd =~/e/ \ + && FileTest.file?(@f.place_file.epub.dir) + inp << @f.place_file.epub.rel + end + if @opt.cmd =~/o/ \ + && FileTest.file?(@f.place_file.odt.dir) + inp << @f.place_file.odt.rel + end + if @opt.cmd =~/b/ \ + && FileTest.file?(@f.place_file.xhtml.dir) + inp << @f.place_file.xhtml.rel + end + if @opt.cmd =~/x/ \ + && FileTest.file?(@f.place_file.xml_sax.dir) + inp << @f.place_file.xml_sax.rel + end + if @opt.cmd =~/X/ \ + && FileTest.file?(@f.place_file.xml_dom.dir) + inp << @f.place_file.xml_dom.rel + end + if @opt.cmd =~/[at]/ \ + && FileTest.file?(@f.place_file.txt.dir) + inp << @f.place_file.txt.rel + end + if @opt.cmd =~/N/ \ + && FileTest.file?(@f.place_file.hash_digest.dir) + inp << @f.place_file.hash_digest.rel + end + if @opt.cmd =~/s/ \ + && FileTest.file?(@f.place_file.src.dir) + inp << @f.place_file.src.rel + end + if @opt.cmd =~/S/ \ + && FileTest.file?(@f.place_file.sisupod.dir) + inp << @f.place_file.sisupod.rel + end + if @opt.cmd =~/p/ + inp << @f.output_path.pdf.rel + '/' + @opt.fnb + '*' + end + if @opt.cmd =~/y/ \ + && FileTest.file?(@f.place_file.manifest.dir) + inp << @f.place_file.manifest.rel + end + local_gen=if inp.length > 0 + inp.join(' ') + else '' + end + local_css,images,images_external,images_system='','','','' + if @opt.cmd =~/[hwbxX]/ \ + and defined? @md.ec[:image] \ + and not @md.ec[:image].empty? + 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}/") -# System_call.new(images_external,remote_images_external,@opt.cmd).rsync 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? + local_css=@f.output_path.css.rel + images_system='_sisu/image_sys' + if @f.output_path.images.rel.length > 0 + images_skin=@f.place_file.images.rel + '/' + images_from_skin.join(" #{@f.output_path.images.rel}/") + end + end + begin + ##create file structure without copying files?: + ##rsync -av -f"+ */" -f"- *" @f.output_path.base.dir remote:./path/. + #local_dirs=%{-f"+ */" -f"- *" #{@f.output_path.base.dir}/*} + #System_call.new(local_dirs,remote_gen,@opt.cmd).rsync + local=local_gen + ' ' + images + ' ' + images_skin + ' ' + images_system + ' ' + local_css + System_call.new(local,remote_rel,@opt.cmd).rsync('--relative',@f.output_path.base.dir) + rescue + p __LINE__.to_s + ':' + __FILE__ + local_dirs=%{--include='*/' --exclude='*' #{@f.output_path.base.dir}} + System_call.new(local_dirs,remote_gen,@opt.cmd).rsync + end + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "#{local_gen} -> #{remote_gen}" + if FileTest.file?("#{local_src}/#{src_doc}") \ + or FileTest.file?("#{local_src}/#{src_doc}.zip") + puts "#{local_src}/#{src_doc}* -> #{remote_src}" + end + else + puts 'suspect rsync request, ignored' + puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" + puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "#{local_gen} -> #{remote_gen}" - if FileTest.file?("#{local_src}/#{src_doc}") \ - or FileTest.file?("#{local_src}/#{src_doc}.zip") - puts "#{local_src}/#{src_doc}* -> #{remote_src}" - end - else - puts 'suspect rsync request, ignored' - puts "#{local_gen} -> #{remote_gen} remote flag: #{@@flag_remote}" - puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - end - end - end - def scp_base #base site - self.remote_host_base.each do |remote_conn| - local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - if defined? @rc['permission_set']['remote_base_site'] \ - and @rc['permission_set']['remote_base_site'] \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - puts "begin scp_base: #{local} -> #{remote}" - System_call.new("#{local}/#{@env.path.style}/",remote).scp - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "begin scp_base: #{local} -> #{remote}" - puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ end end - end - def scp_base_all #base site - self.remote_host_base.each do |remote_conn| - local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - if defined? @rc['permission_set']['remote_base_site'] \ - and @rc['permission_set']['remote_base_site'] \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - puts "begin scp_base_all: #{local} -> #{remote}" - System_call.new("#{local}/_sisu/image_sys/",remote).scp - System_call.new("#{local}/_sisu/image/",remote).scp - System_call.new("#{local}/#{@env.path.style}/",remote).scp - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "scp_base_all: #{local} -> #{remote}" - puts "#{local}/_sisu/image_sys/ -> #{remote}" - puts "#{local}/_sisu/image/ -> #{remote}" - puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - end - end - end - def rsync_base #base site - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu" - image_sys="#{@env.path.webserv}/_sisu/image_sys" - images="#{@env.path.webserv}/_sisu/image" - self.remote_host_base.each do |remote_conn| - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - remote_conf="#{remote_conn[:name]}/_sisu" - if defined? @rc['permission_set']['remote_base_site'] \ - and @rc['permission_set']['remote_base_site'] \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - System_call.new("#{image_sys}","#{remote_conf}").rsync - System_call.new("#{images}","#{remote_conf}").rsync - System_call.new("#{ldest}","#{remote}").rsync - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "rsync_base: #{local} -> #{remote}" - puts "#{local}/_sisu/image -> #{remote}" - puts "#{local}/_sisu/image_sys/ -> #{remote}" - puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + def site_base #base site + ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu" + image_sys="#{@env.path.webserv}/_sisu/image_sys" + images="#{@env.path.webserv}/_sisu/image" + self.remote_host_base.each do |remote_conn| + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote_conf="#{remote_conn[:name]}/_sisu" + if defined? @rc['permission_set']['remote_base_site'] \ + and @rc['permission_set']['remote_base_site'] \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + System_call.new("#{image_sys}","#{remote_conf}").rsync + System_call.new("#{images}","#{remote_conf}").rsync + System_call.new("#{ldest}","#{remote}").rsync + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "rsync_base: #{local} -> #{remote}" + puts "#{local}/_sisu/image -> #{remote}" + puts "#{local}/_sisu/image_sys/ -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + end end end - end - def rsync_base_sync #base site - self.remote_host_base.each do |remote_conn| - local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." - if defined? @rc['permission_set']['remote_base_site'] \ - and @rc['permission_set']['remote_base_site'] \ - and @@flag_remote==true \ - and @opt.cmd !~/U/ - delete_extra_files='--delete' # '--delete-after' - puts "begin rsync_base_sync: #{local} -> #{remote}" - System_call.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) - System_call.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) - System_call.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files) - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "rsync_base_sync: #{local} -> #{remote}" - puts "#{local}/_sisu/image_sys/ -> #{remote}" - puts "#{local}/_sisu/image/ -> #{remote}" - puts "#{local}/#{@env.path.style}/ -> #{remote}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + def site_base_sync + self.remote_host_base.each do |remote_conn| + local=@source_path + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + if defined? @rc['permission_set']['remote_base_site'] \ + and @rc['permission_set']['remote_base_site'] \ + and @@flag_remote==true \ + and @opt.cmd !~/U/ + delete_extra_files='--delete' # '--delete-after' + puts "begin rsync_base_sync: #{local} -> #{remote}" + System_call.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) + System_call.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) + System_call.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files) + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "rsync_base_sync: #{local} -> #{remote}" + puts "#{local}/_sisu/image_sys/ -> #{remote}" + puts "#{local}/_sisu/image/ -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + end end end + self end def rsync_sitemaps #sitemap directory self.remote_host_base.each do |remote_conn| -- cgit v1.2.3