From 6811ac91f21a434fc7d967c11e1b20f33918c6ea Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 19 Mar 2012 22:07:29 -0400 Subject: v3: 3.2 branch is main (v3dv --> v3); dev (v3dv) branch directories removed * v3dv (3.2) "merged" into v3 (previously 3.1) (& removed) * conf/sisu/v3dv --> conf/sisu/v3 * data/sisu/v3dv --> data/sisu/v3 * lib/sisu/v3dv --> lib/sisu/v3 * bin/sisu* (v3dv references changed to v3) * (--dev modifier (superfluous for the time being) runs main v3 branch) --- lib/sisu/v3/sysenv.rb | 1372 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 967 insertions(+), 405 deletions(-) (limited to 'lib/sisu/v3/sysenv.rb') diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 16dabd36..4383a893 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -65,7 +65,7 @@ module SiSU_Env include FileUtils::Verbose require 'singleton' @@noyaml=false - class Info_date + class InfoDate require 'date' attr_accessor :dt,:t def initialize @@ -91,7 +91,7 @@ module SiSU_Env '2012' end end - class Info_system + class InfoSystem require 'rbconfig' include Singleton @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@rc,@@sisurc_path,@@ad=ENV['USER'],ENV['HOME'],ENV['HOSTNAME'],ENV['PWD'],Config::CONFIG['sysconfdir'] + '/sisu',Config::CONFIG['host'],Config::CONFIG['arch'],%x{ruby -v}.strip,Config::CONFIG['archdir'],Config::CONFIG['sitearchdir'],Config::CONFIG['bindir'],%x{locale charmap}.strip,nil,nil,{} # %x{ruby -v}.strip # Config::CONFIG['rb_ver'] @@ -241,7 +241,7 @@ module SiSU_Env def initialize @user,@home,@hostname,@pwd,@sisu_etc,@host,@arch,@rbver,@dir_arch,@dir_sitearch,@dir_bin,@locale,@default_dir,@rc_path,@yamlrc_path,@ad_path=\ @@user,@@home,@@hostname,@@pwd,@@sisu_etc,@@host,@@arch,@@rbver,@@dir_arch,@@dir_sitearch,@@dir_bin,@@locale,@@default_dir,@@rc_path,@@yamlrc_path,@@ad_path - #note rbver is duplicated in Info_version + #note rbver is duplicated in InfoVersion end end class Load @@ -280,7 +280,7 @@ module SiSU_Env load_prog end end - class Get_init < Info_system + class GetInit < InfoSystem include Singleton @@noyaml=false @@rc,@@sisurc_path,@@vz,@@tx=nil,nil,nil,nil @@ -373,16 +373,16 @@ module SiSU_Env @@ad end end - class Env_call + class EnvCall @@rc,@@fns,@@fnn,@@fnb,@@fnt,@@flv,@@fnz=nil,nil,nil,nil,nil,nil,nil @@ad={} attr_accessor :rc,:fnn,:fnb,:fnt,:fnv,:fnz,:ad def initialize(fns='') super() @fns=fns - @sys=Info_system.instance - @rc=Get_init.instance.sisu_yaml.rc - @ad=Get_init.instance.ads + @sys=InfoSystem.instance + @rc=GetInit.instance.sisu_yaml.rc + @ad=GetInit.instance.ads if @fns \ and @fns != '' \ and @fns !=@@fns @@ -405,56 +405,62 @@ module SiSU_Env @fnn,@fnb,@fnt,@flv,@fnz=@@fnn,@@fnb,@@fnt,@@flv,@@fnz end def output_dir_structure - def by_language_code? - x=if defined? @rc['output_dir_structure_by'] \ - and @rc['output_dir_structure_by'] =~/language/ - true - elsif defined? @rc['output_structure']['by_language'] \ - and @rc['output_structure']['by_language'] ==true - true - else false + def by? + output_structure=:filename #set default output structure + output_structure=if defined? @rc['output_dir_structure_by'] + output_structure=if (@rc['output_dir_structure_by'] =~/dump/) \ + or ((defined? @rc['output_structure']['dump']) \ + && @rc['output_structure']['dump'] ==true) + :dump + elsif (@rc['output_dir_structure_by'] =~/redirect/) \ + or ((defined? @rc['output_structure']['redirect']) \ + && @rc['output_structure']['redirect'] ==true) + :redirect + elsif (@rc['output_dir_structure_by'] =~/language/) \ + or ((defined? @rc['output_structure']['by_language']) \ + && @rc['output_structure']['by_language'] ==true) + :language + elsif (@rc['output_dir_structure_by'] =~/filetype/) \ + or ((defined? @rc['output_structure']['by_filetype']) \ + && @rc['output_structure']['by_filetype'] ==true) + :filetype + elsif (@rc['output_dir_structure_by'] =~/filename/) \ + or ((defined? @rc['output_structure']['by_filename']) \ + && @rc['output_structure']['by_filename'] ==true) + :filename + else #recheck current default + :language + end end end + def dump? + ((by?) ==:dump) \ + ? true + : false + end + def redirect? + ((by?) ==:redirect) \ + ? true + : false + end + def by_language_code? + ((by?) ==:language) \ + ? true + : false + end def by_filetype? - x=if by_language_code? - false - elsif defined? @rc['output_dir_structure_by'] \ - and @rc['output_dir_structure_by'] =~/filetype/ - true - elsif defined? @rc['output_structure']['by_filetype'] \ - and @rc['output_structure']['by_filetype'] ==true - true - else false - end + ((by?) ==:filetype) \ + ? true + : false end def by_filename? - x=if by_language_code? - false - elsif by_filetype? - false - elsif defined? @rc['output_dir_structure_by'] \ - and @rc['output_dir_structure_by'] =~/filename/ - true - elsif defined? @rc['output_structure']['by_filename'] \ - and @rc['output_structure']['by_filename'] ==true - true - else true - end + ((by?) ==:filename) \ + ? true + : false end def multilingual? by_language_code? end - def by? - by=if by_language_code? - 'language' - elsif by_filetype? - 'filetype' - elsif by_filename? - 'filename' - else - 'filename' - end - end self end def document_language_versions_found #REVISIT @@ -472,8 +478,8 @@ module SiSU_Env @fn[:t]=filename[m,2] end end - lng_base=Info_env.new.language_default_set - lang=SiSU_Env::Standardise_language.new + lng_base=SiSU_Env::InfoEnv.new.language_default_set + lang=SiSU_Env::StandardiseLanguage.new langs=lang.codes x=[] if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}") @@ -483,7 +489,7 @@ module SiSU_Env end #x << { f: "#{@fns}", l: lng_base } langs.each do |l| - lng=SiSU_Env::Standardise_language.new(l) + lng=SiSU_Env::StandardiseLanguage.new(l) if FileTest.file?("#{@fn[:m]}~#{lng.code}.#{@fn[:t]}") x << { f: "#{@fn[:m]}~#{lng.code}.#{@fn[:t]}", l: lng.code } elsif FileTest.file?("#{@fn[:m]}~#{lng.name}.#{@fn[:t]}") @@ -521,34 +527,33 @@ module SiSU_Env @fn[:t]=@fns[m,2] end end - lang=SiSU_Env::Standardise_language.new + lang=SiSU_Env::StandardiseLanguage.new langs=lang.codes x=[] if FileTest.file?("#{@fn[:m]}.#{@fn[:t]}"); x << "#{@fn[:m]}.#{@fn[:t]}" end - dir=SiSU_Env::Info_env.new(@fns) + dir=SiSU_Env::InfoEnv.new(@fns) @m << { m: 'sisu_manifest.html', l: 'English' } #fix later, default language langs.each do |l| - lng=SiSU_Env::Standardise_language.new(l) + lng=SiSU_Env::StandardiseLanguage.new(l) fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}" fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}" if FileTest.file?(fns_c) - fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_c) #reconsider file_to_language + fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_c) #reconsider file_to_language lng=fn_set_lang[:n] - fn=SiSU_Env::Env_call.new(fns_c).lang(fn_set_lang[:c]) + fn=SiSU_Env::EnvCall.new(fns_c).lang(fn_set_lang[:c]) @m << { m: fn[:manifest], l: lng } elsif FileTest.file?(fns_l) - fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_l) #reconsider file_to_language + fn_set_lang=SiSU_Env::StandardiseLanguage.new.file_to_language(fns_l) #reconsider file_to_language @fnl=dir.i18n.lang_filename(fn_set_lang[:c]) - fn=SiSU_Env::Env_call.new(fns_l).lang(fn_set_lang[:c]) + fn=SiSU_Env::EnvCall.new(fns_l).lang(fn_set_lang[:c]) @m << { m: fn[:manifest], l: lng } end end - @m.uniq! - @m + @m=@m.uniq end def filename(code,name,suffix) - #d=SiSU_Env::Info_env.new(@fns) + #d=SiSU_Env::InfoEnv.new(@fns) #fnl=d.i18n.lang_filename(code) "#{name}#{suffix}" #if code @@ -604,15 +609,15 @@ module SiSU_Env @fn end end - class System_call + class SystemCall @@locale_flag=false def initialize(input='',output='',cmd='') @input,@output,@cmd=input,output,cmd - @prog=SiSU_Env::Info_program.new - @sys=Info_system.instance + @prog=SiSU_Env::InfoProgram.new + @sys=InfoSystem.instance end def program_found?(program) - found=`whereis #{program}` + found=`which #{program}` #`whereis #{program}` (found =~/bin\/#{program}\b/) ? true : false end def locale #locales utf8 or other @@ -623,10 +628,10 @@ module SiSU_Env end def file_encoding(filename,cmd='') #file encoding program='file' - fnsp=Info_env.new(filename).source_file_with_path + fnsp=SiSU_Env::InfoEnv.new(filename).source_file_with_path if program_found?(program) encoding=%x{file -L #{fnsp}}.strip - encoding.gsub!(/#{fnsp}:(\s+|$)/,'') + encoding=encoding.gsub(/#{fnsp}:(\s+|$)/,'') encoding=if encoding \ and not encoding.empty? encoding @@ -799,9 +804,10 @@ module SiSU_Env end def makeinfo #texinfo program='makeinfo' + options='' #'--force' #'' program_ref="\n\t\tsee http://www.gnu.org/software/texinfo/" (program_found?(program)) \ - ? system("#{program} #{@input}\n") + ? system("#{program} #{options} #{@input}\n") : (puts "\tWARN: #{program} is not installed #{program_ref}") end def scp @@ -846,11 +852,11 @@ module SiSU_Env end end end - class Standardise_language + class StandardiseLanguage require_relative 'i18n' # i18n.rb def initialize(l='') @language=(l.nil? || l.empty?) \ - ? Info_env.new.language_default_set + ? SiSU_Env::InfoEnv.new.language_default_set : l @r=%{(?:#{Px[:lng_lst].join('|')})} @lang_info=SiSU_i18n::Languages.new @@ -962,7 +968,7 @@ module SiSU_Env Px[:lng_lst] # constants.rb end end - class Info_env < Env_call + class InfoEnv < EnvCall require 'pathname' require 'fileutils' include FileUtils @@ -972,7 +978,7 @@ module SiSU_Env def initialize(fns='',md=nil) super() #you may not want to re-execute this static info so frequently! @fns,@md=fns,md - @env=Env_call.new(fns) if fns + @env=SiSU_Env::EnvCall.new(fns) if fns fnb=if @md \ and defined? @md.fnb @md.fnb @@ -986,7 +992,7 @@ module SiSU_Env end if fnb; @@fb ||=fnb end - @sys=Info_system.instance + @sys=InfoSystem.instance @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters @fixed_websev_root='' # @home @pwd=@@pwd=Dir.pwd @@ -1116,10 +1122,9 @@ module SiSU_Env FileUtils::rm_rf(spp) end paths=[] - flv=Env_call.new(opt.fns).document_language_versions_found + flv=SiSU_Env::EnvCall.new(opt.fns).document_language_versions_found flv[:f].each {|l| lng_dirs << l[:l] } - lng_dirs.uniq! - lng_dirs.each do |lng| + lng_dirs.uniq.each do |lng| paths << "#{spp}/doc/#{lng}" end paths \ @@ -1189,12 +1194,174 @@ module SiSU_Env end end def manifest_minitoc? - flag=if defined? @rc['manifest']['minitoc'] \ - and not @rc['manifest']['minitoc'].nil? + flag=if (defined? @rc['manifest']['minitoc'] \ + and not @rc['manifest']['minitoc'].nil?) @rc['manifest']['minitoc'] else false end end + def build + def omit_list + @off_list ||=if (defined? @rc['omit_list'] \ + and not @rc['omit_list'].nil?) + @rc['omit_list'] + elsif (defined? @rc['omit']['list'] \ + and not @rc['omit']['list'].nil?) + @rc['omit']['list'] + else + nil + end + end + def listed?(test) #fix + listed=if omit_list + x=(omit_list.scan(/\b#{test}\b/)).join + test==x \ + ? true + : false + else + false + end + listed + end + def ocn? + if (defined? @rc['omit']['ocn'] \ + and not @rc['omit']['ocn'].nil?) \ + or listed?('ocn') + :off + else + :na + end + end + def toc? + if (defined? @rc['omit']['toc'] \ + and not @rc['omit']['toc'].nil?) \ + or listed?('toc') + :off + else + :na + end + end + def manifest? + if (defined? @rc['omit']['manifest'] \ + and not @rc['omit']['manifest'].nil?) \ + or listed?('manifest') + :off + else + :na + end + end + def links_to_manifest? + flag=if (defined? @rc['omit']['links_to_manifest'] \ + and not @rc['omit']['links_to_manifest'].nil?) \ + or (listed?('links_to_manifest') \ + || listed?('manifest_links')) + :off + else + :na + end + end + def metadata? + if (defined? @rc['omit']['metadata'] \ + and not @rc['omit']['metadata'].nil?) \ + or listed?('metadata') + :off + else + :na + end + end + def minitoc? + flag=if (defined? @rc['omit']['minitoc'] \ + and not @rc['omit']['minitoc'].nil?) \ + or (listed?('minitoc')) + :off + else + :na + end + end + def manifest_minitoc? + flag=if (defined? @rc['omit']['manifest_minitoc'] \ + and not @rc['omit']['manifest_minitoc'].nil?) \ + or listed?('manifest_minitoc') + :off + else + :na + end + end + def html_minitoc? + flag=if (defined? @rc['omit']['html_minitoc'] \ + and not @rc['omit']['html_minitoc'].nil?) \ + or (listed?('html_minitoc') \ + || listed?('minitoc')) + :off + else + :na + end + end + def html_navigation? + flag=if (defined? @rc['omit']['html_navigation'] \ + and not @rc['omit']['html_navigation'].nil?) \ + or listed?('html_navigation') + :off + else + :na + end + end + def html_navigation_bar? + flag=if (defined? @rc['omit']['html_navigation_bar'] \ + and not @rc['omit']['html_navigation_bar'].nil?) \ + or listed?('html_navigation_bar') + :off + else + :na + end + end + def segsubtoc? + flag=if (defined? @rc['omit']['segsubtoc'] \ + and not @rc['omit']['segsubtoc'].nil?) \ + or listed?('segsubtoc') + :off + else + :na + end + end + def html_right_pane? + flag=if (defined? @rc['omit']['html_right_pane'] \ + and not @rc['omit']['html_right_pane'].nil?) \ + or listed?('html_right_pane') + :off + else + :na + end + end + def html_top_band? + flag=if (defined? @rc['omit']['html_top_band'] \ + and not @rc['omit']['html_top_band'].nil?) \ + or listed?('html_top_band') + :off + else + :na + end + end + def search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line + flag=if (defined? @rc['omit']['search_form'] \ + and not @rc['omit']['search_form'].nil?) \ + or listed?('search_form') + :off + else + :na + end + end + def html_search_form? #decide later, as is configured here (in sisurc) and can be turned off on command line + flag=if (defined? @rc['omit']['html_search_form'] \ + and not @rc['omit']['html_search_form'].nil?) \ + or listed?('html_search_form') + :off + else + :na + end + end + self + end def odt_ocn? ((defined? @rc['odt']['ocn']) \ && @rc['odt']['ocn']==true) \ @@ -1208,9 +1375,9 @@ module SiSU_Env : false end def widget #needs (md) #move - @rc=SiSU_Env::Get_init.instance.sisu_yaml.rc - @ad=SiSU_Env::Get_init.instance.ads - @vz=SiSU_Env::Get_init.instance.skin + @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + @ad=SiSU_Env::GetInit.instance.ads + @vz=SiSU_Env::GetInit.instance.skin @flag={ ad: false, md: false, sk: false, rc: false } def promo? @flag[:ad]=if @md.flag_promo && @ad[:flag_promo] @@ -1283,7 +1450,7 @@ module SiSU_Env end end def search_form(type='sisusearch',action=nil,db=nil,table=false) - rc=SiSU_Env::Get_init.instance.sisu_yaml.rc + rc=SiSU_Env::GetInit.instance.sisu_yaml.rc create_form_sisu=if action \ and db \ and action =~/https?:\/\// \ @@ -1339,7 +1506,7 @@ WOK form end def search_form_static(action=nil,db=nil) - rc=SiSU_Env::Get_init.instance.sisu_yaml.rc + rc=SiSU_Env::GetInit.instance.sisu_yaml.rc create_form=if rc['search']['sisu']['flag']==true \ and action \ and db \ @@ -1387,8 +1554,8 @@ WOK self end def widget_static - @rc=SiSU_Env::Get_init.instance.sisu_yaml.rc - @vz=SiSU_Env::Get_init.instance.skin + @rc=SiSU_Env::GetInit.instance.sisu_yaml.rc + @vz=SiSU_Env::GetInit.instance.skin @flag={ ad: false, md: false, sk: false, rc: false } def search? flag=if defined? @rc['search'] \ @@ -1435,7 +1602,7 @@ WOK end end def search_form(action=nil,db=nil) - rc=SiSU_Env::Get_init.instance.sisu_yaml.rc + rc=SiSU_Env::GetInit.instance.sisu_yaml.rc create_form=if defined? rc['search']['sisu']['flag'] \ and rc['search']['sisu']['flag']==true \ and action \ @@ -1584,7 +1751,12 @@ WOK end end def default_output_css - if @env.output_dir_structure.by_language_code? + if (@md.opt.opt_act[:dump][:bool] \ + && @md.opt.opt_act[:dump][:inst]) \ + || (@md.opt.opt_act[:redirect][:bool] \ + && @md.opt.opt_act[:redirect][:inst]) + './' + elsif @env.output_dir_structure.by_language_code? '../../' elsif @env.output_dir_structure.by_filetype? '../' @@ -1626,7 +1798,7 @@ WOK @sys.home end def sisurc_path - Get_init.instance.sisu_yaml.rc_path + GetInit.instance.sisu_yaml.rc_path end def pwd @sys.pwd @@ -1680,7 +1852,14 @@ WOK defaults[:sisu_share] end def style - defaults[:stylesheet_stub] + if (@md.opt.opt_act[:dump][:bool] \ + && @md.opt.opt_act[:dump][:inst]) \ + || (@md.opt.opt_act[:redirect][:bool] \ + && @md.opt.opt_act[:redirect][:inst]) + 'css' + else + defaults[:stylesheet_stub] + end end def sample_data #sample data repository source directory defaults[:sample_data_path] @@ -1689,7 +1868,7 @@ WOK @sys.rc_path end def yamlrc - Get_init.instance.sisu_yaml.rc_path + GetInit.instance.sisu_yaml.rc_path end def man #check use (defined? @rc['webserv']['man']) \ @@ -2437,7 +2616,7 @@ WOK elsif conf; @rc['default']['language'] #3 config: from sisurc.yaml else defaults[:language] #4 sisu: program default end #1 document: param gets - SiSU_Env::Standardise_language.new(l) + SiSU_Env::StandardiseLanguage.new(l) end #def multilingual # x=(defined? @rc['output_structure']['multilingual'] \ @@ -2511,7 +2690,7 @@ WOK end if f_pod \ && FileTest.file?(f_pod) - tree=(SiSU_Env::System_call.new.program_found?('tree')) \ + tree=(SiSU_Env::SystemCall.new.program_found?('tree')) \ ? "tree #{processing_path.processing}/sisupod" : '' if FileTest.directory?(processing_path.processing) @@ -2541,10 +2720,10 @@ WOK sisupod_processing_path end end - class Info_processing_flag + class InfoProcessingFlag attr_accessor :color,:cf_0,:cf_1,:cf_2,:cf_3,:cf_4,:cf_5 def initialize - @rc=Get_init.instance.sisu_yaml.rc + @rc=GetInit.instance.sisu_yaml.rc end def color #processing flag shortcuts (defined? @rc['flag']['color']) ? @rc['flag']['color'] : false @@ -2554,7 +2733,7 @@ WOK and not (@rc['flag']['default'].nil? \ or @rc['flag']['default'].empty?) @rc['flag']['default'] - else '-NQhewpotbxXyYv' + else '-NQhewpotbxXdyYv' end end def cf_1 #processing flag shortcuts @@ -2570,7 +2749,7 @@ WOK and not (@rc['flag']['ii'].nil? \ or @rc['flag']['ii'].empty?) @rc['flag']['ii'] - else '-NQhewpotbxXy' + else '-NQhewpotbxXdy' end end def cf_3 #processing flag shortcuts @@ -2578,7 +2757,7 @@ WOK and not (@rc['flag']['iii'].nil? \ or @rc['flag']['iii'].empty?) @rc['flag']['iii'] - else '-NQhewpotbxXyY' + else '-NQhewpotbxXdyY' end end def cf_4 #processing flag shortcuts @@ -2586,7 +2765,7 @@ WOK and not (@rc['flag']['iv'].nil? \ or @rc['flag']['iv'].empty?) @rc['flag']['iv'] - else '-NQhewpotbxXDyY --update' + else '-NQhewpotbxXdDyY --update' end end def cf_5 #processing flag shortcuts @@ -2594,11 +2773,11 @@ WOK and not (@rc['flag']['v'].nil? \ or @rc['flag']['v'].empty?) @rc['flag']['v'] - else '-NQhewpotbxXDyYv --update' + else '-NQhewpotbxXdDyYv --update' end end end - class Info_settings < Info_env + class InfoSettings < InfoEnv def permission?(prog) #program defaults (defined? @rc['permission_set'][prog]) \ ? @rc['permission_set'][prog] @@ -2610,14 +2789,14 @@ WOK : false end end - class File_map < Info_env + class FileMap < InfoEnv attr_accessor :local_sisu_source def initialize(opt='') #watch / REVIEW super() @opt=opt #,opt.fns,opt.cmd @env=(@opt.fns && !(@opt.fns.empty?) \ - ? (SiSU_Env::Info_env.new(@opt.fns)) - : (SiSU_Env::Info_env.new('dummy.sst'))) + ? (SiSU_Env::InfoEnv.new(@opt.fns)) + : (SiSU_Env::InfoEnv.new('dummy.sst'))) if @opt.cmd =~/m/; @md=SiSU_Param::Parameters.new(@opt).get end ft=[] @@ -2735,19 +2914,21 @@ WOK : @source_path end end - class Clean_output + class CleanOutput require 'fileutils' include FileUtils::Verbose def initialize(opt) @opt=opt - z=File_map.new(@opt) + z=SiSU_Env::FileMap.new(@opt) @zap=z.local_sisu_source if @opt.cmd =~ /[hH]/ @zap=Dir.glob(@zap).join(' ') - if @opt.cmd !~ /w/; @zap.gsub!(/#{@source_path}\/concordance.html/,'') + @zap=if @opt.cmd !~ /w/ + @zap.gsub(/#{@source_path}\/concordance.html/,'') + else @zap end end - @env=SiSU_Env::Info_env.new + @env=SiSU_Env::InfoEnv.new end def zap def main_output @@ -2781,11 +2962,11 @@ WOK self end end - class Info_remote_host + class InfoRemoteHost def initialize - @rc=Get_init.instance.sisu_yaml.rc + @rc=GetInit.instance.sisu_yaml.rc end - def remote_host #see Info_remote remote_host_base_general + def remote_host #see InfoRemote remote_host_base_general r=[] r=if (defined? @rc['remote'] \ and @rc['remote'].class==Array) @@ -2829,48 +3010,48 @@ WOK end def rhost def r1 - (defined? SiSU_Env::Info_remote_host.new.remote_host[0][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[0][:name]) + (defined? SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) \ + ? (SiSU_Env::InfoRemoteHost.new.remote_host[0][:name]) : nil end def r2 - (defined? SiSU_Env::Info_remote_host.new.remote_host[1][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[1][:name]) + (defined? SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) \ + ? (SiSU_Env::InfoRemoteHost.new.remote_host[1][:name]) : nil end def r3 - (defined? SiSU_Env::Info_remote_host.new.remote_host[2][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[2][:name]) + (defined? SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) \ + ? (SiSU_Env::InfoRemoteHost.new.remote_host[2][:name]) : nil end def r4 - (defined? SiSU_Env::Info_remote_host.new.remote_host[3][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[3][:name]) + (defined? SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) \ + ? (SiSU_Env::InfoRemoteHost.new.remote_host[3][:name]) : nil end def r5 - (defined? SiSU_Env::Info_remote_host.new.remote_host[4][:name]) \ - ? (SiSU_Env::Info_remote_host.new.remote_host[4][:name]) + (defined? SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) \ + ? (SiSU_Env::InfoRemoteHost.new.remote_host[4][:name]) : nil end def r6 - (defined? SiSU_Env::Info_remote_host.new.remote_host[5][:name]) \ - ? (@ls + SiSU_Env::Info_remote_host.new.remote_host[5][:name]) + (defined? SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) \ + ? (@ls + SiSU_Env::InfoRemoteHost.new.remote_host[5][:name]) : nil end self end end - class Info_remote < File_map + class InfoRemote < FileMap @@flag_remote=false require 'socket' def initialize(opt) super(opt) # @opt=opt - @rc=Get_init.instance.sisu_yaml.rc + @rc=GetInit.instance.sisu_yaml.rc end def remote_host_base_general - SiSU_Env::Info_remote_host.new.remote_host + SiSU_Env::InfoRemoteHost.new.remote_host end def remote_host_base remote_host_base_general.each do |remote_conn| @@ -2901,15 +3082,15 @@ WOK and remote_gen !~/\/\//) \ and @@flag_remote==true \ and @opt.cmd !~/U/ - System_call.new(local_gen,remote_gen).scp + SiSU_Env::SystemCall.new(local_gen,remote_gen).scp if FileTest.file?("#{local_src}/#{src_txt}") - System_call.new("#{local_src}/#{src_txt}",remote_src).scp + SiSU_Env::SystemCall.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 + SiSU_Env::SystemCall.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 + SiSU_Env::SystemCall.new("#{local_epub}/#{@opt.fnb}.epub",remote_epub,@opt.cmd).scp end elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ @@ -2936,7 +3117,7 @@ WOK and @@flag_remote==true \ and @opt.cmd !~/U/ puts "begin scp_base: #{local} -> #{remote}" - System_call.new("#{local}/#{@env.path.style}/",remote).scp + SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "begin scp_base: #{local} -> #{remote}" @@ -2954,9 +3135,9 @@ WOK 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 + SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).scp + SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).scp + SiSU_Env::SystemCall.new("#{local}/#{@env.path.style}/",remote).scp elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "scp_base_all: #{local} -> #{remote}" @@ -2970,7 +3151,7 @@ WOK self end def images_from_skin - skin=Info_skin.new(@md).select + skin=SiSU_Env::InfoSkin.new(@md).select skin_array=nil skin_images_array=[] if skin @@ -2986,7 +3167,7 @@ WOK skin_images_array end def rsync - @f=SiSU_Env::SiSU_file.new(@md) + @f=SiSU_Env::FileOp.new(@md) def document self.remote_host_base.each do |remote_conn| local_gen=@source_path @@ -3001,7 +3182,7 @@ WOK and remote_gen !~/\/\//) \ and @@flag_remote==true \ and @opt.cmd !~/U/ -# System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync +# SiSU_Env::SystemCall.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync delete_extra_files='--delete' # '--delete-after' inp=[] if (@opt.cmd =~/h/ \ @@ -3108,13 +3289,13 @@ WOK ##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 + #SiSU_Env::SystemCall.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) + SiSU_Env::SystemCall.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 + SiSU_Env::SystemCall.new(local_dirs,remote_gen,@opt.cmd).rsync end elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ @@ -3141,9 +3322,9 @@ WOK 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 + SiSU_Env::SystemCall.new("#{image_sys}","#{remote_conf}").rsync + SiSU_Env::SystemCall.new("#{images}","#{remote_conf}").rsync + SiSU_Env::SystemCall.new("#{ldest}","#{remote}").rsync elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "rsync_base: #{local} -> #{remote}" @@ -3164,9 +3345,9 @@ WOK 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) + SiSU_Env::SystemCall.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) + SiSU_Env::SystemCall.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) + SiSU_Env::SystemCall.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}" @@ -3185,7 +3366,7 @@ WOK remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." if @@flag_remote delete_extra_files='--delete' # '--delete-after' - System_call.new(local,remote).rsync(delete_extra_files) + SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files) elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "rsync_sitemaps: #{local} -> #{remote}" @@ -3199,7 +3380,7 @@ WOK remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." if @@flag_remote delete_extra_files='--delete' # '--delete-after' - System_call.new(local,remote).rsync(delete_extra_files) + SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files) elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "rsync_sitemaps: #{local} -> #{remote}" @@ -3208,7 +3389,7 @@ WOK end end end - class Info_version } @@ -5143,15 +5705,15 @@ WOK %{} end end - class Create_site < Info_env + class CreateSite < InfoEnv require_relative 'css' # css.rb include SiSU_Style def initialize(cmd) @cmd=cmd - @env=SiSU_Env::Info_env.new + @env=SiSU_Env::InfoEnv.new @home,@pwd=ENV['HOME'],ENV['PWD'] #@pwd=Dir.pwd - @rc=Get_init.instance.sisu_yaml.rc - @vz=SiSU_Env::Get_init.instance.skin + @rc=GetInit.instance.sisu_yaml.rc + @vz=SiSU_Env::GetInit.instance.skin @vz_home=SiSU_Viz::Home.new end def homepage @@ -5203,7 +5765,7 @@ WOK def cp_external_images src="#{@env.processing_path.processing}/external_document/image" dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" - if FileTest.directory?(src) + if FileTest.directory?(src) cp_images(src,dest) end end @@ -5240,7 +5802,7 @@ WOK end else SiSU_Screen::Ansi.new(@cmd,"modify css is not set or is set to: false").warn if @cmd=~/[MV]/ end - fn_css=SiSU_Env::CSS_default.new + fn_css=SiSU_Env::CSS_Default.new css=SiSU_Style::CSS.new path_style="#{@env.path.output}/#{@env.path.style}" FileUtils::mkdir_p(path_style) unless FileTest.directory?(path_style) -- cgit v1.2.3