diff options
author | Ralph Amissah <ralph@amissah.com> | 2015-01-11 21:18:06 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2015-01-19 23:46:16 -0500 |
commit | 802bf61f72cf3cff29298b1816a79bb2b8d1dacf (patch) | |
tree | 4336251d54a99e80c8e2412e8ff561d04aefdc86 | |
parent | bin + c&d: RbConfig (instead of Config, switch) (diff) |
bin/sisu + c&d: SiSU_is now methods (instead of hash)
-rw-r--r-- | bin/sisu | 51 | ||||
-rw-r--r-- | data/doc/sisu/CHANGELOG_v5 | 2 | ||||
-rw-r--r-- | data/doc/sisu/CHANGELOG_v6 | 2 | ||||
-rw-r--r-- | lib/sisu/current/constants.rb | 8 | ||||
-rw-r--r-- | lib/sisu/current/se_createsite.rb | 2 | ||||
-rw-r--r-- | lib/sisu/current/se_get_init.rb | 16 | ||||
-rw-r--r-- | lib/sisu/current/se_info_env.rb | 4 | ||||
-rw-r--r-- | lib/sisu/current/se_info_system.rb | 2 | ||||
-rw-r--r-- | lib/sisu/current/se_version.rb | 12 | ||||
-rw-r--r-- | lib/sisu/current/shared_images.rb | 2 | ||||
-rw-r--r-- | lib/sisu/develop/constants.rb | 8 | ||||
-rw-r--r-- | lib/sisu/develop/se_createsite.rb | 2 | ||||
-rw-r--r-- | lib/sisu/develop/se_get_init.rb | 16 | ||||
-rw-r--r-- | lib/sisu/develop/se_info_system.rb | 2 | ||||
-rw-r--r-- | lib/sisu/develop/se_version.rb | 12 | ||||
-rw-r--r-- | lib/sisu/develop/shared_images.rb | 2 |
16 files changed, 83 insertions, 60 deletions
@@ -90,7 +90,7 @@ class Orient self end def sisu_lib - "sisu/#{branch_name?}" + "sisu/#{branch_name_}" end def sisu_path_lib if sisu_path_specified_lib \ @@ -102,7 +102,7 @@ class Orient def sisu_version_info_path "#{sisu_path_base_system_data}/version/#{branch_name?}.yml" end - def branch_name? + def branch_name_ if sisu_run_from? == :full_path_to_sisu_bin_in_sisu_dir_tree \ or sisu_run_from? == :system_install case processing.called_as @@ -124,7 +124,7 @@ class Orient else processing.current end end - def branch_version? + def branch_version_ if sisu_run_from? == :full_path_to_sisu_bin_in_sisu_dir_tree \ or sisu_run_from? == :system_install case processing.called_as @@ -205,18 +205,37 @@ class Orient self end def sisu_is - { - run_from: sisu_run_from?, - branch_name: branch_name?, - branch_version: branch_version?, - path_base: sisu_path_base, - path_base_system_data: sisu_path_base_system_data, - path_lib: sisu_path_lib, - version_info_path: sisu_version_info_path, - language_list: language_list.codes, - language_list_regex: language_list.regex, - called_from: sisu_called_from_directory, - } + def run_from? + sisu_run_from? + end + def branch_name? + branch_name_ + end + def branch_version? + branch_version_ + end + def path_base? + sisu_path_base + end + def path_base_system_data? + sisu_path_base_system_data + end + def path_lib? + sisu_path_lib + end + def version_info_path? + sisu_version_info_path + end + def language_list? + language_list.codes + end + def language_list_regex? + language_list.regex + end + def called_from? + sisu_called_from_directory + end + self end def get_processing_info def sortout @@ -258,7 +277,7 @@ class Orient self end def control - require "#{sisu_is[:path_lib]}/hub" + require "#{sisu_is.path_lib?}/hub" sisu_called_from_directory begin if get_processing_info.processing_files.length > 0 diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index c0e9d59d..33b3e5f9 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -82,6 +82,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.8.0.orig.tar.xz marked up documents, i.e. to place translated versions of a sisu document under po4a management + * SiSU_is switched to a method (instead of a hash) (bin and lib) + * use RbConfig instead of Config * sisu.org addition, modification, consider diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 6047115b..a8206116 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -94,6 +94,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.4.0.orig.tar.xz * utils_composite, composite documents (.ssm) extract the list of insert files + * SiSU_is switched to a method (instead of a hash) (bin and lib) + * use RbConfig instead of Config * sisu.org addition, modification, consider diff --git a/lib/sisu/current/constants.rb b/lib/sisu/current/constants.rb index aa0b368e..7a23027d 100644 --- a/lib/sisu/current/constants.rb +++ b/lib/sisu/current/constants.rb @@ -230,8 +230,8 @@ Px={ po_subscript_o: ',{', po_subscript_c: '},', po_hilite_o: '*{', po_hilite_c: '}*', po_monospace_o: '#{', po_monospace_c: '}#', - lng_lst: SiSU_is[:language_list], - lng_lst_rgx: SiSU_is[:language_list_regex], + lng_lst: SiSU_is.language_list?, + lng_lst_rgx: SiSU_is.language_list_regex?, lv1: '*', lv2: '=', lv3: '=', @@ -260,8 +260,8 @@ else } end Db={ - name_prefix: "SiSU#{SiSU_is[:branch_version]}c_", - name_prefix_db: "sisu_#{SiSU_is[:branch_version]}c_", + name_prefix: "SiSU#{SiSU_is.branch_version?}c_", + name_prefix_db: "sisu_#{SiSU_is.branch_version?}c_", col_title: 800, col_title_part: 400, col_title_edition: 10, diff --git a/lib/sisu/current/se_createsite.rb b/lib/sisu/current/se_createsite.rb index 591c0d3d..2d20007a 100644 --- a/lib/sisu/current/se_createsite.rb +++ b/lib/sisu/current/se_createsite.rb @@ -163,7 +163,7 @@ module SiSU_Create_Site cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images - src=SiSU_is[:path_base_system_data] + '/image' + src=SiSU_is.path_base_system_data? + '/image' dest_arr=[ "#{@env.path.webserv}/_sisu/image_sys", "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_sys" diff --git a/lib/sisu/current/se_get_init.rb b/lib/sisu/current/se_get_init.rb index 478bc3a2..a299cd10 100644 --- a/lib/sisu/current/se_get_init.rb +++ b/lib/sisu/current/se_get_init.rb @@ -80,13 +80,13 @@ module SiSU_Get_Init end def rc_path_options [ - "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:branch_version]}", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is.branch_version?}", "#{$sisu_document_markup_directory_base_fixed_path}/.sisu", - "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:branch_version]}", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is.branch_version?}", "#{$sisu_document_markup_directory_base_fixed_path}/_sisu", - "#{@@home}/.sisu/#{SiSU_is[:branch_version]}", + "#{@@home}/.sisu/#{SiSU_is.branch_version?}", "#{@@home}/.sisu", - "#{@@sisu_etc}/#{SiSU_is[:branch_version]}", + "#{@@sisu_etc}/#{SiSU_is.branch_version?}", "#{@@sisu_etc}", ] end @@ -167,13 +167,13 @@ module SiSU_Get_Init 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_is[:branch_version]}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is.branch_version?}/skin/yml", "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/skin/yml", - "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:branch_version]}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is.branch_version?}/skin/yml", "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/skin/yml", - "#{@@home}/.sisu/#{SiSU_is[:branch_version]}/skin/yml", + "#{@@home}/.sisu/#{SiSU_is.branch_version?}/skin/yml", "#{@@home}/.sisu/skin/yml", - "#{@@sisu_etc}/#{SiSU_is[:branch_version]}/skin/yml", + "#{@@sisu_etc}/#{SiSU_is.branch_version?}/skin/yml", "#{@@sisu_etc}/skin/yml", ] @ad_path.each do |v| diff --git a/lib/sisu/current/se_info_env.rb b/lib/sisu/current/se_info_env.rb index 276f14e6..0ddac47e 100644 --- a/lib/sisu/current/se_info_env.rb +++ b/lib/sisu/current/se_info_env.rb @@ -2104,8 +2104,8 @@ WOK FileUtils::rm_rf(processing_path.processing_path.odf_pth) FileUtils::mkdir_p(processing_path.processing_path.odf_pth) system( - "unzip -q #{path.share}/#{SiSU_is[:branch_name]}/odf/odt.zip -d #{processing_path.odf_pth}" - #"unzip -q #{path.share}/#{SiSU_is[:branch_version]}/odf/odt.zip -d #{processing_path.odf_pth}" + "unzip -q #{path.share}/#{SiSU_is.branch_name?}/odf/odt.zip -d #{processing_path.odf_pth}" + #"unzip -q #{path.share}/#{SiSU_is.branch_version?}/odf/odt.zip -d #{processing_path.odf_pth}" ) end def sisupod_gen(fns_pod) diff --git a/lib/sisu/current/se_info_system.rb b/lib/sisu/current/se_info_system.rb index d1c9380f..969b508a 100644 --- a/lib/sisu/current/se_info_system.rb +++ b/lib/sisu/current/se_info_system.rb @@ -73,7 +73,7 @@ module SiSU_Info_Sys_Gen 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[:branch_version] + prcss_dir='_sisu_processing_' + '.' + SiSU_is.branch_version? prcss_dir_tmp_root="/tmp/#{prcss_dir}" prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" if @@user diff --git a/lib/sisu/current/se_version.rb b/lib/sisu/current/se_version.rb index 834c9aed..156b4406 100644 --- a/lib/sisu/current/se_version.rb +++ b/lib/sisu/current/se_version.rb @@ -82,18 +82,18 @@ module SiSU_Info_Version ? @@lib_path : `echo $RUBYLIB`.split(':') @@lib_path ||=lib_path - if File.exist?(SiSU_is[:version_info_path]) - @version=YAML::load(File::open(SiSU_is[:version_info_path])) + if File.exist?(SiSU_is.version_info_path?) + @version=YAML::load(File::open(SiSU_is.version_info_path?)) end - @version[:install_method]=if SiSU_is[:run_from]==: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_is[:branch_name]}/,'')) == gem_root) \ + (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is.branch_name?}/,'')) == gem_root) \ ? ' (ruby gem install)' : '' else '' end - @version[:branch_name]=SiSU_is[:branch_name] - @version[:branch_version]=SiSU_is[:branch_version] + @version[:branch_name]=SiSU_is.branch_name? + @version[:branch_version]=SiSU_is.branch_version? @version[:branch_number]=/^v([0-9]+)$/.match(@version[:branch_version])[1] @version end diff --git a/lib/sisu/current/shared_images.rb b/lib/sisu/current/shared_images.rb index 4357b0a0..6d244945 100644 --- a/lib/sisu/current/shared_images.rb +++ b/lib/sisu/current/shared_images.rb @@ -125,7 +125,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="#{SiSU_is[:path_base_system_data]}/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/develop/constants.rb b/lib/sisu/develop/constants.rb index 8f108b75..0c4c258d 100644 --- a/lib/sisu/develop/constants.rb +++ b/lib/sisu/develop/constants.rb @@ -241,8 +241,8 @@ Px={ subscript_o: '[', subscript_c: ']', hilite_o: '*', hilite_c: '*', monospace_o: '', monospace_c: '', - lng_lst: SiSU_is[:language_list], - lng_lst_rgx: SiSU_is[:language_list_regex], + lng_lst: SiSU_is.language_list?, + lng_lst_rgx: SiSU_is.language_list_regex?, lv1: '*', lv2: '=', lv3: '=', @@ -271,8 +271,8 @@ else } end Db={ - name_prefix: "SiSU#{SiSU_is[:branch_version]}c_", - name_prefix_db: "sisu_#{SiSU_is[:branch_version]}c_", + name_prefix: "SiSU#{SiSU_is.branch_version?}c_", + name_prefix_db: "sisu_#{SiSU_is.branch_version?}c_", col_title: 800, col_title_part: 400, col_title_edition: 10, diff --git a/lib/sisu/develop/se_createsite.rb b/lib/sisu/develop/se_createsite.rb index d2210625..4981eda0 100644 --- a/lib/sisu/develop/se_createsite.rb +++ b/lib/sisu/develop/se_createsite.rb @@ -163,7 +163,7 @@ module SiSU_Create_Site cp_images(src,dest) if FileTest.directory?(src) end def cp_base_images #fix images - src=SiSU_is[:path_base_system_data] + '/image' + src=SiSU_is.path_base_system_data? + '/image' dest_arr=[ "#{@env.path.webserv}/_sisu/image_sys", "#{@env.path.webserv}/#{@env.path.base_markup_dir_stub}/_sisu/image_sys" diff --git a/lib/sisu/develop/se_get_init.rb b/lib/sisu/develop/se_get_init.rb index 0434aea5..dd767d05 100644 --- a/lib/sisu/develop/se_get_init.rb +++ b/lib/sisu/develop/se_get_init.rb @@ -191,17 +191,17 @@ module SiSU_Get_Init 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_is[:branch_name]}/skin/yml", - "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is[:branch_version]}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is.branch_name?}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/#{SiSU_is.branch_version?}/skin/yml", "#{$sisu_document_markup_directory_base_fixed_path}/.sisu/skin/yml", - "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:branch_name]}/skin/yml", - "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is[:branch_version]}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is.branch_name?}/skin/yml", + "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/#{SiSU_is.branch_version?}/skin/yml", "#{$sisu_document_markup_directory_base_fixed_path}/_sisu/skin/yml", - "#{@@home}/.sisu/#{SiSU_is[:branch_name]}/skin/yml", - "#{@@home}/.sisu/#{SiSU_is[:branch_version]}/skin/yml", + "#{@@home}/.sisu/#{SiSU_is.branch_name?}/skin/yml", + "#{@@home}/.sisu/#{SiSU_is.branch_version?}/skin/yml", "#{@@home}/.sisu/skin/yml", - "#{@@sisu_etc}/#{SiSU_is[:branch_name]}/skin/yml", - "#{@@sisu_etc}/#{SiSU_is[:branch_version]}/skin/yml", + "#{@@sisu_etc}/#{SiSU_is.branch_name?}/skin/yml", + "#{@@sisu_etc}/#{SiSU_is.branch_version?}/skin/yml", "#{@@sisu_etc}/skin/yml", ] @ad_path.each do |v| diff --git a/lib/sisu/develop/se_info_system.rb b/lib/sisu/develop/se_info_system.rb index be9e9d48..e688395c 100644 --- a/lib/sisu/develop/se_info_system.rb +++ b/lib/sisu/develop/se_info_system.rb @@ -73,7 +73,7 @@ module SiSU_Info_Sys_Gen 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[:branch_version] + prcss_dir='_sisu_processing_' + '.' + SiSU_is.branch_version? prcss_dir_tmp_root="/tmp/#{prcss_dir}" prcss_dir_stub="#{prcss_dir}/#{@stub_pwd}" if @@user diff --git a/lib/sisu/develop/se_version.rb b/lib/sisu/develop/se_version.rb index 2ace68ce..860faee7 100644 --- a/lib/sisu/develop/se_version.rb +++ b/lib/sisu/develop/se_version.rb @@ -82,16 +82,16 @@ module SiSU_Info_Version ? @@lib_path : `echo $RUBYLIB`.split(':') @@lib_path ||=lib_path - if File.exist?(SiSU_is[:version_info_path]) - version=YAML::load(File::open(SiSU_is[:version_info_path])) + if File.exist?(SiSU_is.version_info_path?) + version=YAML::load(File::open(SiSU_is.version_info_path?)) end - version[:branch_version]=SiSU_is[:branch_version] + version[:branch_version]=SiSU_is.branch_version? version[:branch_number]=/^v([0-9]+)/.match(version[:branch_version])[1] - version[:branch_name]=SiSU_is[:branch_name] - version[:install_method]=if SiSU_is[:run_from]==:gem_install + version[:branch_name]=SiSU_is.branch_name? + 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_is[:branch_name]}/,'')) == gem_root) \ + (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is.branch_name?}/,'')) == gem_root) \ ? ' (ruby gem install)' : '' else '' end diff --git a/lib/sisu/develop/shared_images.rb b/lib/sisu/develop/shared_images.rb index a4f0421b..e617676e 100644 --- a/lib/sisu/develop/shared_images.rb +++ b/lib/sisu/develop/shared_images.rb @@ -125,7 +125,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="#{SiSU_is[:path_base_system_data]}/image" + src_path="#{SiSU_is.path_base_system_data?}/image" dest=dest_path(:image_sys) copy(src_path,dest,images) end |