From ee4968f54c669bf69182a10ff7fc4991b835f6a4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 20 Jan 2014 18:47:20 -0500 Subject: v4 v5: bin/sisu & some related lib changes * good time to consider rollover: closing v4 branch, replacing it with v5 & introducing v6 for development, proposed for this release + 1 --- lib/sisu/v4/constants.rb | 6 ++-- lib/sisu/v4/shared_images.rb | 2 +- lib/sisu/v4/sysenv.rb | 37 ++++++++++------------- lib/sisu/v5/constants.rb | 6 ++-- lib/sisu/v5/shared_images.rb | 2 +- lib/sisu/v5/sysenv.rb | 72 +++++++++++--------------------------------- 6 files changed, 42 insertions(+), 83 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v4/constants.rb b/lib/sisu/v4/constants.rb index f95b1dbd..bb90cdc8 100644 --- a/lib/sisu/v4/constants.rb +++ b/lib/sisu/v4/constants.rb @@ -210,7 +210,7 @@ Px={ po_subscript_o: ',{', po_subscript_c: '},', po_hilite_o: '*{', po_hilite_c: '}*', po_monospace_o: '#{', po_monospace_c: '}#', - lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh], + lng_lst: SiSU_is[:language_list], lv1: '*', lv2: '=', lv3: '=', @@ -239,8 +239,8 @@ else } end Db={ - name_prefix: "SiSU#{SiSU_version_dir}a_", - name_prefix_db: "sisu_#{SiSU_version_dir}a_", + name_prefix: "SiSU#{SiSU_is[:version_dir]}a_", + name_prefix_db: "sisu_#{SiSU_is[:version_dir]}a_", col_title: 800, col_title_part: 400, col_title_edition: 10, diff --git a/lib/sisu/v4/shared_images.rb b/lib/sisu/v4/shared_images.rb index ffcf880f..92f0c894 100644 --- a/lib/sisu/v4/shared_images.rb +++ b/lib/sisu/v4/shared_images.rb @@ -129,7 +129,7 @@ module SiSU_Images end def select_sisu_base images=%w[arrow_next_red.png arrow_prev_red.png arrow_up_red.png dot_clear.png dot_white.png b_doc.png b_epub.png b_odf.png b_pdf.png b_toc.png] - src_path="#{@env.path.share}/image" + src_path="#{SiSU_is[:path_base_system_data]}/image" dest=dest_path(:image_sys) copy(src_path,dest,images) end diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index 341a29f7..bcd7c09d 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -104,7 +104,7 @@ module SiSU_Env data=Config::CONFIG['datadir'] + '/doc/sisu' m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @stub_pwd ||=@@pwd[m,1] - prcss_dir='_sisu_processing_' + '.' + SiSU_version_dir + prcss_dir='_sisu_processing_' + '.' + SiSU_is[:version_dir] prcss_dir_tmp_root="/tmp/#{prcss_dir}" prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" if @@user @@ -282,13 +282,13 @@ module SiSU_Env end def rc_path_options [ - "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_version_dir}", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}", "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", - "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_version_dir}", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}", "#{$sisu_document_markup_directory_base_fixed_path}/_sisu", - "#{@@home}/.sisu/#{SiSU_version_dir}", + "#{@@home}/.sisu/#{SiSU_is[:version_dir]}", "#{@@home}/.sisu", - "#{@@sisu_etc}/#{SiSU_version_dir}", + "#{@@sisu_etc}/#{SiSU_is[:version_dir]}", "#{@@sisu_etc}", ] end @@ -359,13 +359,13 @@ module SiSU_Env tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:' if @markup_dir_changed_ @ad_path=[ - "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_version_dir}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/skin/yml", - "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_version_dir}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}/skin/yml", "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/skin/yml", - "#{@@home}/.sisu/#{SiSU_version_dir}/skin/yml", + "#{@@home}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", "#{@@home}/.sisu/skin/yml", - "#{@@sisu_etc}/#{SiSU_version_dir}/skin/yml", + "#{@@sisu_etc}/#{SiSU_is[:version_dir]}/skin/yml", "#{@@sisu_etc}/skin/yml", ] @ad_path.each do |v| @@ -2849,7 +2849,7 @@ WOK def odf_structure FileUtils::rm_rf(processing_path.processing_path.odf_pth) FileUtils::mkdir_p(processing_path.processing_path.odf_pth) - system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{processing_path.odf_pth}") + system("unzip -q #{path.share}/#{SiSU_is[:version_dir]}/odf/odt.zip -d #{processing_path.odf_pth}") end def sisupod_gen(fns_pod) sisupod_gen_v3(fns_pod) @@ -3591,18 +3591,18 @@ WOK def get_version @version={} @pwd=ENV['PWD'] - yst_ver=SiSU_path_specified_Version_ \ - ? SiSU_path_specified_Version_ - : "#{defaults[:sisu_share]}/#{SiSU_version_dir}/v/version.yml" + yst_ver=SiSU_is[:version_info_path] \ + ? SiSU_is[:version_info_path] + : "#{defaults[:sisu_share]}/#{SiSU_is[:version_dir]}/v/version.yml" lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':') @@lib_path ||=lib_path if File.exist?(yst_ver) @version=YAML::load(File::open(yst_ver)) #unless @@noyaml end - @version[:install_method]=if SiSU_is==:gem_install + @version[:install_method]=if SiSU_is[:run_from]==:gem_install spec = Gem::Specification.find_by_name("sisu") gem_root = spec.gem_dir - (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_version_dir}/,'')) == gem_root) \ + (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is[:version_dir]}/,'')) == gem_root) \ ? ' (ruby gem install)' : '' else '' end @@ -6322,12 +6322,7 @@ WOK cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images - src=if SiSU_path_base == :system_default \ - or SiSU_path_base == nil - @env.path.share + '/image' - else - SiSU_path_base + '/data/sisu/image' - end + 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" diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb index 04c0358a..e84c0901 100644 --- a/lib/sisu/v5/constants.rb +++ b/lib/sisu/v5/constants.rb @@ -224,7 +224,7 @@ Px={ po_subscript_o: ',{', po_subscript_c: '},', po_hilite_o: '*{', po_hilite_c: '}*', po_monospace_o: '#{', po_monospace_c: '}#', - lng_lst: %w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it ja ko la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi zh], + lng_lst: SiSU_is[:language_list], lv1: '*', lv2: '=', lv3: '=', @@ -253,8 +253,8 @@ else } end Db={ - name_prefix: "SiSU#{SiSU_version_dir}a_", - name_prefix_db: "sisu_#{SiSU_version_dir}a_", + name_prefix: "SiSU#{SiSU_is[:version_dir]}a_", + name_prefix_db: "sisu_#{SiSU_is[:version_dir]}a_", col_title: 800, col_title_part: 400, col_title_edition: 10, diff --git a/lib/sisu/v5/shared_images.rb b/lib/sisu/v5/shared_images.rb index b3d3f4fb..e307eba3 100644 --- a/lib/sisu/v5/shared_images.rb +++ b/lib/sisu/v5/shared_images.rb @@ -130,7 +130,7 @@ module SiSU_Images end def select_sisu_base images=%w[arrow_next_red.png arrow_prev_red.png arrow_up_red.png dot_clear.png dot_white.png b_doc.png b_epub.png b_odf.png b_pdf.png b_toc.png] - src_path="#{@env.path.share}/image" + src_path="#{SiSU_is[:path_base_system_data]}/image" dest=dest_path(:image_sys) copy(src_path,dest,images) end diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index e04882d7..aad87231 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -105,7 +105,7 @@ module SiSU_Env data=Config::CONFIG['datadir'] + '/doc/sisu' m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m @stub_pwd ||=@@pwd[m,1] - prcss_dir='_sisu_processing_' + '.' + SiSU_version_dir + prcss_dir='_sisu_processing_' + '.' + SiSU_is[:version_dir] prcss_dir_tmp_root="/tmp/#{prcss_dir}" prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" if @@user @@ -283,13 +283,13 @@ module SiSU_Env end def rc_path_options [ - "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_version_dir}", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}", "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", - "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_version_dir}", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}", "#{$sisu_document_markup_directory_base_fixed_path}/_sisu", - "#{@@home}/.sisu/#{SiSU_version_dir}", + "#{@@home}/.sisu/#{SiSU_is[:version_dir]}", "#{@@home}/.sisu", - "#{@@sisu_etc}/#{SiSU_version_dir}", + "#{@@sisu_etc}/#{SiSU_is[:version_dir]}", "#{@@sisu_etc}", ] end @@ -360,13 +360,13 @@ module SiSU_Env tell_no_yaml='WARNING - YAML loading switched off, to enable delete the file:' if @markup_dir_changed_ @ad_path=[ - "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_version_dir}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/skin/yml", - "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_version_dir}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:version_dir]}/skin/yml", "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/skin/yml", - "#{@@home}/.sisu/#{SiSU_version_dir}/skin/yml", + "#{@@home}/.sisu/#{SiSU_is[:version_dir]}/skin/yml", "#{@@home}/.sisu/skin/yml", - "#{@@sisu_etc}/#{SiSU_version_dir}/skin/yml", + "#{@@sisu_etc}/#{SiSU_is[:version_dir]}/skin/yml", "#{@@sisu_etc}/skin/yml", ] @ad_path.each do |v| @@ -1060,17 +1060,10 @@ module SiSU_Env @fixed_websev_root='' # @home @pwd=@@pwd=Dir.pwd m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m - @stub_pwd=@@pwd[m,1] - @stub_txt= @stub_pwd + '/txt' - @stub_html= @stub_pwd + '/html' - @stub_epub= @stub_pwd + '/epub' - @stub_odt= @stub_pwd + '/odt' - @stub_pdf= @stub_pwd + '/pdf' - @stub_manifest=@stub_pwd + '/manifest' - @stub_odt= @stub_pwd + '/odt' + @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_md= @stub_pwd + '/sisu_site_metadata' + @stub_epub= @stub_pwd + '/epub' pt=Pathname.new(Dir.pwd) stub=if output_dir_structure.by_language_code? r=Px[:lng_lst_rgx] @@ -1946,36 +1939,15 @@ WOK def stub_pwd @stub_pwd end - def stub_txt - @stub_txt - end - def stub_html - @stub_html - end def stub_epub @stub_epub end - def stub_odt - @stub_odt - end - def stub_pdf - @stub_pdf - end - def stub_manifest - @stub_manifest - end - def stub_set_manifest - @stub_set_manifest - end def stub_src @stub_src end def stub_pod @stub_pod end - def stub_md_harvest - @stub_set_manifest - end def etc defaults[:sisu_etc] #live/dynamic end @@ -1989,7 +1961,7 @@ WOK @sys.dir_bin end def share #shared data repository source directory - defaults[:sisu_share] + defaults[:sisu_share] #; p __LINE__.to_s + ':' + __FILE__ + ' ' + defaults[:sisu_share] end def style if @md \ @@ -2904,7 +2876,7 @@ WOK def odf_structure FileUtils::rm_rf(processing_path.processing_path.odf_pth) FileUtils::mkdir_p(processing_path.processing_path.odf_pth) - system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{processing_path.odf_pth}") + system("unzip -q #{path.share}/#{SiSU_is[:version_dir]}/odf/odt.zip -d #{processing_path.odf_pth}") end def sisupod_gen(fns_pod) sisupod_gen_v3(fns_pod) @@ -3709,18 +3681,15 @@ WOK def get_version @version={} @pwd=ENV['PWD'] - yst_ver=SiSU_path_specified_Version_ \ - ? SiSU_path_specified_Version_ - : "#{defaults[:sisu_share]}/#{SiSU_version_dir}/v/version.yml" lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':') @@lib_path ||=lib_path - if File.exist?(yst_ver) - @version=YAML::load(File::open(yst_ver)) #unless @@noyaml + if File.exist?(SiSU_is[:version_info_path]) + @version=YAML::load(File::open(SiSU_is[:version_info_path])) #unless @@noyaml end - @version[:install_method]=if SiSU_is==:gem_install + @version[:install_method]=if SiSU_is[:run_from]==:gem_install spec = Gem::Specification.find_by_name("sisu") gem_root = spec.gem_dir - (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_version_dir}/,'')) == gem_root) \ + (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is[:version_dir]}/,'')) == gem_root) \ ? ' (ruby gem install)' : '' else '' end @@ -6934,12 +6903,7 @@ WOK cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images - src=if SiSU_path_base == :system_default \ - or SiSU_path_base == nil - @env.path.share + '/image' - else - SiSU_path_base + '/data/sisu/image' - end + 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" -- cgit v1.2.3