From 639c57ebfba5b860d788218f19622fb52533806f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 15 Jul 2014 18:33:07 -0400 Subject: v5 v6: sysenv, general, base_markup_dir_stub (replace pwd_stub) --- data/doc/sisu/CHANGELOG_v5 | 2 + data/doc/sisu/CHANGELOG_v6 | 2 + lib/sisu/v5/ao_composite.rb | 2 +- lib/sisu/v5/cgi_pgsql.rb | 2 +- lib/sisu/v5/cgi_sqlite.rb | 2 +- lib/sisu/v5/db_create.rb | 4 +- lib/sisu/v5/embedded.rb | 8 +-- lib/sisu/v5/options.rb | 3 +- lib/sisu/v5/param.rb | 4 -- lib/sisu/v5/sysenv.rb | 140 ++++++++++++++++++++++---------------------- lib/sisu/v5/utils.rb | 11 +++- lib/sisu/v6/ao_composite.rb | 2 +- lib/sisu/v6/cgi_pgsql.rb | 2 +- lib/sisu/v6/cgi_sqlite.rb | 2 +- lib/sisu/v6/db_create.rb | 4 +- lib/sisu/v6/embedded.rb | 8 +-- lib/sisu/v6/options.rb | 3 +- lib/sisu/v6/param.rb | 4 -- lib/sisu/v6/sysenv.rb | 140 ++++++++++++++++++++++---------------------- lib/sisu/v6/utils.rb | 11 +++- 20 files changed, 182 insertions(+), 174 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 2650bd15..20893629 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -40,6 +40,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.5.1.orig.tar.xz * bin/sisu, hub, options, message pass sisu_called_from_directory +* sysenv, general, base_markup_dir_stub (replace pwd_stub) + %% 5.5.0.orig.tar.xz (2014-07-11:27/5) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.5.0 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.5.0-1 diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index d908dc06..e01ea795 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -30,6 +30,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.1.1.orig.tar.xz * bin/sisu, hub, options, message pass sisu_called_from_directory +* sysenv, general, base_markup_dir_stub (replace pwd_stub) + %% 6.1.0.orig.tar.xz (2014-07-11:27/5) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.1.0 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.1.0-1 diff --git a/lib/sisu/v5/ao_composite.rb b/lib/sisu/v5/ao_composite.rb index 5cdfaa81..0d5905bc 100644 --- a/lib/sisu/v5/ao_composite.rb +++ b/lib/sisu/v5/ao_composite.rb @@ -85,7 +85,7 @@ module SiSU_Assemble end imagefile.close end - output_path="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + output_path="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" FileUtils::mkdir_p(output_path) \ unless FileTest.directory?(output_path) SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync diff --git a/lib/sisu/v5/cgi_pgsql.rb b/lib/sisu/v5/cgi_pgsql.rb index 1ab04316..a65b8a97 100644 --- a/lib/sisu/v5/cgi_pgsql.rb +++ b/lib/sisu/v5/cgi_pgsql.rb @@ -90,7 +90,7 @@ module SiSU_CGI_PgSQL and @rc['search']['sisu']['db'] =~/\S+/ @rc['search']['sisu']['db'] else - @env.path.stub_pwd #'sisu' #breaks if not present + @env.path.base_markup_dir_stub #'sisu' #breaks if not present end @name_of[:host_url_cgi]=%q{http://#{ENV['HTTP_HOST']}#{ENV['PATH_INFO']}} @name_of[:host_url_docs]=%q{http://#{ENV['HTTP_HOST']}} diff --git a/lib/sisu/v5/cgi_sqlite.rb b/lib/sisu/v5/cgi_sqlite.rb index 2d185f20..fc665074 100644 --- a/lib/sisu/v5/cgi_sqlite.rb +++ b/lib/sisu/v5/cgi_sqlite.rb @@ -118,7 +118,7 @@ module SiSU_CGI_SQLite output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3 puts <<-WOK generated sample search form: #{@cX.green}#{@cgi_file_name}#{@cX.off} - default database name: #{@cX.green}#{Db[:name_prefix]}#{@env.path.stub_pwd}#{@cX.off} (#{@env.path.stub_pwd}) + default database name: #{@cX.green}#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}#{@cX.off} (#{@env.path.base_markup_dir_stub}) cgi & db host on: #{@cX.blue}#{@env.url.webserv_base_cgi(@opt)}#{@cX.off} to modify use: #{@cX.brown}sisu --db-sqlite --webserv-search='#{@env.url.webserv_base_cgi(@opt)}'#{@cX.off} sisu output on: #{@cX.blue}#{@env.url.webserv_files_from_db(@opt)}#{@cX.off} diff --git a/lib/sisu/v5/db_create.rb b/lib/sisu/v5/db_create.rb index 451a0a34..78277c8b 100644 --- a/lib/sisu/v5/db_create.rb +++ b/lib/sisu/v5/db_create.rb @@ -86,13 +86,13 @@ module SiSU_DbCreate @env=SiSU_Env::InfoEnv.new(@opt.fns) tell=(@sql_type==:sqlite) \ ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create SQLite db tables in:',%{"#{@file}"}) - : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}"}) if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) tell.dark_grey_title_hi end - SiSU_Env::SystemCall.new.create_pg_db(@env.path.stub_pwd) if @sql_type==:pg #watch use of path.stub_pwd instead of stub + SiSU_Env::SystemCall.new.create_pg_db(@env.path.base_markup_dir_stub) if @sql_type==:pg #watch use of path.base_markup_dir_stub instead of stub end def output_dir? dir=SiSU_Env::InfoEnv.new('') diff --git a/lib/sisu/v5/embedded.rb b/lib/sisu/v5/embedded.rb index e205353a..c013806b 100644 --- a/lib/sisu/v5/embedded.rb +++ b/lib/sisu/v5/embedded.rb @@ -113,9 +113,9 @@ module SiSU_Embedded def audio #p @md.ec[:audio] src="#{@base_src_dir}/_sisu/mm/audio" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio" + ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio" @rhost.each do |remote_conn| - rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/audio" + rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio" if (@md.opt.act[:verbose][:set]==:on \ || @md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on \ @@ -133,9 +133,9 @@ module SiSU_Embedded def multimedia #p @md.ec[:multimedia] src="#{@base_src_dir}/_sisu/mm/video" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video" + ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video" @rhost.each do |remote_conn| - rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/video" + rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video" if (@md.opt.act[:verbose][:set]==:on \ || @md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on \ diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index e7d0f023..bc4d7da0 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -164,8 +164,7 @@ module SiSU_Commandline @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? @call_path=call_path - @base_path= - call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'') + @base_path=SiSU_Utils::Path.new.base_markup(call_path) r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @base_stub=@base_path.gsub(u,'\1') diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index b2e50d41..ed28701c 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -118,10 +118,6 @@ module SiSU_Param # you may need to change Dir.pwd to @opt.f_pth[:pth] where the latter # has a path value that is different, however, f_pth is not always set! Dir.chdir(@opt.f_pth[:pth]) - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). - error('-- bug alert --') - p 'f_pth ' + @opt.f_pth[:pth] - p 'pwd ' + Dir.pwd end if @@fns !=@fns \ or @@pth !=Dir.pwd #@opt.f_pth[:pth] diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 7358ff40..35d128f6 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -116,13 +116,13 @@ module SiSU_Env share=Config::CONFIG['datadir'] + '/sisu' data=Config::CONFIG['datadir'] + '/doc/sisu' m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @stub_pwd ||=@@pwd[m,1] + @base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub prcss_dir='_sisu_processing_' + '.' + SiSU_is[:version_dir] prcss_dir_tmp_root="/tmp/#{prcss_dir}" - prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" + prcss_dir_stub="#{prcss_dir}/#{@base_markup_dir_stub}" if @@user - tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" - tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" + tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@base_markup_dir_stub}" + tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@base_markup_dir_stub}" else #error tmp_processing=tmp_processing_individual="/tmp/#{prcss_dir_stub}" end @@ -1096,7 +1096,7 @@ module SiSU_Env rescue LoadError SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname or fileutils NOT FOUND (LoadError)') end - 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,:processing_git,:etc,:yamlrc_dir + attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:base_markup_dir_stub,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir @@image_flag,@@local_image=true,true #warning on @@image_flag @@fb,@@man_path=nil,nil def initialize(fns='',md=nil) @@ -1121,11 +1121,10 @@ module SiSU_Env @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters @fixed_websev_root='' # @home @pwd=@@pwd=Dir.pwd - m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @stub_pwd=@@pwd[m,1] || '' #; p __LINE__; #p @pwd; #p m; #p @stub_pwd - @stub_src= @stub_pwd + '/src' - @stub_pod= @stub_pwd + '/pod' - @stub_epub= @stub_pwd + '/epub' + @base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub + @stub_src= @base_markup_dir_stub + '/src' + @stub_pod= @base_markup_dir_stub + '/pod' + @stub_epub= @base_markup_dir_stub + '/epub' pt=Pathname.new(Dir.pwd) stub=if output_dir_structure.by_language_code? r=Px[:lng_lst_rgx] @@ -1206,8 +1205,8 @@ module SiSU_Env @@current_document||=Dir.pwd @@current_document end - def stub_pwd #200412 - @stub_pwd + def base_markup_dir_stub #200412 + @base_markup_dir_stub end def stub_md_harvest #watch @stub_set_manifest @@ -2062,8 +2061,8 @@ WOK def pwd @sys.pwd end - def stub_pwd - @stub_pwd + def base_markup_dir_stub + @base_markup_dir_stub end def stub_epub @stub_epub @@ -2149,10 +2148,11 @@ WOK end def webserv_stub_ensure FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv) - FileUtils::mkdir_p("#{path.webserv}/#{@stub_pwd}") unless FileTest.directory?("#{path.webserv}/#{@stub_pwd}") + FileUtils::mkdir_p("#{path.webserv}/#{@base_markup_dir_stub}") \ + unless FileTest.directory?("#{path.webserv}/#{@base_markup_dir_stub}") end def webserv_map_pwd #dir - "#{path.webserv}/#{stub_pwd}" + "#{path.webserv}/#{base_markup_dir_stub}" end def webserv_dir #fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) defaults[:webserv_dir] @@ -2288,13 +2288,13 @@ WOK end def stub_dir (usr_dir?) \ - ? ("#{root_dir}/#{user}/#{stub_pwd}") - : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path] + ? ("#{root_dir}/#{user}/#{base_markup_dir_stub}") + : ("#{root_dir}/#{base_markup_dir_stub}") # see defaults[:processing_path] end def stub_dir_orig # ends up with lang, if lang dir (usr_dir?) \ - ? ("#{root_dir}/#{user}/#{stub_pwd}") - : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path] + ? ("#{root_dir}/#{user}/#{base_markup_dir_stub}") + : ("#{root_dir}/#{base_markup_dir_stub}") # see defaults[:processing_path] end def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) @opt=opt @@ -2504,21 +2504,21 @@ WOK "http://#{@sys.hostname}" end def dir_url - "file://#{path.webserv}/#{stub_pwd}" + "file://#{path.webserv}/#{base_markup_dir_stub}" end def localhost - "http://localhost/#{stub_pwd}" + "http://localhost/#{base_markup_dir_stub}" end def local - "http://#{hostname}/#{@stub_pwd}" + "http://#{hostname}/#{@base_markup_dir_stub}" end def root if defined? @rc['webserv']['url_root'] \ and @rc['webserv']['url_root'] =~/https?:\/\// - "#{@rc['webserv']['url_root']}/#{@stub_pwd}" + "#{@rc['webserv']['url_root']}/#{@base_markup_dir_stub}" elsif defined? @rc['webserv']['url_root'] \ and @rc['webserv']['url_root'] =~/localhost/ - "http://localhost/#{@stub_pwd}" + "http://localhost/#{@base_markup_dir_stub}" else "file://#{path.output}" end end @@ -2567,14 +2567,14 @@ WOK and @rc['webserv_cgi']['host'].is_a?(String) http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') #check https? missing if port.webserv_port_cgi - "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@stub_pwd}" - else "#{http}#{@rc['webserv_cgi']['host']}/#{@stub_pwd}" + "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@base_markup_dir_stub}" + else "#{http}#{@rc['webserv_cgi']['host']}/#{@base_markup_dir_stub}" end else http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) - "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}/#{@stub_pwd}" - else "#{http}#{webserv_host_base}/#{@stub_pwd}" + "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}/#{@base_markup_dir_stub}" + else "#{http}#{webserv_host_base}/#{@base_markup_dir_stub}" end end http=http.strip @@ -2622,7 +2622,7 @@ WOK @rc['webserv']['url_root'] elsif path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@stub_pwd}") + "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@base_markup_dir_stub}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false "file://#{path.webserv}" @@ -2635,7 +2635,7 @@ WOK def webserv_base #web url for local webserv (localhost, or hostname) if path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}") + "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false "file://#{path.webserv}" @@ -2696,8 +2696,8 @@ WOK when /^filesystem(?:_url)?/ then url.dir_url when /^remote(?:_webserv)?/ then url.remote when /^(?:webserv|local_webserv)/ then url.local - when /^local(:\d+)/ then url.hostname + $1 + '/' + stub_pwd - when /^localhost(:\d+)/ then url.localhost + $1 + '/' + stub_pwd + when /^local(:\d+)/ then url.hostname + $1 + '/' + base_markup_dir_stub + when /^localhost(:\d+)/ then url.localhost + $1 + '/' + base_markup_dir_stub when /^localhost/ then url.localhost when /^webrick/ then url.webrick when /^path/ then url.webserv_map_pwd @@ -2726,7 +2726,7 @@ WOK if FileTest.directory?(image_external) if @@image_flag images=Dir.glob("#{image_external}/*.{png,jpg,gif}") - pth="#{path.webserv}/#{@stub_pwd}" + pth="#{path.webserv}/#{@base_markup_dir_stub}" FileUtils::mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external") images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 @@image_flag=false @@ -3497,9 +3497,9 @@ WOK self.remote_host_base.each do |remote_conn| local_gen=@source_path remote_gen=case @opt.cmd - when /u/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u - when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." - else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + when /u/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." #creates remote directory tree, this is not the usual function of u + when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/#{@fnb}/." + else "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." end local_epub=@source_path_epub local_src=@source_path_src @@ -3544,7 +3544,7 @@ WOK def site_base #base site self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3562,7 +3562,7 @@ WOK 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}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3591,9 +3591,9 @@ WOK if f 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}/." + #local_gen_image="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" + #local_gen_image_external="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" + remote_gen="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." remote_rel=remote_conn[:name] + '/' + f.output_path.stub.rcp @opt.fnc if (local_gen =~/\S/ \ @@ -3748,7 +3748,7 @@ WOK def site_harvest self.remote_host_base.each do |remote_conn| local=@source_path_harvest - l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" + l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" lng='en' if @env.output_dir_structure.by? == :language ldest="#{lng}/manifest" @@ -3774,10 +3774,10 @@ WOK end def site_base #base site ldest='_sisu/*' - l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" + l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" image_sys="#{@env.path.webserv}/_sisu/image_sys" self.remote_host_base.each do |remote_conn| - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}" + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}" remote_conf="#{remote_conn[:name]}/_sisu" SiSU_Env::SystemCall.new(image_sys,remote_conf).rsync SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel) @@ -3786,7 +3786,7 @@ WOK def site_base_sync self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3811,7 +3811,7 @@ WOK def rsync_sitemaps #sitemap directory self.remote_host_base.each do |remote_conn| local="#{@source_path}/sitemapindex.xml" - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if @@flag_remote delete_extra_files='--delete' # '--delete-after' SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files) @@ -6931,8 +6931,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css") "#{@md.doc_css}_html.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css") - "#{@env.path.stub_pwd}_html.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html.css") + "#{@env.path.base_markup_dir_stub}_html.css" else SiSU_Env::CSS_Default.new.html end @@ -6941,8 +6941,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html_tables.css") "#{@md.doc_css}_html_tables.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html_tables.css") - "#{@env.path.stub_pwd}_html_tables.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html_tables.css") + "#{@env.path.base_markup_dir_stub}_html_tables.css" else SiSU_Env::CSS_Default.new.html_tables end end @@ -6950,8 +6950,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css") "#{@md.doc_css}_xhtml.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xhtml.css") - "#{@env.path.stub_pwd}_xhtml.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xhtml.css") + "#{@env.path.base_markup_dir_stub}_xhtml.css" else SiSU_Env::CSS_Default.new.xhtml end end @@ -6959,8 +6959,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_sax.css") "#{@md.doc_css}_xml_sax.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_sax.css") - "#{@env.path.stub_pwd}_xml_sax.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_sax.css") + "#{@env.path.base_markup_dir_stub}_xml_sax.css" else SiSU_Env::CSS_Default.new.xml_sax end end @@ -6968,8 +6968,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_dom.css") "#{@md.doc_css}_xml_dom.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_dom.css") - "#{@env.path.stub_pwd}_xml_dom.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_dom.css") + "#{@env.path.base_markup_dir_stub}_xml_dom.css" else SiSU_Env::CSS_Default.new.xml_dom end end @@ -6977,8 +6977,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css") "#{@md.doc_css}_xml_dom.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_docbook.css") - "#{@env.path.stub_pwd}_docbook.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_docbook.css") + "#{@env.path.base_markup_dir_stub}_docbook.css" else SiSU_Env::CSS_Default.new.docbook_xml end end @@ -6986,8 +6986,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css") "#{@md.doc_css}_homepage.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_homepage.css") - "#{@env.path.stub_pwd}_homepage.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_homepage.css") + "#{@env.path.base_markup_dir_stub}_homepage.css" else SiSU_Env::CSS_Default.new.homepage end end @@ -7047,8 +7047,8 @@ WOK puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (no action taken)} else puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (in order to replace default sisu homepage)} - filename_homepage="#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html" - filename_home_toc="#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html" + filename_homepage="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/index.html" + filename_home_toc="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/toc.html" file_homepage=File.new(filename_homepage,'w') file_home_toc=File.new(filename_home_toc,'w') file_homepage << @vz_home.homepage @@ -7059,10 +7059,10 @@ WOK end def homepage home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") - FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}") + FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") if home_pages_manually_created.length > 0 home_pages_manually_created.each do |homepage| - FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.stub_pwd}") + FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") end else create_default_sisu_homepage(:none) @@ -7088,12 +7088,12 @@ WOK end def cp_local_images src="#{@pwd}/_sisu/image" - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" cp_images(src,dest) if FileTest.directory?(src) end def cp_external_images src="#{@env.processing_path.processing}/external_document/image" - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" if FileTest.directory?(src) cp_images(src,dest) if FileTest.directory?(src) end @@ -7102,7 +7102,7 @@ WOK src=@env.path.image_source dest_arr=[ "#{@env.path.webserv}/_sisu/image", - "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" ] dest_arr.each do |dest| cp_images(src,dest) if FileTest.directory?(src) @@ -7110,14 +7110,14 @@ WOK end def cp_webserver_images_local #this should not have been necessary src=@env.path.image_source - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images src=SiSU_is[:path_base_system_data] + '/image' dest_arr=[ "#{@env.path.webserv}/_sisu/image_sys", - "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_sys" + "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_sys" ] dest_arr.each do |dest| cp_images(src,dest) if FileTest.directory?(src) diff --git a/lib/sisu/v5/utils.rb b/lib/sisu/v5/utils.rb index 9d9a3a51..7db4143a 100644 --- a/lib/sisu/v5/utils.rb +++ b/lib/sisu/v5/utils.rb @@ -174,8 +174,15 @@ module SiSU_Utils def initialize(dir=Dir.pwd) @dir=dir end - def base_markup - (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + def base_markup(call_path=nil) + call_path = call_path \ + ? call_path \ + : Dir.pwd + (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(call_path)[1] + end + def base_markup_stub + m=/.+\/(?:src\/)?(\S+)/im + base_markup[m,1] end def bmd base_markup diff --git a/lib/sisu/v6/ao_composite.rb b/lib/sisu/v6/ao_composite.rb index 078e8ece..eaa4e08f 100644 --- a/lib/sisu/v6/ao_composite.rb +++ b/lib/sisu/v6/ao_composite.rb @@ -85,7 +85,7 @@ module SiSU_Assemble end imagefile.close end - output_path="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + output_path="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" FileUtils::mkdir_p(output_path) \ unless FileTest.directory?(output_path) SiSU_Env::SystemCall.new("#{path}/*",output_path,'q').rsync diff --git a/lib/sisu/v6/cgi_pgsql.rb b/lib/sisu/v6/cgi_pgsql.rb index 8372bb70..38b5c09f 100644 --- a/lib/sisu/v6/cgi_pgsql.rb +++ b/lib/sisu/v6/cgi_pgsql.rb @@ -90,7 +90,7 @@ module SiSU_CGI_PgSQL and @rc['search']['sisu']['db'] =~/\S+/ @rc['search']['sisu']['db'] else - @env.path.stub_pwd #'sisu' #breaks if not present + @env.path.base_markup_dir_stub #'sisu' #breaks if not present end @name_of[:host_url_cgi]=%q{http://#{ENV['HTTP_HOST']}#{ENV['PATH_INFO']}} @name_of[:host_url_docs]=%q{http://#{ENV['HTTP_HOST']}} diff --git a/lib/sisu/v6/cgi_sqlite.rb b/lib/sisu/v6/cgi_sqlite.rb index f64c3cf6..8cf01d3e 100644 --- a/lib/sisu/v6/cgi_sqlite.rb +++ b/lib/sisu/v6/cgi_sqlite.rb @@ -118,7 +118,7 @@ module SiSU_CGI_SQLite output << header0 << header1 << header_desc << header2 << f1 << buttons1 << buttons2 << search_request << search_statement << search_statement_common << search_query1 << @common.pages << search_query2 << @common.tail << @common.main1 << f2 << f3 << dbi_connect << @common.main2 << @common.dir_structure << @common.main3 puts <<-WOK generated sample search form: #{@cX.green}#{@cgi_file_name}#{@cX.off} - default database name: #{@cX.green}#{Db[:name_prefix]}#{@env.path.stub_pwd}#{@cX.off} (#{@env.path.stub_pwd}) + default database name: #{@cX.green}#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}#{@cX.off} (#{@env.path.base_markup_dir_stub}) cgi & db host on: #{@cX.blue}#{@env.url.webserv_base_cgi(@opt)}#{@cX.off} to modify use: #{@cX.brown}sisu --db-sqlite --webserv-search='#{@env.url.webserv_base_cgi(@opt)}'#{@cX.off} sisu output on: #{@cX.blue}#{@env.url.webserv_files_from_db(@opt)}#{@cX.off} diff --git a/lib/sisu/v6/db_create.rb b/lib/sisu/v6/db_create.rb index 01fc1935..a2e3e8c4 100644 --- a/lib/sisu/v6/db_create.rb +++ b/lib/sisu/v6/db_create.rb @@ -86,13 +86,13 @@ module SiSU_DbCreate @env=SiSU_Env::InfoEnv.new(@opt.fns) tell=(@sql_type==:sqlite) \ ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create SQLite db tables in:',%{"#{@file}"}) - : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.stub_pwd}"}) + : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Create pgSQL db tables in:',%{"#{Db[:name_prefix]}#{@env.path.base_markup_dir_stub}"}) if (@opt.act[:verbose][:set]==:on \ || @opt.act[:verbose_plus][:set]==:on \ || @opt.act[:maintenance][:set]==:on) tell.dark_grey_title_hi end - SiSU_Env::SystemCall.new.create_pg_db(@env.path.stub_pwd) if @sql_type==:pg #watch use of path.stub_pwd instead of stub + SiSU_Env::SystemCall.new.create_pg_db(@env.path.base_markup_dir_stub) if @sql_type==:pg #watch use of path.base_markup_dir_stub instead of stub end def output_dir? dir=SiSU_Env::InfoEnv.new('') diff --git a/lib/sisu/v6/embedded.rb b/lib/sisu/v6/embedded.rb index 7a72cac0..cf294891 100644 --- a/lib/sisu/v6/embedded.rb +++ b/lib/sisu/v6/embedded.rb @@ -113,9 +113,9 @@ module SiSU_Embedded def audio #p @md.ec[:audio] src="#{@base_src_dir}/_sisu/mm/audio" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/audio" + ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio" @rhost.each do |remote_conn| - rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/audio" + rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/audio" if (@md.opt.act[:verbose][:set]==:on \ || @md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on \ @@ -133,9 +133,9 @@ module SiSU_Embedded def multimedia #p @md.ec[:multimedia] src="#{@base_src_dir}/_sisu/mm/video" - ldest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/mm/video" + ldest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video" @rhost.each do |remote_conn| - rdest="#{remote_conn[:name]}/#{@env.path.stub_pwd}/_sisu/mm/video" + rdest="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/_sisu/mm/video" if (@md.opt.act[:verbose][:set]==:on \ || @md.opt.act[:verbose_plus][:set]==:on \ || @md.opt.act[:maintenance][:set]==:on \ diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb index 1850c6d4..eed42e51 100644 --- a/lib/sisu/v6/options.rb +++ b/lib/sisu/v6/options.rb @@ -164,8 +164,7 @@ module SiSU_Commandline @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by? @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual? @call_path=call_path - @base_path= - call_path.gsub(/(^|\/)(?:#{Px[:lng_lst_rgx]})$/,'') + @base_path=SiSU_Utils::Path.new.base_markup(call_path) r=Px[:lng_lst_rgx] u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ @base_stub=@base_path.gsub(u,'\1') diff --git a/lib/sisu/v6/param.rb b/lib/sisu/v6/param.rb index bacee802..a39ff215 100644 --- a/lib/sisu/v6/param.rb +++ b/lib/sisu/v6/param.rb @@ -118,10 +118,6 @@ module SiSU_Param # you may need to change Dir.pwd to @opt.f_pth[:pth] where the latter # has a path value that is different, however, f_pth is not always set! Dir.chdir(@opt.f_pth[:pth]) - SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia). - error('-- bug alert --') - p 'f_pth ' + @opt.f_pth[:pth] - p 'pwd ' + Dir.pwd end if @@fns !=@fns \ or @@pth !=Dir.pwd #@opt.f_pth[:pth] diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb index 3c774c46..ec4dbb9e 100644 --- a/lib/sisu/v6/sysenv.rb +++ b/lib/sisu/v6/sysenv.rb @@ -116,13 +116,13 @@ module SiSU_Env share=Config::CONFIG['datadir'] + '/sisu' data=Config::CONFIG['datadir'] + '/doc/sisu' m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @stub_pwd ||=@@pwd[m,1] + @base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub prcss_dir='_sisu_processing_' + '.' + SiSU_is[:version_dir] prcss_dir_tmp_root="/tmp/#{prcss_dir}" - prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" + prcss_dir_stub="#{prcss_dir}/#{@base_markup_dir_stub}" if @@user - tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" - tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@stub_pwd}" + tmp_processing="#{prcss_dir_tmp_root}/#{@@user}/#{@base_markup_dir_stub}" + tmp_processing_individual="#{prcss_dir_tmp_root}/#{@@user}/#{@base_markup_dir_stub}" else #error tmp_processing=tmp_processing_individual="/tmp/#{prcss_dir_stub}" end @@ -1096,7 +1096,7 @@ module SiSU_Env rescue LoadError SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error('pathname or fileutils NOT FOUND (LoadError)') end - 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,:processing_git,:etc,:yamlrc_dir + attr_accessor :filename,:sys,:home,:hostname,:user,:env,:rc,:www,:fnb,:fnn,:fnt,:flv,:webserv_path,:base_markup_dir_stub,:stub_src,:webserv_host_cgi,:webserv_port_cgi,:processing,:processing_git,:etc,:yamlrc_dir @@image_flag,@@local_image=true,true #warning on @@image_flag @@fb,@@man_path=nil,nil def initialize(fns='',md=nil) @@ -1121,11 +1121,10 @@ module SiSU_Env @fnb ||=@@fb #clean up this... used primarily for zap which is not passed normal parameters @fixed_websev_root='' # @home @pwd=@@pwd=Dir.pwd - m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @stub_pwd=@@pwd[m,1] || '' #; p __LINE__; #p @pwd; #p m; #p @stub_pwd - @stub_src= @stub_pwd + '/src' - @stub_pod= @stub_pwd + '/pod' - @stub_epub= @stub_pwd + '/epub' + @base_markup_dir_stub=SiSU_Utils::Path.new.base_markup_stub + @stub_src= @base_markup_dir_stub + '/src' + @stub_pod= @base_markup_dir_stub + '/pod' + @stub_epub= @base_markup_dir_stub + '/epub' pt=Pathname.new(Dir.pwd) stub=if output_dir_structure.by_language_code? r=Px[:lng_lst_rgx] @@ -1206,8 +1205,8 @@ module SiSU_Env @@current_document||=Dir.pwd @@current_document end - def stub_pwd #200412 - @stub_pwd + def base_markup_dir_stub #200412 + @base_markup_dir_stub end def stub_md_harvest #watch @stub_set_manifest @@ -2062,8 +2061,8 @@ WOK def pwd @sys.pwd end - def stub_pwd - @stub_pwd + def base_markup_dir_stub + @base_markup_dir_stub end def stub_epub @stub_epub @@ -2149,10 +2148,11 @@ WOK end def webserv_stub_ensure FileUtils::mkdir_p(path.webserv) unless FileTest.directory?(path.webserv) - FileUtils::mkdir_p("#{path.webserv}/#{@stub_pwd}") unless FileTest.directory?("#{path.webserv}/#{@stub_pwd}") + FileUtils::mkdir_p("#{path.webserv}/#{@base_markup_dir_stub}") \ + unless FileTest.directory?("#{path.webserv}/#{@base_markup_dir_stub}") end def webserv_map_pwd #dir - "#{path.webserv}/#{stub_pwd}" + "#{path.webserv}/#{base_markup_dir_stub}" end def webserv_dir #fixed/hard path to /www web/presentation directory, on Debian /var/www subdirectories are created within it, depending on markup directory stub-name (last segment of markup directory name) defaults[:webserv_dir] @@ -2288,13 +2288,13 @@ WOK end def stub_dir (usr_dir?) \ - ? ("#{root_dir}/#{user}/#{stub_pwd}") - : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path] + ? ("#{root_dir}/#{user}/#{base_markup_dir_stub}") + : ("#{root_dir}/#{base_markup_dir_stub}") # see defaults[:processing_path] end def stub_dir_orig # ends up with lang, if lang dir (usr_dir?) \ - ? ("#{root_dir}/#{user}/#{stub_pwd}") - : ("#{root_dir}/#{stub_pwd}") # see defaults[:processing_path] + ? ("#{root_dir}/#{user}/#{base_markup_dir_stub}") + : ("#{root_dir}/#{base_markup_dir_stub}") # see defaults[:processing_path] end def processing_sisupod(opt=nil) #processing directory, used/needed for sisu work files, has sub-directories (ao,tex etc) @opt=opt @@ -2504,21 +2504,21 @@ WOK "http://#{@sys.hostname}" end def dir_url - "file://#{path.webserv}/#{stub_pwd}" + "file://#{path.webserv}/#{base_markup_dir_stub}" end def localhost - "http://localhost/#{stub_pwd}" + "http://localhost/#{base_markup_dir_stub}" end def local - "http://#{hostname}/#{@stub_pwd}" + "http://#{hostname}/#{@base_markup_dir_stub}" end def root if defined? @rc['webserv']['url_root'] \ and @rc['webserv']['url_root'] =~/https?:\/\// - "#{@rc['webserv']['url_root']}/#{@stub_pwd}" + "#{@rc['webserv']['url_root']}/#{@base_markup_dir_stub}" elsif defined? @rc['webserv']['url_root'] \ and @rc['webserv']['url_root'] =~/localhost/ - "http://localhost/#{@stub_pwd}" + "http://localhost/#{@base_markup_dir_stub}" else "file://#{path.output}" end end @@ -2567,14 +2567,14 @@ WOK and @rc['webserv_cgi']['host'].is_a?(String) http=((@rc['webserv_cgi']['host'] =~ /https?:\/\//) ? '' : 'http://') #check https? missing if port.webserv_port_cgi - "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@stub_pwd}" - else "#{http}#{@rc['webserv_cgi']['host']}/#{@stub_pwd}" + "#{http}#{@rc['webserv_cgi']['host']}:#{port.webserv_port_cgi}/#{@base_markup_dir_stub}" + else "#{http}#{@rc['webserv_cgi']['host']}/#{@base_markup_dir_stub}" end else http=((webserv_host_base=~/https?:\/\//) ? '' : 'http://') if port.webserv_port_cgi(opt) - "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}/#{@stub_pwd}" - else "#{http}#{webserv_host_base}/#{@stub_pwd}" + "#{http}#{webserv_host_base}:#{port.webserv_port_cgi(opt)}/#{@base_markup_dir_stub}" + else "#{http}#{webserv_host_base}/#{@base_markup_dir_stub}" end end http=http.strip @@ -2622,7 +2622,7 @@ WOK @rc['webserv']['url_root'] elsif path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@stub_pwd}") + "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#{@base_markup_dir_stub}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false "file://#{path.webserv}" @@ -2635,7 +2635,7 @@ WOK def webserv_base #web url for local webserv (localhost, or hostname) if path.webserv_dir \ and path.webserv =~ /#{path.webserv_dir}/ #revisit - "#{path.webserv}/#{@stub_pwd}".gsub(/#{path.webserv_dir}/,"#{url.hostname}") + "#{path.webserv}/#{@base_markup_dir_stub}".gsub(/#{path.webserv_dir}/,"#{url.hostname}") elsif defined? @rc['webserv']['webrick_url'] \ and @rc['webserv']['webrick_url']==false "file://#{path.webserv}" @@ -2696,8 +2696,8 @@ WOK when /^filesystem(?:_url)?/ then url.dir_url when /^remote(?:_webserv)?/ then url.remote when /^(?:webserv|local_webserv)/ then url.local - when /^local(:\d+)/ then url.hostname + $1 + '/' + stub_pwd - when /^localhost(:\d+)/ then url.localhost + $1 + '/' + stub_pwd + when /^local(:\d+)/ then url.hostname + $1 + '/' + base_markup_dir_stub + when /^localhost(:\d+)/ then url.localhost + $1 + '/' + base_markup_dir_stub when /^localhost/ then url.localhost when /^webrick/ then url.webrick when /^path/ then url.webserv_map_pwd @@ -2726,7 +2726,7 @@ WOK if FileTest.directory?(image_external) if @@image_flag images=Dir.glob("#{image_external}/*.{png,jpg,gif}") - pth="#{path.webserv}/#{@stub_pwd}" + pth="#{path.webserv}/#{@base_markup_dir_stub}" FileUtils::mkdir_p("#{pth}/_sisu/image_external") unless FileTest.directory?("#{pth}/_sisu/image_external") images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 @@image_flag=false @@ -3497,9 +3497,9 @@ WOK self.remote_host_base.each do |remote_conn| local_gen=@source_path remote_gen=case @opt.cmd - when /u/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." #creates remote directory tree, this is not the usual function of u - when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.stub_pwd}/#{@fnb}/." - else "#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + when /u/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." #creates remote directory tree, this is not the usual function of u + when /[abhHNopwxXy]/ then "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/#{@fnb}/." + else "#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." end local_epub=@source_path_epub local_src=@source_path_src @@ -3544,7 +3544,7 @@ WOK def site_base #base site self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3562,7 +3562,7 @@ WOK 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}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3591,9 +3591,9 @@ WOK if f 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}/." + #local_gen_image="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" + #local_gen_image_external="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" + remote_gen="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." remote_rel=remote_conn[:name] + '/' + f.output_path.stub.rcp @opt.fnc if (local_gen =~/\S/ \ @@ -3748,7 +3748,7 @@ WOK def site_harvest self.remote_host_base.each do |remote_conn| local=@source_path_harvest - l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" + l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" lng='en' if @env.output_dir_structure.by? == :language ldest="#{lng}/manifest" @@ -3774,10 +3774,10 @@ WOK end def site_base #base site ldest='_sisu/*' - l_rel="#{@env.path.webserv}/#{@env.path.stub_pwd}" + l_rel="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}" image_sys="#{@env.path.webserv}/_sisu/image_sys" self.remote_host_base.each do |remote_conn| - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}" + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}" remote_conf="#{remote_conn[:name]}/_sisu" SiSU_Env::SystemCall.new(image_sys,remote_conf).rsync SiSU_Env::SystemCall.new(ldest,remote).rsync('--relative',l_rel) @@ -3786,7 +3786,7 @@ WOK def site_base_sync self.remote_host_base.each do |remote_conn| local=@source_path - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if defined? @rc['permission_set']['remote_base_site'] \ and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ @@ -3811,7 +3811,7 @@ WOK def rsync_sitemaps #sitemap directory self.remote_host_base.each do |remote_conn| local="#{@source_path}/sitemapindex.xml" - remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." + remote="#{remote_conn[:name]}/#{@env.path.base_markup_dir_stub}/." if @@flag_remote delete_extra_files='--delete' # '--delete-after' SiSU_Env::SystemCall.new(local,remote).rsync(delete_extra_files) @@ -6931,8 +6931,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html.css") "#{@md.doc_css}_html.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html.css") - "#{@env.path.stub_pwd}_html.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html.css") + "#{@env.path.base_markup_dir_stub}_html.css" else SiSU_Env::CSS_Default.new.html end @@ -6941,8 +6941,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_html_tables.css") "#{@md.doc_css}_html_tables.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_html_tables.css") - "#{@env.path.stub_pwd}_html_tables.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_html_tables.css") + "#{@env.path.base_markup_dir_stub}_html_tables.css" else SiSU_Env::CSS_Default.new.html_tables end end @@ -6950,8 +6950,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xhtml.css") "#{@md.doc_css}_xhtml.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xhtml.css") - "#{@env.path.stub_pwd}_xhtml.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xhtml.css") + "#{@env.path.base_markup_dir_stub}_xhtml.css" else SiSU_Env::CSS_Default.new.xhtml end end @@ -6959,8 +6959,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_sax.css") "#{@md.doc_css}_xml_sax.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_sax.css") - "#{@env.path.stub_pwd}_xml_sax.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_sax.css") + "#{@env.path.base_markup_dir_stub}_xml_sax.css" else SiSU_Env::CSS_Default.new.xml_sax end end @@ -6968,8 +6968,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_xml_dom.css") "#{@md.doc_css}_xml_dom.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_xml_dom.css") - "#{@env.path.stub_pwd}_xml_dom.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_xml_dom.css") + "#{@env.path.base_markup_dir_stub}_xml_dom.css" else SiSU_Env::CSS_Default.new.xml_dom end end @@ -6977,8 +6977,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_docbook.css") "#{@md.doc_css}_xml_dom.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_docbook.css") - "#{@env.path.stub_pwd}_docbook.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_docbook.css") + "#{@env.path.base_markup_dir_stub}_docbook.css" else SiSU_Env::CSS_Default.new.docbook_xml end end @@ -6986,8 +6986,8 @@ WOK if @md.doc_css \ and FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@md.doc_css}_homepage.css") "#{@md.doc_css}_homepage.css" - elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.stub_pwd}_homepage.css") - "#{@env.path.stub_pwd}_homepage.css" + elsif FileTest.file?("#{@env.path.output}/#{@env.path.style}/#{@env.path.base_markup_dir_stub}_homepage.css") + "#{@env.path.base_markup_dir_stub}_homepage.css" else SiSU_Env::CSS_Default.new.homepage end end @@ -7047,8 +7047,8 @@ WOK puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (no action taken)} else puts %{ place your homepages in directory:\n "#{@env.path.rc}/home/*.html"\n (in order to replace default sisu homepage)} - filename_homepage="#{@env.path.webserv}/#{@env.path.stub_pwd}/index.html" - filename_home_toc="#{@env.path.webserv}/#{@env.path.stub_pwd}/toc.html" + filename_homepage="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/index.html" + filename_home_toc="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/toc.html" file_homepage=File.new(filename_homepage,'w') file_home_toc=File.new(filename_home_toc,'w') file_homepage << @vz_home.homepage @@ -7059,10 +7059,10 @@ WOK end def homepage home_pages_manually_created=Dir.glob("#{@env.path.rc}/home/*.html") - FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.stub_pwd}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.stub_pwd}") + FileUtils::mkdir_p("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") unless FileTest.directory?("#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") if home_pages_manually_created.length > 0 home_pages_manually_created.each do |homepage| - FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.stub_pwd}") + FileUtils.cp(homepage,"#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}") end else create_default_sisu_homepage(:none) @@ -7088,12 +7088,12 @@ WOK end def cp_local_images src="#{@pwd}/_sisu/image" - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" cp_images(src,dest) if FileTest.directory?(src) end def cp_external_images src="#{@env.processing_path.processing}/external_document/image" - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_external" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_external" if FileTest.directory?(src) cp_images(src,dest) if FileTest.directory?(src) end @@ -7102,7 +7102,7 @@ WOK src=@env.path.image_source dest_arr=[ "#{@env.path.webserv}/_sisu/image", - "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" ] dest_arr.each do |dest| cp_images(src,dest) if FileTest.directory?(src) @@ -7110,14 +7110,14 @@ WOK end def cp_webserver_images_local #this should not have been necessary src=@env.path.image_source - dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + dest="#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image" cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images src=SiSU_is[:path_base_system_data] + '/image' dest_arr=[ "#{@env.path.webserv}/_sisu/image_sys", - "#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image_sys" + "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_sys" ] dest_arr.each do |dest| cp_images(src,dest) if FileTest.directory?(src) diff --git a/lib/sisu/v6/utils.rb b/lib/sisu/v6/utils.rb index 5879db27..8995a860 100644 --- a/lib/sisu/v6/utils.rb +++ b/lib/sisu/v6/utils.rb @@ -174,8 +174,15 @@ module SiSU_Utils def initialize(dir=Dir.pwd) @dir=dir end - def base_markup - (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(Dir.pwd)[1] + def base_markup(call_path=nil) + call_path = call_path \ + ? call_path \ + : Dir.pwd + (/(\S+?)(?:\/(?:#{Px[:lng_lst_rgx]}))?$/).match(call_path)[1] + end + def base_markup_stub + m=/.+\/(?:src\/)?(\S+)/im + base_markup[m,1] end def bmd base_markup -- cgit v1.2.3