diff options
author | Ralph Amissah <ralph@amissah.com> | 2015-04-21 14:45:52 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2015-05-01 18:49:41 -0400 |
commit | 960c3088bc88f2db879154053280b06c160d4d70 (patch) | |
tree | 624e14806190ac7edcd1400e8e2142ffba17afec /bin | |
parent | version & changelog v7 (diff) |
lib/sisu/*, single libs directory (c&d gone) (7)
* removed lib/sisu/{current,develop} dir branches
v7 (v5 & v6 retired)
* simplify dir structure, offer single version per snapshot
* have enjoyed carrying stable and development versions v5 & v6
in a single tarball, may return to this structure
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/sisu | 203 | ||||
l--------- | bin/sisu5 | 1 | ||||
l--------- | bin/sisu6 | 1 |
3 files changed, 65 insertions, 140 deletions
@@ -8,23 +8,8 @@ class Orient super() @called_as,@argv=$0,$* end - def version - def stable - '5' - end - def unstable - '6' - end - def default - unstable - end - def current - 'current' - end - def next - 'next' - end - self + def version_major + '7' end def sisu_called_from_directory @@sisu_called_from_directory ||= Dir.pwd @@ -35,7 +20,7 @@ class Orient :full_path_to_sisu_bin_in_sisu_dir_tree elsif processing.sisu_runtime_path =~/\/gems\// \ and processing.sisu_runtime_path \ - =~ /\/sisu-[#{version.stable}#{version.unstable}]\.(?:\d+|[a-z])\.(?:\d+|[a-z])\// + =~ /\/sisu-(?:\d+|[a-z])\.(?:\d+|[a-z])\.(?:\d+|[a-z])\// :gem_install else :system_install @@ -54,112 +39,34 @@ class Orient def sisu_runtime_path __FILE__ end - def stable - 'v' + version.stable - end - def unstable - 'v' + version.unstable - end - def default - 'v' + version.default - end - def current - 'current' - end - def next - 'develop' - end - def stable_bin_file_regex - %r{\bsisu#{version.stable}$} + def bin_file_regex + %r{\bsisu$} end - def unstable_bin_file_regex - %r{\bsisu#{version.unstable}$} - end - def stable_gem_regex - %r{\/sisu-#{version.stable}\.(?:\d+|[a-z])\.(?:\d+|[a-z])\/} - end - def unstable_gem_regex - %r{\/sisu-#{version.unstable}\.(?:\d+|[a-z])\.(?:\d+|[a-z])\/} - end - def stable_modifier_regex - %r{"(?:--v#{version.stable}|--current|--stable|--release)"} - end - def unstable_modifier_regex - %r{"(?:--v#{version.unstable}|--next|--unstable|--dev)"} + def gem_regex + %r{\/sisu-(?:\d+|[a-z])\.(?:\d+|[a-z])\.(?:\d+|[a-z])\/} end self end def sisu_lib - "sisu/#{branch_name_}" - end - def 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 + 'sisu' end def sisu_version_info_path - "#{sisu_path_base_system_data}/version/#{branch_name?}.yml" - end - 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 - else - case processing.argv_str - when processing.stable_modifier_regex then processing.current - when processing.unstable_modifier_regex then processing.next - else processing.current - end - end - elsif sisu_run_from? == :gem_install - case processing.sisu_runtime_path - when processing.stable_gem_regex then processing.current - when processing.unstable_gem_regex then processing.next - else processing.current - end - 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.sisu_runtime_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 + "#{sisu_path_base_system_data}/version.yml" end def paths_set if sisu_run_from? == :system_install \ and processing.called_as \ - =~ /^#{RbConfig::CONFIG['bindir']}\/sisu[#{version.stable}#{version.unstable}]?$/ + =~ /^#{RbConfig::CONFIG['bindir']}\/sisu$/ :set_path_system elsif sisu_run_from? == :full_path_to_sisu_bin_in_sisu_dir_tree \ and processing.called_as \ - !~ /^#{RbConfig::CONFIG['bindir']}\/sisu[#{version.stable}#{version.unstable}]?$/ \ + !~ /^#{RbConfig::CONFIG['bindir']}\/sisu$/ \ && File.expand_path(processing.called_as) \ - =~ /bin\/sisu[#{version.stable}#{version.unstable}]?$/ \ + =~ /bin\/sisu$/ \ && FileTest.file?(processing.called_as) :set_dir_tree_full_path elsif sisu_run_from? ==:gem_install - :set_gem_path + :set_path_gem else nil end end @@ -188,8 +95,8 @@ class Orient RbConfig::CONFIG['datadir'] + '/sisu' when :set_dir_tree_full_path File.expand_path(processing.called_as). - sub(/\/bin\/sisu[#{version.stable}#{version.unstable}]?$/,'') - when :set_gem_path + sub(/\/bin\/sisu$/,'') + when :set_path_gem Gem::Specification.find_by_name("sisu").gem_dir else nil end @@ -200,18 +107,44 @@ class Orient RbConfig::CONFIG['datadir'] + '/sisu' when :set_dir_tree_full_path File.expand_path(processing.called_as). - sub(/\/bin\/sisu[#{version.stable}#{version.unstable}]?$/,'/data/sisu') - when :set_gem_path + sub(/\/bin\/sisu$/,'/data/sisu') + when :set_path_gem Gem::Specification.find_by_name("sisu").gem_dir + '/data/sisu' else nil end end - def sisu_path_specified_lib + def sisu_this_lib + if processing.sisu_runtime_path =~/\/gems\// \ + and processing.sisu_runtime_path \ + =~ /\/sisu-(?:\d+|[a-z])\.(?:\d+|[a-z])\.(?:\d+|[a-z])\// + # gem sought + processing.sisu_runtime_path. + gsub(/\/bin\/sisu[a-z0-7_-]*$/,'/lib/sisu') + elsif (processing.called_as \ + !~ /^#{RbConfig::CONFIG['bindir']}\/sisu$/) + # called off file system, project directory tree + File.expand_path(processing.called_as). + sub(/bin\/sisu\S*/,'lib/sisu') + else + # distro installation + sisulib={ + vendorlib: RbConfig::CONFIG['vendordir'] + '/sisu', + sitelib: RbConfig::CONFIG['sitelibdir'] + '/sisu', + } + if FileTest.directory?(sisulib[:sitelib]) # Arch Linux; Debian local + sisulib[:sitelib] + elsif FileTest.directory?(sisulib[:vendorlib]) # Debian GNU Linux system + sisulib[:vendorlib] + else 'sisu' # assume lib paths work + end + end + end + def sisu_this_lib_ if (processing.called_as \ - !~ /^#{RbConfig::CONFIG['bindir']}\/sisu[#{version.stable}#{version.unstable}]?$/) + !~ /^#{RbConfig::CONFIG['bindir']}\/sisu$/) File.expand_path(processing.called_as). - sub(/bin\/sisu[#{version.stable}#{version.unstable}]?$/,'lib') - else nil + sub(/bin\/sisu\S*/,'lib/sisu') + else 'sisu' end end def language_list @@ -224,8 +157,11 @@ class Orient self end def sisu_is + def version_major? + version_major + end def runtime_path? - sisu_runtime_path + processing.sisu_runtime_path end def runtime_type? sisu_run_from? @@ -233,21 +169,12 @@ class Orient def called_from? sisu_called_from_directory end - def branch_name? - branch_name_ - end - def branch_version? - branch_version_ - end def path_base? sisu_path_base end def path_base_system_data? sisu_path_base_system_data end - def path_lib? - sisu_path_lib - end def version_info_path? sisu_version_info_path end @@ -309,7 +236,7 @@ class Orient self end def control - require "#{sisu_is.path_lib?}/hub" + require sisu_this_lib sisu_called_from_directory begin if get_processing_info.processing_files.length > 0 @@ -322,7 +249,7 @@ class Orient Dir.chdir(markup_dir) $sisu_document_markup_directory_base_fixed_path= Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'') - SiSU::HubMaster.new(argv_sub,sisu_is.runtime?) + SiSU_libs::CallHubMaster.new(argv_sub,sisu_is.runtime?) elsif markup_dir =~/https?:/ markup_file.each do |mf| (FileTest.file?(mf)) \ @@ -333,7 +260,7 @@ class Orient $sisu_document_markup_directory_base_fixed_path= Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'') argv_sub=command_line_modifiers + markup_file - SiSU::HubMaster.new(argv_sub,sisu_is.runtime?) + SiSU_libs::CallHubMaster.new(argv_sub,sisu_is.runtime?) else p "Error directory specified #{markup_dir} not found" end ensure @@ -345,11 +272,11 @@ class Orient $sisu_document_markup_directory=Dir.pwd.gsub(/\/$/,'') $sisu_document_markup_directory_base_fixed_path= Dir.pwd.gsub(/(^|\/)(?:#{language_list.regex})$/,'') - SiSU::HubMaster.new(processing.argv,sisu_is.runtime?) + SiSU_libs::CallHubMaster.new(processing.argv,sisu_is.runtime?) end rescue ensure - SiSU::HubClose.new(sisu_called_from_directory,@argv) + SiSU_libs::HubClose.new(@argv,sisu_called_from_directory) Dir.chdir(sisu_called_from_directory) system("cd #{sisu_called_from_directory}") end @@ -358,7 +285,6 @@ end #% sisu select source & branch, begin $VERBOSE=nil require 'rbconfig' -require 'rubygems' begin require 'singleton' s=Orient.instance @@ -369,14 +295,15 @@ rescue #% - STDERR.puts $! STDERR.puts $@ puts %{ - #{%x{ruby -v}.strip.to_s} - #{RUBY_VERSION} - ruby version: #{RbConfig::CONFIG['RUBY_PROGRAM_VERSION']}p#{RbConfig::CONFIG['PATCHLEVEL']} - ruby named: #{RbConfig::CONFIG['ruby_version']} - rubylib: #{RbConfig::CONFIG['rubylibdir']} - rubylib local: #{RbConfig::CONFIG['sitelibdir']} - gem dir: #{Gem.dir} - gem path: #{Gem.path} + #{%x{ruby -v}.strip.to_s} + #{RUBY_VERSION} + ruby version: #{RbConfig::CONFIG['RUBY_PROGRAM_VERSION']}p#{RbConfig::CONFIG['PATCHLEVEL']} + ruby named: #{RbConfig::CONFIG['ruby_version']} + rubylib: #{RbConfig::CONFIG['rubylibdir']} + vendor lib #{RbConfig::CONFIG['vendordir']} + site lib local: #{RbConfig::CONFIG['sitelibdir']} + gem dir: #{Gem.dir} + gem path: #{Gem.path} } system(%{echo " system RUBYPATH: ${RUBYPATH} diff --git a/bin/sisu5 b/bin/sisu5 deleted file mode 120000 index b4999d51..00000000 --- a/bin/sisu5 +++ /dev/null @@ -1 +0,0 @@ -sisu
\ No newline at end of file diff --git a/bin/sisu6 b/bin/sisu6 deleted file mode 120000 index b4999d51..00000000 --- a/bin/sisu6 +++ /dev/null @@ -1 +0,0 @@ -sisu
\ No newline at end of file |