v5 v6: start making use of --no-stop command
authorRalph Amissah <ralph@amissah.com>
Wed, 20 Aug 2014 23:04:47 +0000 (19:04 -0400)
committerRalph Amissah <ralph@amissah.com>
Wed, 20 Aug 2014 23:04:47 +0000 (19:04 -0400)
14 files changed:
data/doc/sisu/CHANGELOG_v5
data/doc/sisu/CHANGELOG_v6
lib/sisu/v5/ao_images.rb
lib/sisu/v5/db_create.rb
lib/sisu/v5/db_indexes.rb
lib/sisu/v5/dbi.rb
lib/sisu/v5/se_db.rb
lib/sisu/v5/texpdf.rb
lib/sisu/v6/ao_images.rb
lib/sisu/v6/db_create.rb
lib/sisu/v6/db_indexes.rb
lib/sisu/v6/dbi.rb
lib/sisu/v6/se_db.rb
lib/sisu/v6/texpdf.rb

index 714c6cc3d14e2e3a9ae0a9ec190d38ceb2f1d2f3..d1609df67e6444a12bb6cd7e1267b10ac0fdf741 100644 (file)
@@ -39,11 +39,13 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.2.orig.tar.xz
   sisu_5.6.2-1.dsc
 
 * hub_options, introduce "error override" --no-stop or --errors-as-warnings flag
+* start making use of --no-stop command
 
 * ao
   * book index related
   * ao_expand_insertions, blocked text match, adjust
 
+
 * texpdf, output, copyright & license
 
 * syntax hilighting, restrict heading matches, minor
index 8661c834736972a0c525f8985fea84056495c589..7b3e349274a06074a99be6f0a2d429558fc16a27 100644 (file)
@@ -29,6 +29,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.3.orig.tar.xz
   sisu_6.2.3-1.dsc
 
 * hub_options, introduce "error override" --no-stop or --errors-as-warnings flag
+* start making use of --no-stop command
 
 * ao
   * book index related
index dce92fc56df673833d31bc145687aad72270ffee..dd33833d62fd2f94d2e2dc9a3f07c42f37589f02 100644 (file)
@@ -134,6 +134,17 @@ module SiSU_AO_Images
                         end
                         img_col,img_row=/(\d+)x(\d+)/m.match(imgsys)[1,2]
                         img_col,img_row=img_col.to_i,img_row.to_i
+                      else
+                        errmsg='imagemagick or graphicksmagick are required to process images'
+                        if @md.opt.act[:no_stop][:set]==:on
+                          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                            error("#{errmsg}, proceeding (as requested) without image processing")
+                          break
+                        else
+                          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                            error("#{errmsg}, STOPPING")
+                          exit
+                        end
                       end
                     end
                     row=((img && defined? img.rows) ? img.rows : img_row)
index 956a470a0ce3e1a71e7007eb31710922487e25e2..19e8199837de073e56f4e6403d0cb1433ff22263 100644 (file)
@@ -117,10 +117,38 @@ module SiSU_DbCreate
         end
       end
       def conn_exec_pg(sql)
-        @conn.exec_params(sql)
+        begin
+          @conn.exec_params(sql)
+        rescue
+          if @conn.is_a?(NilClass)
+            errmsg="No pg connection (check pg dependencies)"
+            if @opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without pg output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
+          end
+        end
       end
       def conn_exec_sqlite(sql)
+        begin
           @conn.execute(sql)
+        rescue
+          if @conn.is_a?(NilClass)
+            errmsg="No sqlite3 connection (check sqlite3 dependencies)"
+            if @opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without sqlite output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
+          end
+        end
       end
       def metadata_and_text
         if (@opt.act[:verbose_plus][:set]==:on \
index b76e4b266e306fb4468cda7773ef3b93ab225c55..a27deb675dbf315428065630d294032915e3f814 100644 (file)
@@ -82,9 +82,23 @@ module SiSU_DbIndex
         end
       end
       def conn_execute_array(sql_arr)
-        @conn.transaction do |conn|
-          sql_arr.each do |sql|
-            conn_execute_sql(conn,sql)
+        begin
+          @conn.transaction do |conn|
+            sql_arr.each do |sql|
+              conn_execute_sql(conn,sql)
+            end
+          end
+        rescue
+          if @conn.is_a?(NilClass)
+            errmsg="No sqlite3 connection (check sqlite3 dependencies)"
+            if @opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without sqlite output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
           end
         end
       end
index 8e27f4431f1294a2f8780f7ea13b0813dd7f5419..df4b318069affb1e91e2670e780b76d8bad73204 100644 (file)
@@ -102,7 +102,12 @@ module  SiSU_DBI
     end
     def read_psql
       begin
-        require 'pg'
+        begin
+          require 'pg'
+        rescue LoadError
+          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+            error('pg NOT FOUND (LoadError)')
+        end
         @conn=@db.psql.conn_pg
       rescue
         if @opt.act[:psql_create][:set]==:on
@@ -119,11 +124,23 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet
     def read_sqlite
       begin
         begin
-          require 'sqlite3'
+          begin
+            require 'sqlite3'
+          rescue LoadError
+            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+              error('sqlite3 NOT FOUND (LoadError)')
+          end
           @conn=@db.sqlite.conn_sqlite3
         rescue LoadError
-          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
-            error('sqlite3 NOT FOUND (LoadError)')
+          errmsg='sqlite3 NOT FOUND (LoadError)'
+          if @opt.act[:no_stop][:set]==:on
+            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+              error(errmsg + ', ' + 'attempt to proceed without sqlite output (as requested)')
+          else
+            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+              error(errmsg + ', ' + 'STOPPING')
+            exit
+          end
         end
       end
     end
index fcb5fc0db00e8b765a1d281828a5b305886c15b6..84fd6ba625e8321c7ff77aa1b879b9ab14386d72 100644 (file)
@@ -140,7 +140,12 @@ module SiSU_Info_Db
         DBI.connect(psql.dbi,psql.user,psql.db)
       end
       def conn_pg
-        require 'pg'
+        begin
+          require 'pg'
+        rescue LoadError
+          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+            error('pg NOT FOUND (LoadError)')
+        end
         PG::Connection.new(dbname: psql.db, port: psql.port)
       end
      self
index 25ee6eb2284e5f0c9579bc7615e6621fcccac02c..c2c9dc7059e8b9dc80b40defdd1c9b53648b5b42 100644 (file)
@@ -269,8 +269,16 @@ module SiSU_TeX
             FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}")
             FileUtils::rm(portrait_pdf)
           else
-            STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
             STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.act[:maintenance][:set]==:on
+            errmsg="pdf file not generated #{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')} (check texlive dependencies)"
+            if @md.opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without pdf output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
           end
         end
         if @md.opt.act[:pdf_l][:set]==:on
@@ -278,8 +286,16 @@ module SiSU_TeX
             FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}")
             FileUtils::rm(landscape_pdf)
           else
-            STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
             STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.act[:maintenance][:set]==:on
+            errmsg="pdf file not generated #{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')} (check texlive dependencies)"
+            if @md.opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without pdf output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
           end
         end
         if (@md.opt.act[:verbose][:set]==:on \
@@ -314,7 +330,15 @@ module SiSU_TeX
                         and File.size(texfile) > 0
                           #@tex_f_no+=1
                         else
-                          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error("\tzero file size #{@env.processing_path.tex}/#{texfile}")
+                          errmsg="zero file size #{@env.processing_path.tex}/#{texfile}"
+                          if @md.opt.act[:no_stop][:set]==:on
+                            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                              error("#{errmsg}, proceeding without pdf output (as requested)")
+                          else
+                            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                              error("#{errmsg}, STOPPING")
+                            exit
+                          end
                         end
                       end
                     end
index 93ed4d84400e44375631274380d721d0fda7410a..e934ec1abee230acf88db50d242ad1decb2005cd 100644 (file)
@@ -134,6 +134,17 @@ module SiSU_AO_Images
                         end
                         img_col,img_row=/(\d+)x(\d+)/m.match(imgsys)[1,2]
                         img_col,img_row=img_col.to_i,img_row.to_i
+                      else
+                        errmsg='imagemagick or graphicksmagick are required to process images'
+                        if @md.opt.act[:no_stop][:set]==:on
+                          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                            error("#{errmsg}, proceeding (as requested) without image processing")
+                          break
+                        else
+                          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                            error("#{errmsg}, STOPPING")
+                          exit
+                        end
                       end
                     end
                     row=((img && defined? img.rows) ? img.rows : img_row)
index 55eab144ae380201f4abcac894e2167164c963ee..a9083b6193d96dcdcba07acc38d952583aa41596 100644 (file)
@@ -117,10 +117,38 @@ module SiSU_DbCreate
         end
       end
       def conn_exec_pg(sql)
-        @conn.exec_params(sql)
+        begin
+          @conn.exec_params(sql)
+        rescue
+          if @conn.is_a?(NilClass)
+            errmsg="No pg connection (check pg dependencies)"
+            if @opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without pg output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
+          end
+        end
       end
       def conn_exec_sqlite(sql)
+        begin
           @conn.execute(sql)
+        rescue
+          if @conn.is_a?(NilClass)
+            errmsg="No sqlite3 connection (check sqlite3 dependencies)"
+            if @opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without sqlite output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
+          end
+        end
       end
       def metadata_and_text
         if (@opt.act[:verbose_plus][:set]==:on \
index 876fd85674bf8a28f39f981dda5842b82bf60226..12c427dd271901f5b7095a42103e7b0593616bbd 100644 (file)
@@ -82,9 +82,23 @@ module SiSU_DbIndex
         end
       end
       def conn_execute_array(sql_arr)
-        @conn.transaction do |conn|
-          sql_arr.each do |sql|
-            conn_execute_sql(conn,sql)
+        begin
+          @conn.transaction do |conn|
+            sql_arr.each do |sql|
+              conn_execute_sql(conn,sql)
+            end
+          end
+        rescue
+          if @conn.is_a?(NilClass)
+            errmsg="No sqlite3 connection (check sqlite3 dependencies)"
+            if @opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without sqlite output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
           end
         end
       end
index 7b68be2f4f133afa232f58dbbc18f0df7823d164..47173d4f87d8e1039b5574a647b9ba543099187d 100644 (file)
@@ -102,7 +102,12 @@ module  SiSU_DBI
     end
     def read_psql
       begin
-        require 'pg'
+        begin
+          require 'pg'
+        rescue LoadError
+          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+            error('pg NOT FOUND (LoadError)')
+        end
         @conn=@db.psql.conn_pg
       rescue
         if @opt.act[:psql_create][:set]==:on
@@ -119,11 +124,23 @@ manually create the database: "#{cX.green}#{@db.db}#{cX.off}" if it does not yet
     def read_sqlite
       begin
         begin
-          require 'sqlite3'
+          begin
+            require 'sqlite3'
+          rescue LoadError
+            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+              error('sqlite3 NOT FOUND (LoadError)')
+          end
           @conn=@db.sqlite.conn_sqlite3
         rescue LoadError
-          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
-            error('sqlite3 NOT FOUND (LoadError)')
+          errmsg='sqlite3 NOT FOUND (LoadError)'
+          if @opt.act[:no_stop][:set]==:on
+            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+              error(errmsg + ', ' + 'attempt to proceed without sqlite output (as requested)')
+          else
+            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+              error(errmsg + ', ' + 'STOPPING')
+            exit
+          end
         end
       end
     end
index ac226675f8bfc21909b6c92d3170f125ae4c8d7f..abf80b323d219350517e7b6e81886033ba9de573 100644 (file)
@@ -140,7 +140,12 @@ module SiSU_Info_Db
         DBI.connect(psql.dbi,psql.user,psql.db)
       end
       def conn_pg
-        require 'pg'
+        begin
+          require 'pg'
+        rescue LoadError
+          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+            error('pg NOT FOUND (LoadError)')
+        end
         PG::Connection.new(dbname: psql.db, port: psql.port)
       end
      self
index df6e96e2bce1a0ff3c6df7c4ac5cc42e6fefa7e1..10bfa961b2615305217b5c4588aba21769043c61 100644 (file)
@@ -269,8 +269,16 @@ module SiSU_TeX
             FileUtils::cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}")
             FileUtils::rm(portrait_pdf)
           else
-            STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
             STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{portrait_pdf}" if @md.opt.act[:maintenance][:set]==:on
+            errmsg="pdf file not generated #{portrait_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')} (check texlive dependencies)"
+            if @md.opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without pdf output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
           end
         end
         if @md.opt.act[:pdf_l][:set]==:on
@@ -278,8 +286,16 @@ module SiSU_TeX
             FileUtils::cp(landscape_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_l}")
             FileUtils::rm(landscape_pdf)
           else
-            STDERR.puts "#{cX.fuchsia}pdf file not generated#{cX.off} <#{cX.blue}#{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')}#{cX.off}> (check texlive dependencies)"
             STDERR.puts "#{__FILE__}:#{__LINE__} NOT FOUND: #{landscape_pdf}" if @md.opt.act[:maintenance][:set]==:on
+            errmsg="pdf file not generated #{landscape_pdf.gsub(/.+?([^\/]+?\.pdf)$/,'\1')} (check texlive dependencies)"
+            if @md.opt.act[:no_stop][:set]==:on
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, proceeding without pdf output (as requested)")
+            else
+              SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                error("#{errmsg}, STOPPING")
+              exit
+            end
           end
         end
         if (@md.opt.act[:verbose][:set]==:on \
@@ -314,7 +330,15 @@ module SiSU_TeX
                         and File.size(texfile) > 0
                           #@tex_f_no+=1
                         else
-                          SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).error("\tzero file size #{@env.processing_path.tex}/#{texfile}")
+                          errmsg="zero file size #{@env.processing_path.tex}/#{texfile}"
+                          if @md.opt.act[:no_stop][:set]==:on
+                            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                              error("#{errmsg}, proceeding without pdf output (as requested)")
+                          else
+                            SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+                              error("#{errmsg}, STOPPING")
+                            exit
+                          end
                         end
                       end
                     end