diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/epub.rb | 19 | ||||
-rw-r--r-- | lib/sisu/v3/git.rb | 20 | ||||
-rw-r--r-- | lib/sisu/v3/odf.rb | 15 | ||||
-rw-r--r-- | lib/sisu/v3/texpdf.rb | 14 |
4 files changed, 42 insertions, 26 deletions
diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index 42bc6cd9..12ec1ce0 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -670,14 +670,17 @@ module SiSU_EPUB end def output_zip mkdir_p(@md.file.output_path.epub.dir) unless FileTest.directory?(@md.file.output_path.epub.dir) - system(" - cd #{@md.env.processing_path.epub} - zip -qXr9D #{@epub_doc} * - mv #{@epub_doc} #{@md.file.place_file.epub.dir} - cd #{Dir.pwd} - ") - unless @md.opt.cmd.inspect =~/M/ - system("rm -r #{@md.env.processing_path.epub}") + if FileTest.directory?(@md.env.processing_path.epub) + pwd=Dir.pwd + Dir.chdir(@md.env.processing_path.epub) + system(" + zip -qXr9D #{@epub_doc} * + mv #{@epub_doc} #{@md.file.place_file.epub.dir} + ") + Dir.chdir(pwd) + unless @md.opt.cmd.inspect =~/M/ + system("rm -r #{@md.env.processing_path.epub}") + end end end def segtoc diff --git a/lib/sisu/v3/git.rb b/lib/sisu/v3/git.rb index 322b5846..2e76fa4a 100644 --- a/lib/sisu/v3/git.rb +++ b/lib/sisu/v3/git.rb @@ -136,16 +136,22 @@ module SiSU_Git end def git_init unless FileTest.directory?("#{@git_path[:fnb]}/.git") - system("cd #{@git_path[:fnb]}\ - && git init - ") + pwd=Dir.pwd + Dir.chdir(@git_path[:fnb]) + system("git init ") + Dir.chdir(pwd) end end def git_commit - system("cd #{@git_path[:fnb]} \ - && git add . \ - && git commit -a - ") + if FileTest.directory?("#{@git_path[:fnb]}") + pwd=Dir.pwd + Dir.chdir(@git_path[:fnb]) + system(" + git add . \ + && git commit -a + ") + Dir.chdir(pwd) + end end def populate def identify_language_versions diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index 8ff98db5..1919fa08 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -714,12 +714,15 @@ module SiSU_ODF od.close opendoc=@md.fn[:odf] mkdir_p(@md.file.output_path.odt.dir) unless FileTest.directory?(@md.file.output_path.odt.dir) - system(" - cd #{@env.processing_path.odf} - zip -qr #{opendoc} * - mv #{opendoc} #{@md.file.place_file.odt.dir} - cd #{Dir.pwd} - ") + if FileTest.directory?(@env.processing_path.odf) + pwd=Dir.pwd + Dir.chdir(@env.processing_path.odf) + system(" + zip -qr #{opendoc} * + mv #{opendoc} #{@md.file.place_file.odt.dir} + ") + Dir.chdir(pwd) + end end end end diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 155d063a..ab7995f4 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -238,11 +238,15 @@ module SiSU_TeX "#{@md.fnb}.portrait.pdf" else 'portrait.pdf' end - system(" - cd #{@md.file.output_path.pdf.dir} - rm #{mklnk} - ln -s #{pdf_p} #{mklnk} - ") + if FileTest.directory?(@md.file.output_path.pdf.dir) + pwd=Dir.pwd + Dir.chdir(@md.file.output_path.pdf.dir) + system(" + rm #{mklnk} + ln -s #{pdf_p} #{mklnk} + ") + Dir.chdir(pwd) + end end if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{pdf_l}") mklnk=if @md.file.output_dir_structure.by_language_code? \ |