mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-27 00:44:18 +00:00
extend caching for tikz, minted and markdown files
This commit is contained in:
parent
1b3e2678bf
commit
74dd560979
2 changed files with 63 additions and 1 deletions
|
@ -78,7 +78,13 @@ module.exports = ResourceWriter =
|
|||
should_delete = true
|
||||
if path.match(/^output\./) or path.match(/\.aux$/) or path.match(/^cache\//) # knitr cache
|
||||
should_delete = false
|
||||
if path.match(/^output-.*/) # Tikz cached figures
|
||||
if path.match(/^output-.*/) # Tikz cached figures (default case)
|
||||
should_delete = false
|
||||
if path.match(/\.(pdf|dpth|md5)$/) # Tikz cached figures (by extension)
|
||||
should_delete = false
|
||||
if path.match(/\.(pygtex|pygstyle)$/) or path.match(/(^|\/)_minted-[^\/]+\//) # minted files/directory
|
||||
should_delete = false
|
||||
if path.match(/\.md\.tex$/) or path.match(/(^|\/)_markdown_[^\/]+\//) # markdown files/directory
|
||||
should_delete = false
|
||||
if path.match(/-eps-converted-to\.pdf$/) # Epstopdf generated files
|
||||
should_delete = false
|
||||
|
|
|
@ -137,6 +137,27 @@ describe "ResourceWriter", ->
|
|||
},{
|
||||
path: "figures/image-eps-converted-to.pdf"
|
||||
type: "pdf"
|
||||
},{
|
||||
path: "foo/main-figure0.md5"
|
||||
type: "md5"
|
||||
}, {
|
||||
path: "foo/main-figure0.dpth"
|
||||
type: "dpth"
|
||||
}, {
|
||||
path: "foo/main-figure0.pdf"
|
||||
type: "pdf"
|
||||
}, {
|
||||
path: "_minted-main/default-pyg-prefix.pygstyle"
|
||||
type: "pygstyle"
|
||||
}, {
|
||||
path: "_minted-main/default.pygstyle"
|
||||
type: "pygstyle"
|
||||
}, {
|
||||
path: "_minted-main/35E248B60965545BD232AE9F0FE9750D504A7AF0CD3BAA7542030FC560DFCC45.pygtex"
|
||||
type: "pygtex"
|
||||
}, {
|
||||
path: "_markdown_main/30893013dec5d869a415610079774c2f.md.tex"
|
||||
type: "tex"
|
||||
}]
|
||||
@resources = "mock-resources"
|
||||
@OutputFileFinder.findOutputFiles = sinon.stub().callsArgWith(2, null, @output_files)
|
||||
|
@ -173,6 +194,41 @@ describe "ResourceWriter", ->
|
|||
.calledWith(path.join(@basePath, "figures/image-eps-converted-to.pdf"))
|
||||
.should.equal false
|
||||
|
||||
it "should not delete the tikz md5 files", ->
|
||||
@ResourceWriter._deleteFileIfNotDirectory
|
||||
.calledWith(path.join(@basePath, "foo/main-figure0.md5"))
|
||||
.should.equal false
|
||||
|
||||
it "should not delete the tikz dpth files", ->
|
||||
@ResourceWriter._deleteFileIfNotDirectory
|
||||
.calledWith(path.join(@basePath, "foo/main-figure0.dpth"))
|
||||
.should.equal false
|
||||
|
||||
it "should not delete the tikz pdf files", ->
|
||||
@ResourceWriter._deleteFileIfNotDirectory
|
||||
.calledWith(path.join(@basePath, "foo/main-figure0.pdf"))
|
||||
.should.equal false
|
||||
|
||||
it "should not delete the minted pygstyle files", ->
|
||||
@ResourceWriter._deleteFileIfNotDirectory
|
||||
.calledWith(path.join(@basePath, "_minted-main/default-pyg-prefix.pygstyle"))
|
||||
.should.equal false
|
||||
|
||||
it "should not delete the minted default pygstyle files", ->
|
||||
@ResourceWriter._deleteFileIfNotDirectory
|
||||
.calledWith(path.join(@basePath, "_minted-main/default.pygstyle"))
|
||||
.should.equal false
|
||||
|
||||
it "should not delete the minted default pygtex files", ->
|
||||
@ResourceWriter._deleteFileIfNotDirectory
|
||||
.calledWith(path.join(@basePath, "_minted-main/35E248B60965545BD232AE9F0FE9750D504A7AF0CD3BAA7542030FC560DFCC45.pygtex"))
|
||||
.should.equal false
|
||||
|
||||
it "should not delete the markdown md.tex files", ->
|
||||
@ResourceWriter._deleteFileIfNotDirectory
|
||||
.calledWith(path.join(@basePath, "_markdown_main/30893013dec5d869a415610079774c2f.md.tex"))
|
||||
.should.equal false
|
||||
|
||||
it "should call the callback", ->
|
||||
@callback.called.should.equal true
|
||||
|
||||
|
|
Loading…
Reference in a new issue