bin/sisu + c&d: SiSU_is now methods (instead of hash)
authorRalph Amissah <ralph@amissah.com>
Mon, 12 Jan 2015 02:18:06 +0000 (21:18 -0500)
committerRalph Amissah <ralph@amissah.com>
Tue, 20 Jan 2015 04:46:16 +0000 (23:46 -0500)
16 files changed:
bin/sisu
data/doc/sisu/CHANGELOG_v5
data/doc/sisu/CHANGELOG_v6
lib/sisu/current/constants.rb
lib/sisu/current/se_createsite.rb
lib/sisu/current/se_get_init.rb
lib/sisu/current/se_info_env.rb
lib/sisu/current/se_info_system.rb
lib/sisu/current/se_version.rb
lib/sisu/current/shared_images.rb
lib/sisu/develop/constants.rb
lib/sisu/develop/se_createsite.rb
lib/sisu/develop/se_get_init.rb
lib/sisu/develop/se_info_system.rb
lib/sisu/develop/se_version.rb
lib/sisu/develop/shared_images.rb

index 80436d2a617c195ae9ddd7e0145b47a097415a2f..b5751d6617bfdf07704132f0b3802dfab193e018 100644 (file)
--- a/bin/sisu
+++ b/bin/sisu
@@ -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
index c0e9d59dcd0ffb00a289a7890999591c9b7116d3..33b3e5f95ca69b2bc93fbe6a80b01524c49bf6b6 100644 (file)
@@ -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
index 6047115b1ee5010a0e896ac12c19cbde6656d262..a820611600ff06e391ebbe46ca3699b7cf11b5ee 100644 (file)
@@ -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
index aa0b368e2f97d67a0830dcefeae6b690a98fb493..7a23027d272a91bb068f46de6304f1683bb3cf2a 100644 (file)
@@ -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,
index 591c0d3d8d6b74948dba2a7aca1b220a4a979608..2d20007aca81ba6b77d6bf2299fc2aa99389dc83 100644 (file)
@@ -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"
index 478bc3a297d9f76e1185c8c957d6257221275da3..a299cd10beb69316d890248e9527fc1290279cbe 100644 (file)
@@ -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|
index 276f14e63387ed95a52cdc8f4665c754847027bf..0ddac47e9bc5862a8b7c50dde7248ff2003e0b7a 100644 (file)
@@ -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)
index d1c9380f41079499ad1035f754b39fe87c5514f2..969b508a6a0fe84feca37100dae3bad48168d9a9 100644 (file)
@@ -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
index 834c9aed8c208f5433486780359e055d858de98d..156b4406c7c7352244dc09aa1a2376493280e282 100644 (file)
@@ -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
index 4357b0a0839aa252b6701ab778a04c6b4ed79e96..6d24494545c2fc577bafe64a480f7b9699a0290f 100644 (file)
@@ -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
index 8f108b7592f96b727f58bfe6a446ba82e2b194b5..0c4c258d26d1ad5ec5af61fc8fa3d999e60a4a61 100644 (file)
@@ -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,
index d2210625b6947d9bda931cf31936df2ccf455464..4981eda0fdae139ad75e83a158fd835b83775b4d 100644 (file)
@@ -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"
index 0434aea5b603aa13f46de829e0d7f0283091f3ab..dd767d05bfb568cd81e615598958d60b0c62625f 100644 (file)
@@ -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|
index be9e9d48db4066786810f3d83b98bd34b73c61eb..e688395ca84e603295ca349499d1406a87f56c0c 100644 (file)
@@ -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
index 2ace68ce8894ba093be62ae1e31026ffa99117c2..860faee7cf7fd2a7598d29395560ff619d535f95 100644 (file)
@@ -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
index a4f0421bd161225c2fb7f51e9a84259ae0cf2314..e617676e2d965dd93587fd75aeb0c04c7c4b2f62 100644 (file)
@@ -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