]> granicus.if.org Git - docbook-dsssl/commitdiff
Working toward getting the automated test suite working in Windows
authorKeith Fahlgren <abdelazer@users.sourceforge.net>
Wed, 11 Aug 2010 04:09:42 +0000 (04:09 +0000)
committerKeith Fahlgren <abdelazer@users.sourceforge.net>
Wed, 11 Aug 2010 04:09:42 +0000 (04:09 +0000)
xsl/epub/bin/lib/docbook.rb
xsl/epub/bin/spec/README
xsl/epub/bin/spec/epub_realbook_spec.rb
xsl/epub/bin/spec/epub_regressions_spec.rb
xsl/epub/bin/spec/epub_spec.rb
xsl/epub/bin/spec/spec_helper.rb

index 2bb90a97b082612b07f08caa04f2074eed89c262..430662e54b5e11463538eb2391d8d8a5a8987f82 100755 (executable)
@@ -47,7 +47,7 @@ module DocBook
 
     def self.invalid?(file)
       # Obnoxiously, we can't just check for a non-zero output...
-      cmd = "#{CHECKER} #{file}"
+      cmd = %Q(#{CHECKER} "#{file}")
       output = `#{cmd} 2>&1`
 
       if $?.to_i == 0
@@ -85,7 +85,7 @@ module DocBook
                  html_stylesheet,
                 ].join(" ")
       # Double-quote stylesheet & file to help Windows cmd.exe
-      db2epub_cmd = "cd #{@output_dir} && #{XSLT_PROCESSOR} #{options} \"#{@stylesheet}\" \"#{@collapsed_docbook_file}\""
+      db2epub_cmd = %Q(cd "#{@output_dir}" && #{XSLT_PROCESSOR} #{options} "#{@stylesheet}" "#{@collapsed_docbook_file}")
       STDERR.puts db2epub_cmd if $DEBUG
       success = system(db2epub_cmd)
       raise "Could not render as .epub to #{output_file} (#{db2epub_cmd})" unless success
@@ -105,7 +105,7 @@ module DocBook
       callouts = copy_callouts()
       # zip -X -r ../book.epub mimetype META-INF OEBPS
       # Double-quote stylesheet & file to help Windows cmd.exe
-      zip_cmd = "cd \"#{@output_dir}\" &&  #{ZIPPER} #{quiet} -X -r  \"#{File.expand_path(output_file)}\" \"#{mimetype_filename}\" \"#{meta}\" \"#{oebps}\""
+      zip_cmd = %Q(cd "#{@output_dir}" &&  #{ZIPPER} #{quiet} -X -r  "#{File.expand_path(output_file)}" "#{mimetype_filename}" "#{meta}" "#{oebps}")
       puts zip_cmd if $DEBUG
       success = system(zip_cmd)
       raise "Could not bundle into .epub file to #{output_file}" unless success
@@ -115,13 +115,14 @@ module DocBook
     # were XIncluded or added by ENTITY
     #   http://sourceforge.net/tracker/?func=detail&aid=2750442&group_id=21935&atid=373747
     def collapse_docbook
+      # Double-quote stylesheet & file to help Windows cmd.exe
       collapsed_file = File.join(File.expand_path(File.dirname(@docbook_file)), 
                                  '.collapsed.' + File.basename(@docbook_file))
-      entity_collapse_command = "xmllint --loaddtd --noent -o '#{collapsed_file}' '#{@docbook_file}'"
+      entity_collapse_command = %Q(xmllint --loaddtd --noent -o "#{collapsed_file}" "#{@docbook_file}")
       entity_success = system(entity_collapse_command)
       raise "Could not collapse named entites in #{@docbook_file}" unless entity_success
 
-      xinclude_collapse_command = "xmllint --xinclude -o '#{collapsed_file}' '#{collapsed_file}'"
+      xinclude_collapse_command = %Q(xmllint --xinclude -o "#{collapsed_file}" "#{collapsed_file}")
       xinclude_success = system(xinclude_collapse_command)
       raise "Could not collapse XIncludes in #{@docbook_file}" unless xinclude_success
 
index d604a4615dd6a77514c12da74bbd7b70d12e392e..033e132352c82de92c46d9759eb018ad52e3868e 100644 (file)
@@ -25,7 +25,7 @@ PATH (or equivalent for Windows):
 * XML Catalogs for DocBook 4.4 & 4.5 (this can be a pain)
 * ruby 1.8+
 * rspec version=1.1 http://rspec.info (gem install rspec --version 1.1)
-* zip
+* zip & unzip
 * java
 * epubcheck (1.0.5+) http://code.google.com/p/epubcheck/
   Note: a standalone epubcheck command is just a shell script or .bat as:
index fd0f571c8d38a5811ca29c6cbbbfcbb807b73f13..aa8a569b9e98ffab0a10dd2cede39f9661091969 100755 (executable)
@@ -29,7 +29,7 @@ describe DocBook::Epub do
     FileUtils.copy(@epub_file, "." + File.basename(@xml_file, ".xml") + ".epub") if $DEBUG
 
     @tmpdir2 = File.join(Dir::tmpdir(), "epubreal"); Dir.mkdir(@tmpdir2) rescue Errno::EEXIST
-    success = system("unzip -q -o -d #{@tmpdir2} #{@epub_file}")
+    success = system(%Q(unzip -q -o -d "#{@tmpdir2}" "#{@epub_file}"))
     raise "Could not unzip #{epub_file}" unless success
 
     @html_files = Dir.glob(File.join(@tmpdir2, "**", "*.html"))
index d7ad15b5920e77a9b688d352ca7f7b5477a99f37..d30aa9814168abdf8adda9d33626c762488cc84c 100755 (executable)
@@ -34,7 +34,7 @@ describe DocBook::Epub do
     FileUtils.copy(epub_file, "./.t.epub") if $DEBUG
 
     itemref_tmpdir = File.join(Dir::tmpdir(), "epubitemref"); Dir.mkdir(itemref_tmpdir) rescue Errno::EEXIST
-    system("unzip -q -o -d #{itemref_tmpdir} #{epub_file}")
+    system(%Q(unzip -q -o -d "#{itemref_tmpdir}" "#{epub_file}"))
     opf_file = File.join(itemref_tmpdir, "OEBPS", "content.opf")
     opf = REXML::Document.new(File.new(opf_file))
 
@@ -51,7 +51,7 @@ describe DocBook::Epub do
       epub.render_to_file(epubfile, $DEBUG)
       FileUtils.copy(epubfile, ".re.ded.epub") if $DEBUG
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{epubfile}"))
       raise "Could not unzip #{epubfile}" unless success
       glob = Dir.glob(File.join(tmpdir, "**", "*.opf"))
       index_html_links = glob.find_all {|opf_file| File.open(opf_file).readlines.to_s =~ /href=["']index.html["']/}
@@ -73,7 +73,7 @@ describe DocBook::Epub do
 
       tmpdir = File.join(Dir::tmpdir(), "epubcssreg"); Dir.mkdir(tmpdir) rescue Errno::EEXIST
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{css_epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{css_epubfile}")
       raise "Could not unzip #{css_epubfile}" unless success
       opf_files = Dir.glob(File.join(tmpdir, "**", "*.opf"))
       opf_files.find_all {|opf_file| 
@@ -97,10 +97,10 @@ describe DocBook::Epub do
     xhtml_dtd = "DTD XHTML 1.1"
 
     itemref_tmpdir = File.join(Dir::tmpdir(), "epubitemref"); Dir.mkdir(itemref_tmpdir) rescue Errno::EEXIST
-    system("unzip -q -o -d #{itemref_tmpdir} #{epub_file}")
+    system(%Q(unzip -q -o -d "#{itemref_tmpdir}" "#{epub_file}"))
 
     opf_file = File.join(itemref_tmpdir, "OEBPS", "content.opf")
-    xhtml_dtd_in_opf_file = system("grep '#{xhtml_dtd}' #{opf_file}")
+    xhtml_dtd_in_opf_file = system(%Q(grep "#{xhtml_dtd}" "#{opf_file}"))
     xhtml_dtd_in_opf_file.should_not be_true
   end
 
@@ -160,7 +160,7 @@ describe DocBook::Epub do
     epubfile  = File.join(tmpdir, shortname + ".epub")
     epub.render_to_file(epubfile, $DEBUG)
     FileUtils.copy(epubfile, "." + shortname + ".epub") if $DEBUG
-    success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{File.expand_path(epubfile)}")
+    success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{File.expand_path(epubfile)}"))
     raise "Could not unzip #{epubfile}" unless success
     container_file = File.join(tmpdir, 'META-INF', 'container.xml')
     container_lines = File.open(container_file).readlines
@@ -199,7 +199,7 @@ describe DocBook::Epub do
       epub.render_to_file(epubfile, $DEBUG)
       FileUtils.copy(epubfile, ".b.epub") if $DEBUG
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{epubfile}"))
       raise "Could not unzip #{epubfile}" unless success
       glob = Dir.glob(File.join(tmpdir, "**", "*.html"))
       glob.each {|html_file| 
@@ -229,12 +229,12 @@ describe DocBook::Epub do
     ncx_epubfile.should be_valid_epub  
 
     ncx_tmpdir = File.join(Dir::tmpdir(), "epubncx"); Dir.mkdir(ncx_tmpdir) rescue Errno::EEXIST
-    system("unzip -q -o -d #{ncx_tmpdir} #{ncx_epubfile}")
+    system(%Q(unzip -q -o -d "#{ncx_tmpdir}" "#{ncx_epubfile}"))
 
     ncx_file = File.join(ncx_tmpdir, "OEBPS", "toc.ncx")
     ncx_default = '<ncx '
 
-    ncx_in_default_ns = system("grep '#{ncx_default}' #{ncx_file}")
+    ncx_in_default_ns = system(%Q(grep "#{ncx_default}" "#{ncx_file}"))
     ncx_in_default_ns.should be_true
   end
 
index a77494a2365e539ed98bec67ebf768efac33c530..6a68a8fb3bf634bcb4215c16e1c2d3168fcc8c5a 100755 (executable)
@@ -170,7 +170,7 @@ describe DocBook::Epub do
     begin
       tmpdir = File.join(Dir::tmpdir(), "epubinclusiontest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{File.expand_path(@manygraphic_epubfile)}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o #{File.expand_path(@manygraphic_epubfile)}"))
       raise "Could not unzip #{@manygraphic_epubfile}" unless success
       glob = Dir.glob(File.join(tmpdir, "**", "*.*"))
       pdfs_in_glob = glob.find_all {|file| file =~ /\.pdf/i}
@@ -186,7 +186,7 @@ describe DocBook::Epub do
     begin
       tmpdir = File.join(Dir::tmpdir(), "epubcsshtmltest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{@css_epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{@css_epubfile}"))
       raise "Could not unzip #{@css_epubfile}" unless success
       html_files = Dir.glob(File.join(tmpdir, "**", "*.html"))
       html_links = html_files.find_all {|html_file| File.open(html_file).readlines.to_s =~ /<link [^>]*#{@css_file_base}/}
@@ -202,7 +202,7 @@ describe DocBook::Epub do
     begin
       tmpdir = File.join(Dir::tmpdir(), "epubcssfiletest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{@css_epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{@css_epubfile}"))
       raise "Could not unzip #{@css_epubfile}" unless success
       css_files = Dir.glob(File.join(tmpdir, "**", "*.css"))
       css_files.should_not be_empty
@@ -217,7 +217,7 @@ describe DocBook::Epub do
     begin
       tmpdir = File.join(Dir::tmpdir(), "epubcsshtmltest"); Dir.mkdir(tmpdir) rescue Errno::EEXIST
       
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{@css_epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{@css_epubfile}"))
       raise "Could not unzip #{@css_epubfile}" unless success
       opf_files = Dir.glob(File.join(tmpdir, "**", "*.opf"))
       opf_links = opf_files.find_all {|opf_file| File.open(opf_file).readlines.to_s =~ /<(opf:item|item) [^>]*#{@css_file_base}/}
@@ -233,7 +233,7 @@ describe DocBook::Epub do
     begin
       tmpdir = File.join(Dir::tmpdir(), "epubfontman"); Dir.mkdir(tmpdir) rescue Errno::EEXIST
       
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{@css_epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{@css_epubfile}"))
       raise "Could not unzip #{@css_epubfile}" unless success
       opf_files = Dir.glob(File.join(tmpdir, "**", "*.opf"))
 
@@ -252,7 +252,7 @@ describe DocBook::Epub do
     begin
       tmpdir = File.join(Dir::tmpdir(), "epubfontbundle"); Dir.mkdir(tmpdir) rescue Errno::EEXIST
       
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{@css_epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{@css_epubfile}"))
       raise "Could not unzip #{@css_epubfile}" unless success
       @embedded_fonts.each {|font|
         font_files = Dir.glob(File.join(tmpdir, "**", File.basename(font)))
@@ -278,7 +278,7 @@ describe DocBook::Epub do
       epub.render_to_file(epubfile, $DEBUG)
       FileUtils.copy(epubfile, ".h1c.epub") if $DEBUG
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{epubfile}"))
       raise "Could not unzip #{epubfile}" unless success
       glob = Dir.glob(File.join(tmpdir, "**", "*.html"))
       glob.each {|html_file| 
@@ -302,7 +302,7 @@ describe DocBook::Epub do
       epub.render_to_file(epubfile, $DEBUG)
       FileUtils.copy(epubfile, ".h1c2.epub") if $DEBUG
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{epubfile}"))
       raise "Could not unzip #{epubfile}" unless success
       glob = Dir.glob(File.join(tmpdir, "**", "*.html"))
       glob.each {|html_file| 
@@ -326,7 +326,7 @@ describe DocBook::Epub do
       epub.render_to_file(epubfile, $DEBUG)
       FileUtils.copy(epubfile, ".tcl.epub") if $DEBUG
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{epubfile}"))
       raise "Could not unzip #{epubfile}" unless success
       glob = Dir.glob(File.join(tmpdir, "**", "*.opf"))
       toc_links = glob.find_all {|opf_file| File.open(opf_file).readlines.to_s =~ /type=["']toc["']/}
@@ -350,7 +350,7 @@ describe DocBook::Epub do
       epub.render_to_file(epubfile, $DEBUG)
       FileUtils.copy(epubfile, ".cust.epub") if $DEBUG
 
-      success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{epubfile}")
+      success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{epubfile}"))
       raise "Could not unzip #{epubfile}" unless success
       glob = Dir.glob(File.join(tmpdir, "**", "*.html")) 
       # The customization layer changes the style of cross references to _not_
index 51b755d38ca94cda137dd645adef9f3450a062ae..30193d09e92b262e9ee4c0d2ea32e6c210cab299 100755 (executable)
@@ -46,7 +46,7 @@ def opf_lines(filename, filedir)
   epubfile  = File.join(tmpdir, shortname + ".epub")
   epub.render_to_file(epubfile, $DEBUG)
   FileUtils.copy(epubfile, "." + shortname + ".epub") if $DEBUG
-  success = system("unzip -q -d #{File.expand_path(tmpdir)} -o #{File.expand_path(epubfile)}")
+  success = system(%Q(unzip -q -d "#{File.expand_path(tmpdir)}" -o "#{File.expand_path(epubfile)}"))
   raise "Could not unzip #{epubfile}" unless success
   opf_file = Dir.glob(File.join(tmpdir, "**", "*.opf")).first
   opf_lines = File.open(opf_file).readlines