c&d: pass info needed make run better without install
authorRalph Amissah <ralph@amissah.com>
Tue, 7 Apr 2015 02:34:28 +0000 (22:34 -0400)
committerRalph Amissah <ralph@amissah.com>
Thu, 9 Apr 2015 03:05:39 +0000 (23:05 -0400)
bin/sisu
lib/sisu/current/hub.rb
lib/sisu/current/hub_options.rb
lib/sisu/current/se_version.rb
lib/sisu/current/utils.rb
lib/sisu/develop/hub.rb
lib/sisu/develop/hub_options.rb
lib/sisu/develop/se_version.rb
lib/sisu/develop/utils.rb

index b5751d6617bfdf07704132f0b3802dfab193e018..dc399737982a87e0a164072485f68b78bded4c2b 100644 (file)
--- a/bin/sisu
+++ b/bin/sisu
@@ -30,11 +30,11 @@ class Orient
     @@sisu_called_from_directory ||= Dir.pwd
   end
   def sisu_run_from?
     @@sisu_called_from_directory ||= Dir.pwd
   end
   def sisu_run_from?
-    if processing.called_as == processing.file_full_path \
-    and File.dirname(processing.file_full_path) != RbConfig::CONFIG['bindir']
+    if processing.called_as == processing.sisu_runtime_path \
+    and File.dirname(processing.sisu_runtime_path) != RbConfig::CONFIG['bindir']
       :full_path_to_sisu_bin_in_sisu_dir_tree
       :full_path_to_sisu_bin_in_sisu_dir_tree
-    elsif processing.file_full_path =~/\/gems\// \
-    and processing.file_full_path \
+    elsif processing.sisu_runtime_path =~/\/gems\// \
+    and processing.sisu_runtime_path \
     =~ /\/sisu-[#{version.stable}#{version.unstable}]\.(?:\d+|[a-z])\.(?:\d+|[a-z])\//
       :gem_install
     else
     =~ /\/sisu-[#{version.stable}#{version.unstable}]\.(?:\d+|[a-z])\.(?:\d+|[a-z])\//
       :gem_install
     else
@@ -51,7 +51,7 @@ class Orient
     def argv_str
       argv.inspect
     end
     def argv_str
       argv.inspect
     end
-    def file_full_path
+    def sisu_runtime_path
       __FILE__
     end
     def stable
       __FILE__
     end
     def stable
@@ -116,7 +116,7 @@ class Orient
         end
       end
     elsif sisu_run_from? == :gem_install
         end
       end
     elsif sisu_run_from? == :gem_install
-      case processing.file_full_path
+      case processing.sisu_runtime_path
       when processing.stable_gem_regex           then processing.current
       when processing.unstable_gem_regex         then processing.next
       else                                            processing.current
       when processing.stable_gem_regex           then processing.current
       when processing.unstable_gem_regex         then processing.next
       else                                            processing.current
@@ -138,7 +138,7 @@ class Orient
         end
       end
     elsif sisu_run_from? == :gem_install
         end
       end
     elsif sisu_run_from? == :gem_install
-      case processing.file_full_path
+      case processing.sisu_runtime_path
       when processing.stable_gem_regex           then processing.stable
       when processing.unstable_gem_regex         then processing.unstable
       else                                            processing.stable
       when processing.stable_gem_regex           then processing.stable
       when processing.unstable_gem_regex         then processing.unstable
       else                                            processing.stable
@@ -205,9 +205,15 @@ class Orient
     self
   end
   def sisu_is
     self
   end
   def sisu_is
-    def run_from?
+    def runtime_path?
+      sisu_runtime_path
+    end
+    def runtime_type?
       sisu_run_from?
     end
       sisu_run_from?
     end
+    def called_from?
+      sisu_called_from_directory
+    end
     def branch_name?
       branch_name_
     end
     def branch_name?
       branch_name_
     end
@@ -232,8 +238,12 @@ class Orient
     def language_list_regex?
       language_list.regex
     end
     def language_list_regex?
       language_list.regex
     end
-    def called_from?
-      sisu_called_from_directory
+    def runtime?
+      {
+        call_path:    called_from?,
+        runtime_path: runtime_path?,
+        runtime_type: runtime_type?,
+      }
     end
     self
   end
     end
     self
   end
@@ -290,7 +300,7 @@ class Orient
               Dir.chdir(markup_dir)
               $sisu_document_markup_directory_base_fixed_path=
                 Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'')
               Dir.chdir(markup_dir)
               $sisu_document_markup_directory_base_fixed_path=
                 Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'')
-              SiSU::HubMaster.new(argv_sub,sisu_called_from_directory)
+              SiSU::HubMaster.new(argv_sub,sisu_is.runtime?)
             elsif markup_dir =~/https?:/
               markup_file.each do |mf|
                 (FileTest.file?(mf)) \
             elsif markup_dir =~/https?:/
               markup_file.each do |mf|
                 (FileTest.file?(mf)) \
@@ -301,7 +311,7 @@ class Orient
               $sisu_document_markup_directory_base_fixed_path=
                 Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'')
               argv_sub=command_line_modifiers + markup_file
               $sisu_document_markup_directory_base_fixed_path=
                 Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'')
               argv_sub=command_line_modifiers + markup_file
-              SiSU::HubMaster.new(argv_sub,sisu_called_from_directory)
+              SiSU::HubMaster.new(argv_sub,sisu_is.runtime?)
             else p "Error directory specified #{markup_dir} not found"
             end
           ensure
             else p "Error directory specified #{markup_dir} not found"
             end
           ensure
@@ -313,7 +323,7 @@ class Orient
         $sisu_document_markup_directory=Dir.pwd.gsub(/\/$/,'')
         $sisu_document_markup_directory_base_fixed_path=
           Dir.pwd.gsub(/(^|\/)(?:#{language_list.regex})$/,'')
         $sisu_document_markup_directory=Dir.pwd.gsub(/\/$/,'')
         $sisu_document_markup_directory_base_fixed_path=
           Dir.pwd.gsub(/(^|\/)(?:#{language_list.regex})$/,'')
-        SiSU::HubMaster.new(processing.argv,sisu_called_from_directory)
+        SiSU::HubMaster.new(processing.argv,sisu_is.runtime?)
       end
     rescue
     ensure
       end
     rescue
     ensure
index 6b0832ebbf83082b90948e4e34143affe4405310..eb6ab19d261d959977b09f3aba50bd7153afbd36 100644 (file)
@@ -72,9 +72,9 @@ module SiSU
       error('uri NOT FOUND (LoadError)')
   end
   class HubMaster
       error('uri NOT FOUND (LoadError)')
   end
   class HubMaster
-    def initialize(argv,call_path)
+    def initialize(argv,sisu_runtime)
       begin
       begin
-        opt=SiSU_Commandline::Options.new(argv,call_path)
+        opt=SiSU_Commandline::Options.new(argv,sisu_runtime)
         SiSU::Processing.new(opt).actions_without_files
         SiSU::Processing.new(opt).actions_on_files
         SiSU::Processing.new(opt).actions_without_files_post
         SiSU::Processing.new(opt).actions_without_files
         SiSU::Processing.new(opt).actions_on_files
         SiSU::Processing.new(opt).actions_without_files_post
index 40775a3c2b82ff87f7604f12bc92705b9d2d9a42..35398758ee46bdaccc987867e9b2a3641d6db777 100644 (file)
@@ -152,9 +152,9 @@ module SiSU_Commandline
     end
   end
   class Options
     end
   end
   class Options
-    attr_accessor :selections,:opt_ch,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod
+    attr_accessor :selections,:opt_ch,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod,:sisu_run_path,:sisu_install_type
     @@act=nil
     @@act=nil
-    def initialize(a,call_path)
+    def initialize(a,sisu_runtime)
       @opt_ch=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location=''
       @f_pths,@files,@files_mod,@paths,@select_arr,@act=Array.new(5){[]}
       @select_str=nil
       @opt_ch=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location=''
       @f_pths,@files,@files_mod,@paths,@select_arr,@act=Array.new(5){[]}
       @select_str=nil
@@ -162,7 +162,9 @@ module SiSU_Commandline
       @lng_base=@env.language_default_set
       @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
       @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual?
       @lng_base=@env.language_default_set
       @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
       @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual?
-      @call_path=call_path
+      @sisu_run_from=sisu_runtime[:runtime_path]
+      @sisu_install_type=sisu_runtime[:runtime_type]
+      @call_path=sisu_runtime[:call_path]
       pth=SiSU_Utils::Path.new(call_path)
       @base_path=pth.base_markup
       @base_stub=pth.base_markup_stub
       pth=SiSU_Utils::Path.new(call_path)
       @base_path=pth.base_markup
       @base_stub=pth.base_markup_stub
@@ -173,6 +175,12 @@ module SiSU_Commandline
       @make_instructions_pod=nil
       init
     end
       @make_instructions_pod=nil
       init
     end
+    def sisu_run_from?
+      @sisu_run_from
+    end
+    def sisu_install_type?
+      @sisu_install_type
+    end
     def find_all(find_flag,opt)
       if find_flag
         x=Dir.glob('*.ss[tm]')
     def find_all(find_flag,opt)
       if find_flag
         x=Dir.glob('*.ss[tm]')
index 156b4406c7c7352244dc09aa1a2376493280e282..464af3d922f306cdc5579b481b628df648c346ba 100644 (file)
@@ -85,7 +85,7 @@ module SiSU_Info_Version
       if File.exist?(SiSU_is.version_info_path?)
         @version=YAML::load(File::open(SiSU_is.version_info_path?))
       end
       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.runtime_type? ==: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) \
         spec = Gem::Specification.find_by_name("sisu")
         gem_root = spec.gem_dir
         (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is.branch_name?}/,'')) == gem_root) \
index 1049fdf4a9de2b082f8dfe5c5c3999a2cf8bef80..53e28fd994316bfc69746cff4ed36785d1fd4311 100644 (file)
@@ -132,6 +132,12 @@ module SiSU_Utils
     def mark(v=nil,x=nil)
       puts set(v,x)
     end
     def mark(v=nil,x=nil)
       puts set(v,x)
     end
+    def tell(v=nil,x=nil)
+      puts set(v,x)
+    end
+    def report(v=nil,x=nil)
+      puts set(v,x)
+    end
     def ok(v=nil,x=nil)
       if (v.is_a?(Symbol) \
       and x.is_a?(String))
     def ok(v=nil,x=nil)
       if (v.is_a?(Symbol) \
       and x.is_a?(String))
index 1b5ac580a1fc07b2f7de49d8e108b9533ac9a806..26a2af72c0520d7d309507f9fe7ef550a16df742 100644 (file)
@@ -72,9 +72,9 @@ module SiSU
       error('uri NOT FOUND (LoadError)')
   end
   class HubMaster
       error('uri NOT FOUND (LoadError)')
   end
   class HubMaster
-    def initialize(argv,call_path)
+    def initialize(argv,sisu_runtime)
       begin
       begin
-        opt=SiSU_Commandline::Options.new(argv,call_path)
+        opt=SiSU_Commandline::Options.new(argv,sisu_runtime)
         SiSU::Processing.new(opt).actions_without_files
         SiSU::Processing.new(opt).actions_on_files
         SiSU::Processing.new(opt).actions_without_files_post
         SiSU::Processing.new(opt).actions_without_files
         SiSU::Processing.new(opt).actions_on_files
         SiSU::Processing.new(opt).actions_without_files_post
index f6a40be9fb9aa5dd38e4f37c690421c226082759..1c3f4e3d36262654b761bbc957b308e9a1053f29 100644 (file)
@@ -152,9 +152,9 @@ module SiSU_Commandline
     end
   end
   class Options
     end
   end
   class Options
-    attr_accessor :selections,:opt_ch,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod
+    attr_accessor :selections,:opt_ch,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod,:sisu_run_path,:sisu_install_type
     @@act=nil
     @@act=nil
-    def initialize(a,call_path)
+    def initialize(a,sisu_runtime)
       @opt_ch=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location=''
       @f_pths,@files,@files_mod,@paths,@select_arr,@act=Array.new(5){[]}
       @select_str=nil
       @opt_ch=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location=''
       @f_pths,@files,@files_mod,@paths,@select_arr,@act=Array.new(5){[]}
       @select_str=nil
@@ -162,7 +162,9 @@ module SiSU_Commandline
       @lng_base=@env.language_default_set
       @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
       @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual?
       @lng_base=@env.language_default_set
       @dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
       @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual?
-      @call_path=call_path
+      @sisu_run_from=sisu_runtime[:runtime_path]
+      @sisu_install_type=sisu_runtime[:runtime_type]
+      @call_path=sisu_runtime[:call_path]
       pth=SiSU_Utils::Path.new(call_path)
       @base_path=pth.base_markup
       @base_stub=pth.base_markup_stub
       pth=SiSU_Utils::Path.new(call_path)
       @base_path=pth.base_markup
       @base_stub=pth.base_markup_stub
@@ -173,6 +175,33 @@ module SiSU_Commandline
       @make_instructions_pod=nil
       init
     end
       @make_instructions_pod=nil
       init
     end
+    def sisu_called_from?
+      @call_path
+    end
+    def sisu_bin_filepath?
+      @sisu_run_from
+    end
+    def sisu_install_type?
+      @sisu_install_type
+    end
+    def sisu_lib_dir?
+      File.dirname(__FILE__)
+    end
+    def sisu_data_dir?
+      env=RbConfig::CONFIG
+      if sisu_install_type? ==:full_path_to_sisu_bin_in_sisu_dir_tree
+        sisu_bin_filepath?.gsub(/\/bin\/sisu\S*/,'/data/sisu')
+        #sisu_lib_dir?.gsub(/\/lib\/sisu\/(?:current|develop)\S*/,'/data/sisu')
+      elsif sisu_install_type? ==:gem_install
+        #sisu_run_from?.gsub(/\/bin\/.+/,'/data/sisu')
+        env['datadir']
+      elsif sisu_install_type? ==:system_install
+        #SiSU_Info_Env::InfoEnv.new.path.share
+        env['datadir']
+      else
+        env['datadir']
+      end
+    end
     def find_all(find_flag,opt)
       if find_flag
         x=Dir.glob('*.ss[tm]')
     def find_all(find_flag,opt)
       if find_flag
         x=Dir.glob('*.ss[tm]')
index 860faee7cf7fd2a7598d29395560ff619d535f95..157ecc9cf85f9fb56a07d6274cbf49e5c97b0c68 100644 (file)
@@ -88,7 +88,7 @@ module SiSU_Info_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[: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[:install_method]=if SiSU_is.runtime_type? ==: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) \
         spec = Gem::Specification.find_by_name("sisu")
         gem_root = spec.gem_dir
         (File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_is.branch_name?}/,'')) == gem_root) \
index f100b2d84775e75b322bde3f457e978fd41ee45c..a43154fda8f96b06daeb3d944e49bd1fb29a39a4 100644 (file)
@@ -132,6 +132,12 @@ module SiSU_Utils
     def mark(v=nil,x=nil)
       puts set(v,x)
     end
     def mark(v=nil,x=nil)
       puts set(v,x)
     end
+    def tell(v=nil,x=nil)
+      puts set(v,x)
+    end
+    def report(v=nil,x=nil)
+      puts set(v,x)
+    end
     def ok(v=nil,x=nil)
       if (v.is_a?(Symbol) \
       and x.is_a?(String))
     def ok(v=nil,x=nil)
       if (v.is_a?(Symbol) \
       and x.is_a?(String))