v5 v6: bin/sisu, hub, hub close (ensure), remove /tmp/ processing dir
authorRalph Amissah <ralph@amissah.com>
Wed, 23 Jul 2014 01:32:30 +0000 (21:32 -0400)
committerRalph Amissah <ralph@amissah.com>
Wed, 23 Jul 2014 01:32:30 +0000 (21:32 -0400)
bin/sisu
data/doc/sisu/CHANGELOG_v5
data/doc/sisu/CHANGELOG_v6
lib/sisu/v5/hub.rb
lib/sisu/v6/hub.rb

index ffc5a8a54a32ee270c35c5b506b8e5b8f4cd8904..44263adcbc76684251ce12e95ccd116c87cb3115 100644 (file)
--- a/bin/sisu
+++ b/bin/sisu
@@ -225,40 +225,47 @@ class Orient
   def control
     require "#{sisu_is[:path_lib]}/hub"
     sisu_called_from_directory
-    if get_processing_info.processing_files.length > 0
-      get_processing_info.processing_files.each_pair do |markup_dir,markup_file|
-        begin
-          $sisu_document_markup_directory=markup_dir.gsub(/\/$/,'')
-          argv_sub=get_processing_info.command_line_modifiers + markup_file
-          if FileTest.directory?(markup_dir)
-            system("cd #{markup_dir}")
-            Dir.chdir(markup_dir)
-            $sisu_document_markup_directory_base_fixed_path=
-              Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'')
-            SiSU::HubMaster.new(argv_sub,sisu_called_from_directory)
-          elsif markup_dir =~/https?:/
-            markup_file.each do |mf|
-              (FileTest.file?(mf)) \
-              ? (puts 'requested remote file already exists in current directory ' \
-                + Dir.pwd + ' using ' + mf)
-              : (system("wget #{markup_dir}/#{mf}"))
+    begin
+      if get_processing_info.processing_files.length > 0
+        get_processing_info.processing_files.each_pair do |markup_dir,markup_file|
+          begin
+            $sisu_document_markup_directory=markup_dir.gsub(/\/$/,'')
+            argv_sub=get_processing_info.command_line_modifiers + markup_file
+            if FileTest.directory?(markup_dir)
+              system("cd #{markup_dir}")
+              Dir.chdir(markup_dir)
+              $sisu_document_markup_directory_base_fixed_path=
+                Dir.pwd.gsub(/\/(?:#{language_list.regex})$/,'')
+              SiSU::HubMaster.new(argv_sub,sisu_called_from_directory)
+            elsif markup_dir =~/https?:/
+              markup_file.each do |mf|
+                (FileTest.file?(mf)) \
+                ? (puts 'requested remote file already exists in current directory ' \
+                  + Dir.pwd + ' using ' + mf)
+                : (system("wget #{markup_dir}/#{mf}"))
+              end
+              $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_called_from_directory)
+            else p "Error directory specified #{markup_dir} not found"
             end
-            $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_called_from_directory)
-          else p "Error directory specified #{markup_dir} not found"
+          ensure
+            Dir.chdir(sisu_called_from_directory)
+            system("cd #{sisu_called_from_directory}")
           end
-        ensure
-          Dir.chdir(sisu_called_from_directory)
-          system("cd #{sisu_called_from_directory}")
         end
+      else
+        $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_called_from_directory)
       end
-    else
-      $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_called_from_directory)
+    rescue
+    ensure
+      SiSU::HubClose.new(sisu_called_from_directory)
+      Dir.chdir(sisu_called_from_directory)
+      system("cd #{sisu_called_from_directory}")
     end
   end
 end
index a1f293e94bd5c08939bb8f744c88f5162d591af7..ea3afa141be2acfd5f4d3dfa2973c97cb5d16989 100644 (file)
@@ -38,6 +38,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.5.2.orig.tar.xz
   sisu_5.5.2.orig.tar.xz
   sisu_5.5.2-1.dsc
 
+* bin/sisu, hub, hub close (ensure), remove /tmp/ processing dir
+
 %% 5.5.1.orig.tar.xz (2014-07-15:28/2)
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_5.5.1
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_5.5.1-1
index 0c6b7311f223775b29b3072aa3bb0db11b0b9366..41165ea5a820c02a5f91236672fc84b24535a078 100644 (file)
@@ -28,6 +28,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.1.2.orig.tar.xz
   sisu_6.1.2.orig.tar.xz
   sisu_6.1.2-1.dsc
 
+* bin/sisu, hub, hub close (ensure), remove /tmp/ processing dir
+
 %% 6.1.1.orig.tar.xz (2014-07-15:28/2)
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_6.1.1
 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_6.1.1-1
index 6a0f4640dc75969023126be65b428a822fe820c8..510e209207d2b3cc7a1c87d288dfe7404df546da 100644 (file)
@@ -93,6 +93,22 @@ module SiSU
       end
     end
   end
+  class HubClose
+    def initialize(call_path)
+      begin
+        @env=SiSU_Env::InfoEnv.new
+      rescue
+      ensure
+        if FileTest.directory?(@env.processing_path.processing) \
+        and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/
+          FileUtils::cd(@env.processing_path.processing_base_tmp) do
+            FileUtils::rm_rf('.')
+          end
+        end
+        Dir.chdir(call_path)
+      end
+    end
+  end
   class OptionLoopFiles
     attr_reader :opt
     def initialize(opt)
@@ -111,6 +127,7 @@ module SiSU
         @opt.pth=@opt.f_pths[i][:pth]
         @opt.lng=@opt.f_pths[i][:lng]
         Dir.chdir(@opt.f_pth[:pth]) #watch
+        SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track
         @env=SiSU_Env::InfoEnv.new(fno)
         yield
       end
@@ -784,8 +801,10 @@ module SiSU
           and @@env.user \
           and FileTest.directory?(@@env.processing_path.processing) \
           and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area
-            FileUtils::cd(@@env.processing_path.processing_base_tmp) do
-              FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on
+            if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/
+              FileUtils::cd(@@env.processing_path.processing_base_tmp) do
+                FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on
+              end
             end
           end
         elsif action_on_file_ == :true \
index 1818a714339eeb182943c19bf3e2acba27b8dc27..e061ee4688d7742aaf5bf3c1c5b19e0ab5732903 100644 (file)
@@ -93,6 +93,22 @@ module SiSU
       end
     end
   end
+  class HubClose
+    def initialize(call_path)
+      begin
+        @env=SiSU_Env::InfoEnv.new
+      rescue
+      ensure
+        if FileTest.directory?(@env.processing_path.processing) \
+        and @env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/
+          FileUtils::cd(@env.processing_path.processing_base_tmp) do
+            FileUtils::rm_rf('.')
+          end
+        end
+        Dir.chdir(call_path)
+      end
+    end
+  end
   class OptionLoopFiles
     attr_reader :opt
     def initialize(opt)
@@ -111,6 +127,7 @@ module SiSU
         @opt.pth=@opt.f_pths[i][:pth]
         @opt.lng=@opt.f_pths[i][:lng]
         Dir.chdir(@opt.f_pth[:pth]) #watch
+        SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track
         @env=SiSU_Env::InfoEnv.new(fno)
         yield
       end
@@ -784,8 +801,10 @@ module SiSU
           and @@env.user \
           and FileTest.directory?(@@env.processing_path.processing) \
           and @@env.processing_path.processing =~/#{@@env.user}$/ #clean temporary processing directory of content as is located in public area
-            FileUtils::cd(@@env.processing_path.processing_base_tmp) do
-              FileUtils::rm_rf(@@env.user) unless @opt.act[:maintenance][:set] ==:on
+            if @@env.processing_path.processing_base_tmp =~/^\/tmp\/\S+/
+              FileUtils::cd(@@env.processing_path.processing_base_tmp) do
+                FileUtils::rm_rf('.') unless @opt.act[:maintenance][:set] ==:on
+              end
             end
           end
         elsif action_on_file_ == :true \