From ac4a6aaa1f4db1237f2a0192a5dc63c8c4057be9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 3 Oct 2012 00:15:31 -0400 Subject: v4: bin/sisu $0, make possible to run sisu command on/within project dir tree * (previously sisu needed to be correctly installed with system paths honored) * NOTE: loading of skins turned off --- bin/sisu4 | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'bin/sisu4') diff --git a/bin/sisu4 b/bin/sisu4 index 9d27ad6d..ec515326 100644 --- a/bin/sisu4 +++ b/bin/sisu4 @@ -41,6 +41,15 @@ WOK rbv_sisu_dev='1.9.2' ruby_version_ok?(rbv_sisu_dev) end + def require_hub_path(sisu_path_specified_lib_) + sisu_path_lib=if sisu_path_specified_lib_ \ + && FileTest.file?("#{sisu_path_specified_lib_}/#{SiSU_lib}/hub.rb") + "#{sisu_path_specified_lib_}/#{SiSU_lib}" + else + SiSU_lib + end + end +#% sisu branch $VERBOSE=nil $KCODE='u' if RUBY_VERSION < '1.9' argv=$* @@ -58,8 +67,34 @@ WOK check_sisu_stable_ruby_version? 'v4' end +#% $0 + e=Config::CONFIG + SiSU_lib="sisu/#{SiSU_version_dir}" + sisu_path_specified_lib_=if $0 =~ /^#{e['bindir']}\/sisu[34]?$/ + nil + elsif $0 !~ /^#{e['bindir']}\/sisu[34]?$/ \ + && $0 =~/bin\/sisu[34]?$/ \ + && FileTest.file?($0) + $0.sub(/bin\/sisu[34]?$/,'lib'). + sub(/^lib$/,"#{Dir.pwd}/lib") + elsif $0 !~ /^#{e['bindir']}\/sisu[34]?$/ \ + && $0 =~/^sisu[34]?$/ \ + && FileTest.file?($0) + $0.sub(/sisu[34]?$/,'../lib') + #bug, relative path does not work for sisu version information + else + nil + end + SiSU_path_specified_Version_=if sisu_path_specified_lib_ + sisu_path_specified_lib_.sub(/\/lib/, + "/data/sisu/#{SiSU_version_dir}/v/version.yml") + else + nil + end + SiSU_path_lib="#{require_hub_path(sisu_path_specified_lib_)}" +#% SiSU_lib="sisu/#{SiSU_version_dir}" - require "#{SiSU_lib}/hub" + require "#{SiSU_path_lib}/hub" SiSU::HubMaster.new(argv) rescue STDERR.puts 'ERROR' @@ -79,6 +114,7 @@ rescue system RUBYPATH: ${RUBYPATH} system RUBYLIB: ${RUBYLIB} "}) +#ensure end __END__ -- cgit v1.2.3