diff options
Diffstat (limited to 'lib/sisu/v0/sysenv.rb')
-rw-r--r-- | lib/sisu/v0/sysenv.rb | 330 |
1 files changed, 205 insertions, 125 deletions
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 4080795d..510324c7 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -339,9 +339,9 @@ module SiSU_Env end end class Env_call - @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv=nil,nil,nil,nil,nil,nil + @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil @@ad={} - attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:ad + attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad def initialize(fns='') super() @fns=fns @@ -349,22 +349,28 @@ module SiSU_Env @rc=Get_init.instance.yamlrc @ad=Get_init.instance.ads if @fns and @fns != '' and @fns !=@@fns - @@fns,@@fnn,@@fnb,@@fnt,@@flv=@fns,nil,nil,nil,nil + @@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=@fns,nil,nil,nil,nil,nil end if @fns and @fns != '' #watch if multilingual - m=/((.+?)(?:\~\w{2,3})?)\.([_-]?sst|ssm)$/ + m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst|ssm)$/ @@fnn ||=@fns[m,1] @@fnb ||=@fns[m,2] @@fnt ||=@fns[m,3] @@flv ||=document_language_versions_found[:f] - else m=/(.+?)\.([_-]?sst|ssm)$/ + @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' + else @@fnb + '.sst.zip' + end + else m=/(.+?)\.((?:-|ssm\.)?sst|ssm)$/ @@fnb ||=@fns[m,1] @@fnm ||=@fns[m,1] @@fnt ||=@fns[m,2] + @@fnz ||=if @@fns =~/(?:\~\S{2,3})?\.(?:ssm\.sst|ssm)$/; @@fnb + '.ssm.zip' + else @@fnb + '.sst.zip' + end end end - @fnn,@fnb,@fnt,@flv=@@fnn,@@fnb,@@fnt,@@flv + @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz end def multilingual if defined? @rc['default']['multilingual'] and @rc['default']['multilingual'] != nil; @rc['default']['multilingual'] @@ -375,9 +381,9 @@ module SiSU_Env @fn={} unless (@fns.nil? or @fns.empty?) if multilingual - m=/((.+?)(?:\~\w{2,3})?)\.([_-]?sst$)/ + m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/ @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3] - else m=/(.+?)\.([_-]?sst$)/ + else m=/(.+?)\.((?:-|ssm\.)?sst$)/ @fn[:b]=@fn[:m]=@fns[m,1] @fn[:t]=@fns[m,2] end @@ -405,10 +411,10 @@ module SiSU_Env @m=[] unless (@fns.nil? or @fns.empty?) if multilingual - m=/((.+?)(?:\~\w{2,3})?)\.([_-]?sst$)/ + m=/((.+?)(?:\~\w{2,3})?)\.((?:-|ssm\.)?sst$)/ @fn[:b],@fn[:m],@fn[:t]=@fns[m,1],@fns[m,2],@fns[m,3] #@fl[:v]=@env.document_language_versions_found - else m=/(.+?)\.([_-]?sst$)/ + else m=/(.+?)\.((?:-|ssm\.)?sst$)/ @fn[:b]=@fn[:m]=@fns[m,1] @fn[:t]=@fns[m,2] end @@ -442,7 +448,10 @@ module SiSU_Env def filename(code,name,suffix) d=SiSU_Env::Info_env.new(@fns) fnl=d.i18n.lang_filename(code) - "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}" + if code + "#{fnl[:pre]}#{name}#{fnl[:mid]}#{suffix}#{fnl[:post]}" + else "#{name}#{suffix}" + end end def lang(code) @fn={ @@ -469,7 +478,8 @@ module SiSU_Env :sitemap_touch => filename(code,"sitemap_#@fnb",'.xml'), :sxs => filename(code,@fnb,'.sxs.xml'), :sxd => filename(code,@fnb,'.sxd.xml'), - :sxn => filename(code,@fnb,'.sxn.xml') + :sxn => filename(code,@fnb,'.sxn.xml'), + :sisupod => filename(nil,@fnz,'') } @fn end @@ -734,7 +744,7 @@ module SiSU_Env language[:c] end def file_to_language(file) - m=/.+?\~(\w{2,3})\.[_-]?sst$/ + m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/ @language=if file =~m ; file[m,1] else '' end @@ -747,7 +757,7 @@ module SiSU_Env class Info_env < Env_call require 'fileutils' include FileUtils - attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:webserv_host_cgi,:webserv_port_cgi,:processing,:etc,:yamlrc_dir + attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:stub_pwd,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:etc,:yamlrc_dir @@image_flag,@@local_image=true,true #warning on @@image_flag @@fb=@@man_path=nil,nil def initialize(fns='',md=nil) @@ -757,7 +767,7 @@ module SiSU_Env fnb=if @md and defined? @md.fnb; @md.fnb elsif defined? @env.fnb and @env.fnb; @env.fnb elsif not @fns.nil? and not @fns.empty? - m=/(.+)?\.(?:[_-]?sst|ssm)$/m + m=/(.+)?\.(?:(?:-|ssm\.)?sst|ssm)$/m @fns[m,1] if not @fns.empty? end if fnb; @@fb ||=fnb @@ -768,6 +778,7 @@ module SiSU_Env @pwd=@@pwd||=Dir.pwd m=/.+\/(\S+)/m @stub_pwd=@@pwd[m,1] + @stub_src=@stub_pwd + '/src' end def user @sys.user @@ -800,6 +811,9 @@ module SiSU_Env def stub_pwd #200412 @stub_pwd end + def stub_src + @stub_src + end def sisupod #path.processing # sisupod @@ -1096,17 +1110,17 @@ WOK self end def source_file_path - file=@fns.gsub(/(\.ssm)/,'._sst') - pth=unless file =~/\._sst$/; "#{Dir.pwd}" + file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') + pth=unless file =~/\.ssm\.sst$/; "#{Dir.pwd}" else "#{path.composite_file}" end end def source_file_with_path - file=@fns.gsub(/(\.ssm)/,'._sst') + file=@fns.gsub(/\.ssm(?:\.sst)?/,'.ssm.sst') "#{source_file_path}/#{file}" end def read_source_file(fns) - fns_array=unless fns =~/\._sst$/ + fns_array=unless fns =~/\.ssm.sst$/ IO.readlines(fns,'') else IO.readlines("#{path.composite_file}/#{fns}",'') end @@ -1121,6 +1135,9 @@ WOK def stub_pwd @stub_pwd end + def stub_src + @stub_src + end def etc defaults[:sisu_etc] #live/dynamic # @sys.sisu_etc #broken: live/dynamic @@ -1208,6 +1225,9 @@ WOK def output #web/webserv output directory... subdirectory into which further subdirectories are made based on file names "#{path.webserv}/#@stub_pwd" end + def output_src #web/webserv output directory... subdirectory into which further subdirectories are made based on file names + "#{path.webserv}/src" + end def manpage "#{path.output}/man" end @@ -1523,11 +1543,11 @@ WOK require 'ftools' images=Dir.glob("#{defaults[:image_local]}/*.{png,jpg,gif}") pth="#{path.webserv}/#@stub_pwd" - File.mkpath("#{pth}/_sisu/image_local") unless FileTest.directory?("#{pth}/_sisu/image_local") + File.mkpath("#{pth}/_sisu/image") unless FileTest.directory?("#{pth}/_sisu/image") images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 @@image_flag=false end - '../_sisu/image_local' + '../_sisu/image' else if @@local_image==true cmd=if @cmd; @cmd @@ -1892,7 +1912,7 @@ WOK end if @md.cmd =~ /s/; ft << @md.fns end - if @md.cmd =~ /S/; ft << 'sisupod.zip' << '.kdi' + if @md.cmd =~ /S/; ft << @md.fn[:sisupod] << '.kdi' end @fnb=@md.fnb else # still needed where/when param is not parsed @@ -1912,7 +1932,7 @@ WOK end if @opt.cmd =~ /i/; ft << '.1' << '??.man.1' << 'man.??.1' end - if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' + if @opt.cmd =~ /a/; ft << 'plain.txt' << '??.plain.txt' << 'plain.??.txt' end if @opt.cmd =~ /[g]/; ft << 'wiki.txt' << '??.wiki.txt' << 'wiki.??.txt' end @@ -1924,7 +1944,7 @@ WOK end if @opt.cmd =~ /s/; ft << '.sst' << '.ssi' << '.ssm' end - if @opt.cmd =~ /S/; ft << 'sisupod.zip' << '.kdi' + if @opt.cmd =~ /S/; ft << '.zip' << '.kdi' end if @opt.mod.inspect =~ /sxm|sxs|xml/; ft << @fnb << '.sxs.xml' end @@ -1943,6 +1963,9 @@ WOK @source_path=if @fnb and not @fnb.empty?; "#{@env.path.output}/#@fnb" else @env.path.output end + @source_path_src=if @fnb and not @fnb.empty?; "#{@env.path.output}/src" + else @env.path.output_src + end @local_sisu_source=if @filetypes =~/\S/; "#@source_path/#@filetypes" else @source_path end @@ -1981,23 +2004,38 @@ WOK @rc=Get_init.instance.yamlrc end def remote_host #see Info_remote remote_host_base_general - r={} - r=if (defined? @rc['remote']['user'] and defined? @rc['remote']['host']) - r[:user]=@rc['remote']['user'] - r[:host]=@rc['remote']['host'] - r[:path]=if defined? @rc['remote']['path'] + r=[] + r=if (defined? @rc['remote'] and @rc['remote'].class==Array) + r_array=@rc['remote'] + r_array.each_with_index do |renv,i| + r[i]={} + if defined? renv['user'] and defined? renv['host'] + end + r[i][:user]=renv['user'] + r[i][:host]=renv['host'] + r[i][:path]=if defined? renv['path'] + renv['path'] + else '' + end + r[i][:name]="#{r[i][:user]}@#{r[i][:host]}:#{r[i][:path]}" + end + r + elsif (defined? @rc['remote'] and @rc['remote'].class==Hash and defined? @rc['remote']['user'] and defined? @rc['remote']['host']) + r[0][:user]=@rc['remote']['user'] + r[0][:host]=@rc['remote']['host'] + r[0][:path]=if defined? @rc['remote']['path'] @rc['remote']['path'] else '' end - r[:name]="#{r[:user]}@#{r[:host]}:#{r[:path]}" + r[0][:name]="#{r[:user]}@#{r[:host]}:#{r[:path]}" r else - r[:name]='.' - r[:user]='' - r[:host]='' - r[:path]='' - r + r[0][:name]='.' + r[0][:user]='' + r[0][:host]='' + r[0][:path]='' #puts "no remote host or user" + r end end end @@ -2013,112 +2051,154 @@ WOK SiSU_Env::Info_remote_host.new.remote_host end def remote_host_base - remote=remote_host_base_general - #host_ip=IPSocket.getaddress(remote[:host]) unless remote[:host].empty? - @@flag_remote=true if remote[:name] =~/\S+?@\S+/ #and host_ip =~/\d+\.\d+\.\d+\.\d+/ #very naive check should be enough /[0-255]+\.[0-255]+\.[0-255]+\.[0-255]+/ - remote_host_base_general[:name] + remote_host_base_general.each do |remote_conn| + #host_ip=IPSocket.getaddress(remote[:host]) unless remote[:host].empty? + @@flag_remote=true if remote_conn[:name] =~/\S+?@\S+/ + #remote_conn[:name] + end + 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 - input=@local_sisu_source - output=case @opt.cmd - when /u/; "#{self.remote_host_base}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u - when /[abhHNopwxXy]/; "#{self.remote_host_base}/#{@env.path.stub_pwd}/#{@fnb}/." - else "#{self.remote_host_base}/#{@env.path.stub_pwd}/." - end - if (input =~/\S/ and input !~/\/\//) and (output =~/\S/ and output !~/\/\//) and @@flag_remote==true and @opt.cmd !~/U/ - System_call.new(input,output).scp - elsif @opt.cmd =~/U/; puts "#{input} -> #{output}" - else puts 'suspect scp request, ignored' + 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 + #remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + local_src=@source_path_src + remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." + 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}") or FileTest.file?("#{local_src}/#{src_pod}") + System_call.new("#{local_src}/#{src_txt} #{local_src}/#{src_pod}",remote_src).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}") or FileTest.file?("#{local_src}/#{src_doc}.zip") + puts "#{local_src}/#{src_doc}* -> #{remote_src}" + 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 end def rsync - input=@source_path - output="#{self.remote_host_base}/#{@env.path.stub_pwd}/." - if (input =~/\S/ and input !~/\/\//) and (output =~/\S/ and output !~/\/\//) and @@flag_remote==true and @opt.cmd !~/U/ - System_call.new(input,output,@opt.cmd).rsync('--delete-after') - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "#{input} -> #{output}" - else - puts 'suspect rsync request, ignored' - puts "#{input} -> #{output} remote flag: #@@flag_remote" - puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + self.remote_host_base.each do |remote_conn| + local_gen=@source_path + remote_gen="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + local_src=@source_path_src + remote_src="#{remote_conn[:name]}/#{@env.path.stub_src}/." + 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,@opt.cmd).rsync('--delete-after') + if FileTest.file?("#{local_src}/#{src_txt}") or FileTest.file?("#{local_src}/#{src_pod}") + System_call.new("#{local_src}/#{src_txt} #{local_src}/#{src_pod}",remote_src,@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 end end def scp_base #base site - input=@source_path - output="#{remote_host_base}/#{@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: #{input} -> #{output}" - System_call.new("#{input}/#{@env.path.style}/",output).scp - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "begin scp_base: #{input} -> #{output}" - puts "#{input}/#{@env.path.style}/ -> #{output}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + 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 - input=@source_path - output="#{remote_host_base}/#{@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: #{input} -> #{output}" - System_call.new("#{input}/_sisu/image/",output).scp - System_call.new("#{input}/_sisu/image_local/",output).scp - System_call.new("#{input}/#{@env.path.style}/",output).scp - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "scp_base_all: #{input} -> #{output}" - puts "#{input}/_sisu/image/ -> #{output}" - puts "#{input}/_sisu/image_local/ -> #{output}" - puts "#{input}/#{@env.path.style}/ -> #{output}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + 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/",remote).scp + System_call.new("#{local}/_sisu/image_local/",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/ -> #{remote}" + puts "#{local}/_sisu/image_local/ -> #{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 - input=@source_path - output="#{remote_host_base}/#{@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 rsync_base: #{input} -> #{output}" - #System_call.new("#{input}/_sisu/image/",output).rsync - #System_call.new("#{input}/_sisu/image_local/",output).rsync - #System_call.new("#{input}/#{@env.path.style}/",output).rsync - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "rsync_base: #{input} -> #{output}" - puts "#{input}/_sisu/image/ -> #{output}" - puts "#{input}/_sisu/image_local/ -> #{output}" - puts "#{input}/#{@env.path.style}/ -> #{output}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + 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 rsync_base: #{local} -> #{remote}" + #System_call.new("#{local}/_sisu/image/",remote).rsync + #System_call.new("#{local}/_sisu/image_local/",remote).rsync + #System_call.new("#{local}/#{@env.path.style}/",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_local/ -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + end end end def rsync_base_sync #base site - input=@source_path - output="#{remote_host_base}/#{@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 rsync_base_sync: #{input} -> #{output}" - System_call.new("#{input}/_sisu/image/",output).rsync('--delete-after') - System_call.new("#{input}/_sisu/image_local/",output).rsync('--delete-after') - System_call.new("#{input}/#{@env.path.style}/",output).rsync('--delete-after') - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "rsync_base_sync: #{input} -> #{output}" - puts "#{input}/_sisu/image/ -> #{output}" - puts "#{input}/_sisu/image_local/ -> #{output}" - puts "#{input}/#{@env.path.style}/ -> #{output}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + 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 rsync_base_sync: #{local} -> #{remote}" + System_call.new("#{local}/_sisu/image/",remote).rsync('--delete-after') + System_call.new("#{local}/_sisu/image_local/",remote).rsync('--delete-after') + System_call.new("#{local}/#{@env.path.style}/",remote).rsync('--delete-after') + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "rsync_base_sync: #{local} -> #{remote}" + puts "#{local}/_sisu/image/ -> #{remote}" + puts "#{local}/_sisu/image_local/ -> #{remote}" + puts "#{local}/#{@env.path.style}/ -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + end end end def rsync_sitemaps #sitemap directory - input="#@source_path/sitemapindex.xml" - output="#{remote_host_base}/#{@env.path.stub_pwd}/." - if @@flag_remote - #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(input,output).rsync('--delete-after') - elsif @opt.cmd =~/U/ - puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ - puts "rsync_sitemaps: #{input} -> #{output}" - else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + self.remote_host_base.each do |remote_conn| + local="#@source_path/sitemapindex.xml" + remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + if @@flag_remote + #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(local,remote).rsync('--delete-after') + elsif @opt.cmd =~/U/ + puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + puts "rsync_sitemaps: #{local} -> #{remote}" + else puts "permission not granted #{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ + end end end end @@ -2145,7 +2225,7 @@ WOK end def images File.mkpath("#{@env.path.output}/_sisu") unless FileTest.directory?("#{@env.path.output}/_sisu") - File.symlink("../../_sisu/image", "#{@env.path.output}/_sisu/image") unless File.exist?("#{@env.path.output}/_sisu/image") or File.symlink?("#{@env.path.output}/_sisu/image") + File.symlink("../../_sisu/image_sys", "#{@env.path.output}/_sisu/image_sys") unless File.exist?("#{@env.path.output}/_sisu/image_sys") or File.symlink?("#{@env.path.output}/_sisu/image_sys") end def man_forms #File.symlink("../../man/form", "#{@env.path.output}/man/form") unless File.symlink?("#{@env.path.output}/man/form") == true @@ -2160,7 +2240,7 @@ WOK @fns=fns end def basefilename - m=/(.+?)\.(?:[_-]?sst|ssm)$/m + m=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/m fnb=@fns[m,1] end def project @@ -2584,7 +2664,7 @@ WOK end def cp_local_images src="#@pwd/_sisu/image" - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_local" + dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" cp_images(src,dest) end def cp_external_images @@ -2599,7 +2679,7 @@ WOK end def cp_base_images #fix images src="#{@env.path.share}/image" - dest="#{@env.path.webserv}/_sisu/image" + dest="#{@env.path.webserv}/_sisu/image_sys" cp_images(src,dest) end def cp_css |