From 42aae8da2b103b4038cfb2fc24591b9004972d4a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 6 Jan 2014 22:03:06 -0500 Subject: bin/sisu, version dir (fix) & version info * (ensure SiSU_version_dir) fix * sisu version info, yml info also when installed via ruby gem * downstream libs --- bin/sisu | 29 +++++++++++++++++++---------- data/doc/sisu/CHANGELOG_v4 | 5 +++++ data/doc/sisu/CHANGELOG_v5 | 5 +++++ lib/sisu/v4/manifest.rb | 2 +- lib/sisu/v4/screen_text_color.rb | 2 +- lib/sisu/v4/sysenv.rb | 7 ++++++- lib/sisu/v5/manifest.rb | 2 +- lib/sisu/v5/screen_text_color.rb | 5 ++--- lib/sisu/v5/sysenv.rb | 7 ++++++- 9 files changed, 46 insertions(+), 18 deletions(-) diff --git a/bin/sisu b/bin/sisu index 2b31dc9b..102d10d1 100644 --- a/bin/sisu +++ b/bin/sisu @@ -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" diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 9ddc2f7c..fd2f4c60 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -30,6 +30,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.17.orig.tar.xz sisu_4.2.17.orig.tar.xz sisu_4.2.17-1.dsc +* bin/sisu + * (ensure SiSU_version_dir) fix + * sisu version info, yml info also when installed via ruby gem + * downstream libs + %% 4.2.16.orig.tar.xz (2013-12-15:49/7) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.16 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.16-1 diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 4fa32605..d5d2310a 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -30,6 +30,11 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.1.4.orig.tar.xz sisu_5.1.4.orig.tar.xz sisu_5.1.4-1.dsc +* bin/sisu + * (ensure SiSU_version_dir) fix + * sisu version info, yml info also when installed via ruby gem + * downstream libs + * year updated, code headers %% 5.1.3.orig.tar.xz (2013-12-15:49/7) diff --git a/lib/sisu/v4/manifest.rb b/lib/sisu/v4/manifest.rb index d86830e4..db409f46 100644 --- a/lib/sisu/v4/manifest.rb +++ b/lib/sisu/v4/manifest.rb @@ -757,7 +757,7 @@ WOK metadata(id,info) end if @md.sisu_version - id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" + id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})#{@md.sisu_version[:install_method]}" metadata(id,info) end if @md.ruby_version diff --git a/lib/sisu/v4/screen_text_color.rb b/lib/sisu/v4/screen_text_color.rb index 5e395133..304a677a 100644 --- a/lib/sisu/v4/screen_text_color.rb +++ b/lib/sisu/v4/screen_text_color.rb @@ -216,7 +216,7 @@ module SiSU_Screen STDERR.puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuchsia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" end def version - puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}]) &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[4]})#{@cX.off}\n" + puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}])#{@txt[4]} &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[5]})#{@cX.off}\n" end def html3numbers puts %{\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } + diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index c0598070..e58f3fc4 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -3599,6 +3599,11 @@ WOK if File.exist?(yst_ver) @version=YAML::load(File::open(yst_ver)) #unless @@noyaml end + spec = Gem::Specification.find_by_name("sisu") + gem_root = spec.gem_dir + @version[:install_method]=(File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_version_dir}/,'')) == gem_root) \ + ? ' (ruby gem install)' + : '' @version end def rbversion @@ -3618,7 +3623,7 @@ WOK @color.cmd else '-v' end - SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version + SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],version[:install_method],rb_ver).version else puts 'SiSU (version information not available)' end end diff --git a/lib/sisu/v5/manifest.rb b/lib/sisu/v5/manifest.rb index 0ba7bd0f..d70ad4ba 100644 --- a/lib/sisu/v5/manifest.rb +++ b/lib/sisu/v5/manifest.rb @@ -829,7 +829,7 @@ WOK metadata(id,info) end if @md.sisu_version - id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" + id,info=@translate.sisu_version,"#{@md.sisu_version[:project]} #{@md.sisu_version[:version]} #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})#{@md.sisu_version[:install_method]}" metadata(id,info) end if @md.ruby_version diff --git a/lib/sisu/v5/screen_text_color.rb b/lib/sisu/v5/screen_text_color.rb index 2bdbb4a3..18ed9926 100644 --- a/lib/sisu/v5/screen_text_color.rb +++ b/lib/sisu/v5/screen_text_color.rb @@ -71,8 +71,7 @@ module SiSU_Screen attr_reader :cX def initialize(color_state,*txt) @color_state,@txt=color_state,txt - @color_instruct=txt[0] #### - #flag=SiSU_Env::InfoProcessingFlag.new + @color_instruct=txt[0] @cX=@@cX=if color_state==:on Color.new do self.off=self.white=self.white_bold=self.marker=self.bold=self.underline=self.invert=self.darkgrey_hi=self.grey_hi=self.pink_hi=self.fuchsia_hi=self.red_hi=self.orange_hi=self.yellow_hi=self.brown_hi=self.lightgreen_hi=self.green_hi=self.cyan_hi=self.blue_hi=self.navy_hi=self.grey=self.pink=self.fuchsia=self.ruby=self.red=self.orange=self.yellow=self.brown=self.green=self.darkgreen=self.cyan=self.blue=self.navy=self.black='' @@ -208,7 +207,7 @@ module SiSU_Screen STDERR.puts "\t #{@cX.grey}#{@txt[0]}#{@cX.off} #{@cX.fuchsia}#{@txt[1]}#{@cX.off} #{@cX.grey}#{@txt[2]}#{@cX.off}" end def version - puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}]) &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[4]})#{@cX.off}\n" + puts "#{@cX.blue_hi}#{@txt[0]} #{@txt[1]}#{@cX.off} #{@cX.grey} (#{@txt[3]} [#{@txt[2]}])#{@txt[4]} &#{@cX.off} #{@cX.ruby}Ruby#{@cX.off} #{@cX.grey}(#{@txt[5]})#{@cX.off}\n" end def html3numbers puts %{\t#{@cX.green}#{@txt[0]}#{@cX.off} #{@cX.cyan}files processed#{@cX.off}. } + diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb index 1eaca0b8..1d0920f5 100644 --- a/lib/sisu/v5/sysenv.rb +++ b/lib/sisu/v5/sysenv.rb @@ -3717,6 +3717,11 @@ WOK if File.exist?(yst_ver) @version=YAML::load(File::open(yst_ver)) #unless @@noyaml end + spec = Gem::Specification.find_by_name("sisu") + gem_root = spec.gem_dir + @version[:install_method]=(File.dirname(__FILE__.gsub(/\/lib\/sisu\/#{SiSU_version_dir}/,'')) == gem_root) \ + ? ' (ruby gem install)' + : '' @version end def rbversion @@ -3736,7 +3741,7 @@ WOK @color.cmd else '-v' end - SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version + SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],version[:install_method],rb_ver).version else puts 'SiSU (version information not available)' end end -- cgit v1.2.3