accept build id parameter when serving static files
This commit is contained in:
@@ -35,6 +35,7 @@ module.exports = CompileController =
|
||||
outputFiles: outputFiles.map (file) ->
|
||||
url: "#{Settings.apis.clsi.url}/project/#{request.project_id}/output/#{file.path}"
|
||||
type: file.type
|
||||
build: file.build
|
||||
}
|
||||
|
||||
clearCache: (req, res, next = (error) ->) ->
|
||||
|
||||
@@ -33,7 +33,7 @@ module.exports = CompileManager =
|
||||
|
||||
OutputFileFinder.findOutputFiles request.resources, compileDir, (error, outputFiles) ->
|
||||
return callback(error) if error?
|
||||
OutputCacheManager.saveOutputFiles outputFiles, compileDir, (error, newOutputFiles) ->
|
||||
OutputCacheManager.saveOutputFiles outputFiles, compileDir, (error, newOutputFiles) ->
|
||||
callback null, newOutputFiles
|
||||
|
||||
clearProject: (project_id, _callback = (error) ->) ->
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = OutputCacheManager =
|
||||
# copy all the output files into it
|
||||
#
|
||||
# TODO: use Path module
|
||||
buildId = 'build-' + Date.now()
|
||||
buildId = Date.now()
|
||||
relDir = OutputCacheManager.CACHE_DIR + '/' + buildId
|
||||
newDir = target + '/' + relDir
|
||||
OutputCacheManager.expireOutputFiles target
|
||||
@@ -25,9 +25,8 @@ module.exports = OutputCacheManager =
|
||||
else
|
||||
async.mapSeries outputFiles, (file, cb) ->
|
||||
newFile = _.clone(file)
|
||||
newFile.path = relDir + '/' + file.path
|
||||
src = target + '/' + file.path
|
||||
dst = target + '/' + newFile.path
|
||||
dst = target + '/' + relDir + '/' + file.path
|
||||
#console.log 'src', src, 'dst', dst
|
||||
fs.stat src, (err, stats) ->
|
||||
if err?
|
||||
@@ -36,6 +35,8 @@ module.exports = OutputCacheManager =
|
||||
#console.log 'isFile: copying'
|
||||
fse.copy src, dst, (err) ->
|
||||
OutputFileOptimiser.optimiseFile src, dst, (err, result) ->
|
||||
console.log 'setting buildId on', newFile, 'to', buildId
|
||||
newFile.build = buildId
|
||||
cb(err, newFile)
|
||||
else
|
||||
# other filetype - shouldn't happen
|
||||
|
||||
Reference in New Issue
Block a user