diff options
-rw-r--r-- | debian/bin/sisu | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/debian/bin/sisu b/debian/bin/sisu index ec3232da..8df1ae88 100644 --- a/debian/bin/sisu +++ b/debian/bin/sisu @@ -1,6 +1,6 @@ #! /usr/bin/ruby1.9.1 # encoding: utf-8 -#SiSU: copyright (C) 1997 - 2013 Ralph Amissah; License GPL, see appended program information +#SiSU: copyright (C) 1997 - 2014 Ralph Amissah; License GPL 3, see appended program information begin def ruby_version_ok?(base_version) @v ||=RUBY_VERSION.scan(/\d+/) @@ -58,15 +58,20 @@ WOK check_sisu_stable_ruby_version? default_version=if __FILE__ =~/gem/ \ and __FILE__ =~/\/sisu-[45]\.(?:\d+|[a-z])\.(?:\d+|[a-z])\// - SiSU_version_dir=(__FILE__ =~/\/sisu-5\.(?:\d+|[a-z])\.(?:\d+|[a-z])\//) ? 'v5' : 'v4' - else 'v4' + SiSU_version_dir=case __FILE__ + when /\/sisu-5\.(?:\d+|[a-z])\.(?:\d+|[a-z])\// then 'v5' + when /\/sisu-4\.(?:\d+|[a-z])\.(?:\d+|[a-z])\// then 'v4' + else 'v4' + end + else 'v4' end - if $0 =~/\bsisu4$/ then 'v4' - elsif $0 =~/\bsisu5$/ then 'v5' + SiSU_version_dir=case $0 + when /\bsisu4$/ then 'v4' + when /\bsisu5$/ then 'v5' else - SiSU_version_dir=case argv.inspect - when /"(?:--v4|--current|--stable)"/ then 'v4' - when /"(?:--v5|--next|--dev)"/ then 'v5' + case argv.inspect + when /"(?:--v4|--current|--stable)"/ then 'v4' + when /"(?:--v5|--next|--dev)"/ then 'v5' else default_version end end @@ -85,9 +90,13 @@ WOK sisu_path_specified_lib_=SiSU_path_base \ ? File.expand_path($0).sub(/bin\/sisu[45]?$/,'lib') : nil - SiSU_path_specified_Version_=SiSU_path_base \ - ? "#{SiSU_path_base}/data/sisu/#{SiSU_version_dir}/v/version.yml" - : nil + SiSU_path_specified_Version_=if __FILE__ =~/gem/ + spec = Gem::Specification.find_by_name("sisu") + spec.gem_dir + "/data/sisu/#{SiSU_version_dir}/v/version.yml" + elsif SiSU_path_base + "#{SiSU_path_base}/data/sisu/#{SiSU_version_dir}/v/version.yml" + else nil + end SiSU_path_lib="#{require_hub_path(sisu_path_specified_lib_)}" #% $* require "#{SiSU_path_lib}/hub" @@ -172,7 +181,8 @@ __END__ * Author: Ralph Amissah * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012, 2013 Ralph Amissah, All Rights Reserved. + 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Ralph Amissah, + All Rights Reserved. * License: GPL 3 or later: |