aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bin/sisu37
-rw-r--r--bin/sisu337
-rw-r--r--bin/sisu438
-rw-r--r--data/doc/sisu/CHANGELOG_v44
-rw-r--r--lib/sisu/v4/options.rb10
-rw-r--r--lib/sisu/v4/sysenv.rb44
6 files changed, 120 insertions, 50 deletions
diff --git a/bin/sisu b/bin/sisu
index 9d27ad6d..f49cf748 100644
--- a/bin/sisu
+++ b/bin/sisu
@@ -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'
diff --git a/bin/sisu3 b/bin/sisu3
index f479fedc..e1d30570 100644
--- a/bin/sisu3
+++ b/bin/sisu3
@@ -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?
'v3'
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'
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__
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4
index c46b5484..5568af3f 100644
--- a/data/doc/sisu/CHANGELOG_v4
+++ b/data/doc/sisu/CHANGELOG_v4
@@ -24,3 +24,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.0.orig.tar.xz
sisu_4.0.0.orig.tar.xz
sisu_4.0.0-1.dsc
sisu_4.0.0-1.debian.tar.gz
+
+* 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
diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb
index 39c392a9..d2898bfd 100644
--- a/lib/sisu/v4/options.rb
+++ b/lib/sisu/v4/options.rb
@@ -59,7 +59,7 @@
module SiSU_Commandline
require 'pathname'
require_relative 'sysenv' # sysenv.rb
- @@base_path=nil
+ @@sisu_call_origin_path=nil
class Options
attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what
@@act=nil
@@ -69,8 +69,8 @@ module SiSU_Commandline
@env=SiSU_Env::InfoEnv.new
@lng_base=@env.language_default_set
@dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
- @@base_path ||=Dir.pwd
- @base_path=@@base_path
+ @@sisu_call_origin_path ||=Dir.pwd
+ @base_path=@@sisu_call_origin_path
r=Px[:lng_lst_rgx]
u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
@base_stub=@base_path.gsub(u,'\1')
@@ -181,9 +181,9 @@ module SiSU_Commandline
@lngs = q[:lngs]
if @files.length > 0 \
and @cmd.empty? \
- and @mod.length==0 #% if no other action called on filename given, default is sisu --v3 -0 [filename(s)] configured as flag default
+ and @mod.length==0 #% if no other action called on filename given, default is sisu --v4 -0 [filename(s)] configured as flag default
shortcut=SiSU_Env::InfoProcessingFlag.new
- @mod=['--v3']
+ @mod=['--v4']
@cmd=shortcut.cf_0 + 'm'
end
if @cmd =~/[vVM]/ \
diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb
index c4b364ad..90df10fa 100644
--- a/lib/sisu/v4/sysenv.rb
+++ b/lib/sisu/v4/sysenv.rb
@@ -5668,48 +5668,8 @@ WOK
end
@skin_apply
end
- def select # skin loading logic here
- load "#{SiSU_lib}/defaults.rb"
- skin_path=[]
- @env.sys.rc_path.each {|x| skin_path << "#{x}/skin"}
- skin_path << "#{@env.processing_path.processing}/external_document/skin"
- skin=if @pwd_stub =~/^(?:doc|sisupod)$/ \
- and ((! @md.nil?) \
- && (defined? @md.opt) \
- && (defined? @md.opt.mod) \
- && @md.opt.mod.inspect !~/--trust/)
- true # security only run skins on sisupod if --trust flag is provided
- elsif @pwd_stub =~/^(?:doc|sisupod)$/ # consider/reconsider doc
- false
- else true
- end
- doc_skin,dir_skin=nil,nil
- if skin
- unless @d_sk.nil?
- sk_doc="doc/#{@d_sk}.rb"
- skin_path.each do |v| # document skin priority 1
- if FileTest.file?("#{v}/#{sk_doc}")
- doc_skin="#{v}/#{sk_doc}"
- load doc_skin
- break
- end
- end
- end
- unless doc_skin
- sk_dir="dir/skin_#{@pwd_stub}.rb"
- skin_path.each do |v| # directory skin priority 2
- if FileTest.file?("#{v}/#{sk_dir}")
- dir_skin="#{v}/#{sk_dir}"
- load dir_skin
- break
- end
- end
- end
- end
- sk=if doc_skin; doc_skin
- elsif dir_skin; dir_skin
- else nil
- end
+ def select # skin loading logic here, removed
+ nil
end
end
class CSS_Default