diff options
author | Ralph Amissah <ralph@amissah.com> | 2007-10-01 01:50:20 +0100 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2007-10-01 01:50:20 +0100 |
commit | ad5fbbc14216107e19b16654de7ac6dcab28e052 (patch) | |
tree | 41afa26f781f5ab6268eb67903f71f3020b7d86a /lib/sisu/v0/sysenv.rb | |
parent | small update and fix (diff) |
proposed as sisu-0.60.0, see updated CHANGELOG
* parameter reading on first run of file, (initialization of parameters)
* composite files (.ssm) building moved to processing directory, to overcome
problem of non-writable sisu-source document directories, perhaps also
cleaner (management of files)
* latex/pdf minor cleaning,
* caret '^' is latex special character, additional match for escaping
* clean major headings of markup heading tag with tilde and name
e.g. '1~meta'
* param / metadata, hash sums now returns has sum and file-name only even for
sisu-skin
Diffstat (limited to 'lib/sisu/v0/sysenv.rb')
-rw-r--r-- | lib/sisu/v0/sysenv.rb | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 329c9111..95830224 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -487,9 +487,10 @@ module SiSU_Env end def file_encoding(filename,cmd='') #file encoding program='file' + fnsp=Info_env.new(filename).source_file_with_path if program_found?(program) - encoding=%x{file #{filename}}.strip - encoding.gsub!(/#{filename}:(\s+|$)/,'') + encoding=%x{file #{fnsp}}.strip + encoding.gsub!(/#{fnsp}:(\s+|$)/,'') encoding=if encoding and not encoding.empty?; encoding else 'UTF-8 assumed, encoding undetermined' end @@ -1084,6 +1085,22 @@ WOK end self end + def source_file_path + file=@fns.gsub(/(\.ssm)/,'._sst') + pth=unless file =~/\._sst$/; "#{Dir.pwd}" + else "#{path.composite_file}" + end + end + def source_file_with_path + file=@fns.gsub(/(\.ssm)/,'._sst') + "#{source_file_path}/#{file}" + end + def read_source_file(fns) + fns_array=unless fns =~/\._sst$/ + IO.readlines(fns,'') + else IO.readlines("#{path.composite_file}/#{fns}",'') + end + end def path #dir def home @sys.home @@ -1216,6 +1233,11 @@ WOK end @processing end + def composite_file + pth=path.dal #"#{processing}/composite" + File.mkpath(pth) unless FileTest.directory?(pth) + pth + end def dal pth=if defined? @rc['processing']['dal']; "#{processing}/#{@rc['processing']['dal']}" else "#{processing}/#{defaults[:processing_dal]}" @@ -1976,7 +1998,7 @@ WOK def remote_host_base remote=remote_host_base_general #host_ip=IPSocket.getaddress(remote[:host]) unless remote[:host].empty? - @@flag_remote=true if remote[:name] =~/\S+@\S+/ #and host_ip =~/\d+\.\d+\.\d+\.\d+/ #very naive check should be enough /[0-255]+\.[0-255]+\.[0-255]+\.[0-255]+/ + @@flag_remote=true if remote[:name] =~/\S+?@\S+/ #and host_ip =~/\d+\.\d+\.\d+\.\d+/ #very naive check should be enough /[0-255]+\.[0-255]+\.[0-255]+\.[0-255]+/ remote_host_base_general[:name] end def scp #sort out later using ruby libraries #not ideal, first time each file is sent, -r must be called separately for subdir to be built |