From 71badaf7b2374edcc05268ee79db2fbfd2d7fbb1 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 5 Dec 2014 23:41:05 -0500 Subject: c&d: version & branch info, changes related to move of lib dirs --- bin/sisu | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) (limited to 'bin') diff --git a/bin/sisu b/bin/sisu index d96f8a7c..276b8ed8 100644 --- a/bin/sisu +++ b/bin/sisu @@ -29,7 +29,7 @@ class Orient def sisu_called_from_directory @@sisu_called_from_directory ||= Dir.pwd end - def sisu_run_from + def sisu_run_from? if processing.called_as == processing.file_full_path \ and File.dirname(processing.file_full_path) != Config::CONFIG['bindir'] :full_path_to_sisu_bin_in_sisu_dir_tree @@ -90,7 +90,7 @@ class Orient self end def sisu_lib - "sisu/#{select_version_check}" + "sisu/#{branch_name?}" end def sisu_path_lib if sisu_path_specified_lib \ @@ -100,11 +100,11 @@ class Orient end end def sisu_version_info_path - "#{sisu_path_base_system_data}/version/#{select_version_check}.yml" + "#{sisu_path_base_system_data}/version/#{branch_name?}.yml" end - def select_version_check - if sisu_run_from == :full_path_to_sisu_bin_in_sisu_dir_tree \ - or sisu_run_from == :system_install + 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 when processing.stable_bin_file_regex then processing.current when processing.unstable_bin_file_regex then processing.next @@ -115,7 +115,7 @@ class Orient else processing.current end end - elsif sisu_run_from == :gem_install + elsif sisu_run_from? == :gem_install case processing.file_full_path when processing.stable_gem_regex then processing.current when processing.unstable_gem_regex then processing.next @@ -124,19 +124,41 @@ class Orient else processing.current end end + 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 + when processing.stable_bin_file_regex then processing.stable + when processing.unstable_bin_file_regex then processing.unstable + else + case processing.argv_str + when processing.stable_modifier_regex then processing.stable + when processing.unstable_modifier_regex then processing.unstable + else processing.stable + end + end + elsif sisu_run_from? == :gem_install + case processing.file_full_path + when processing.stable_gem_regex then processing.stable + when processing.unstable_gem_regex then processing.unstable + else processing.stable + end + else processing.stable + end + end def paths_set - if sisu_run_from == :system_install \ + if sisu_run_from? == :system_install \ and processing.called_as \ =~ /^#{Config::CONFIG['bindir']}\/sisu[#{version.stable}#{version.unstable}]?$/ :set_path_system - elsif sisu_run_from == :full_path_to_sisu_bin_in_sisu_dir_tree \ + elsif sisu_run_from? == :full_path_to_sisu_bin_in_sisu_dir_tree \ and processing.called_as \ !~ /^#{Config::CONFIG['bindir']}\/sisu[#{version.stable}#{version.unstable}]?$/ \ && File.expand_path(processing.called_as) \ =~ /bin\/sisu[#{version.stable}#{version.unstable}]?$/ \ && FileTest.file?(processing.called_as) :set_dir_tree_full_path - elsif sisu_run_from==:gem_install + elsif sisu_run_from? ==:gem_install :set_gem_path else nil end @@ -184,8 +206,9 @@ class Orient end def sisu_is { - run_from: sisu_run_from, - version_dir: select_version_check, + 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, -- cgit v1.2.3