From b120210888d0f069e5355cc69cfaa879d0d1e5f3 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 8 Oct 2014 14:45:30 -0700 Subject: [PATCH] Warm compile cache after install This makes it so the next activate call will be able to use the cached versions immediately. --- src/install.coffee | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/install.coffee b/src/install.coffee index 1ee4da06b..2250b29db 100644 --- a/src/install.coffee +++ b/src/install.coffee @@ -128,6 +128,7 @@ class Install extends Command commands.push (callback) -> fs.cp(source, destination, callback) commands.push (callback) => @buildModuleCache(pack.name, callback) + commands.push (callback) => @warmCompileCache(pack.name, callback) async.waterfall commands, (error) => if error? @@ -399,6 +400,22 @@ class Install extends Command ModuleCache.create(packageDirectory) callback(null) + warmCompileCache: (packageName, callback) -> + packageDirectory = path.join(@atomPackagesDirectory, packageName) + + @getResourcePath (resourcePath) -> + try + CoffeeCache = require(path.join(resourcePath, 'src', 'coffee-cache')) + + onDirectory = (directoryPath) -> + path.basename(directoryPath) isnt 'node_modules' + + onFile = (filePath) -> + CoffeeCache.addPathToCache(filePath) + + fs.traverseTreeSync(packageDirectory, onFile, onDirectory) + callback(null) + isBundledPackage: (packageName, callback) -> @getResourcePath (resourcePath) -> try