aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/current/se_version.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/current/se_version.rb')
-rw-r--r--lib/sisu/current/se_version.rb54
1 files changed, 41 insertions, 13 deletions
diff --git a/lib/sisu/current/se_version.rb b/lib/sisu/current/se_version.rb
index 464af3d9..bbbf5962 100644
--- a/lib/sisu/current/se_version.rb
+++ b/lib/sisu/current/se_version.rb
@@ -75,7 +75,7 @@ module SiSU_Info_Version
end
@@lib_path=nil
def get_version
- @version={}
+ version={}
@pwd=ENV['PWD']
lib_path=
@@lib_path \
@@ -83,19 +83,47 @@ module SiSU_Info_Version
: `echo $RUBYLIB`.split(':')
@@lib_path ||=lib_path
if File.exist?(SiSU_is.version_info_path?)
- @version=YAML::load(File::open(SiSU_is.version_info_path?))
+ version=YAML::load(File::open(SiSU_is.version_info_path?))
end
- @version[:install_method]=if SiSU_is.runtime_type? ==:gem_install
+ 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.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) \
? ' (ruby gem install)' : ''
else ''
end
- @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
+ @version=version
+ def version_details_hash
+ @version
+ end
+ def project
+ version_details_hash[:project]
+ end
+ def date
+ version_details_hash[:date]
+ end
+ def date_stamp
+ version_details_hash[:date_stamp]
+ end
+ def version
+ version_details_hash[:version]
+ end
+ def branch_version
+ version_details_hash[:branch_version]
+ end
+ def branch_number
+ version_details_hash[:branch_number]
+ end
+ def branch_name
+ version_details_hash[:branch_name]
+ end
+ def install_method
+ version_details_hash[:install_method]
+ end
+ self
end
def rbversion
%x{ruby -v}.strip
@@ -118,7 +146,7 @@ module SiSU_Info_About
def sisu_version
version=SiSU_Env::InfoVersion.instance.get_version
rb_ver=SiSU_Env::InfoVersion.instance.rbversion
- if version[:version]
+ if version.version
opt_cmd=if defined? @color.cmd \
and @color.cmd =~/[ck]/
@color.cmd
@@ -126,11 +154,11 @@ module SiSU_Info_About
end
SiSU_Screen::Ansi.new(
opt_cmd,
- version[:project],
- version[:version],
- version[:date_stamp],
- version[:date],
- version[:install_method],
+ version.project,
+ version.version,
+ version.date_stamp,
+ version.date,
+ version.install_method,
rb_ver
).version
else puts 'SiSU (version information not available)'