Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Warm compile cache after install
Browse files Browse the repository at this point in the history
This makes it so the next activate call will be able to use the
cached versions immediately.
  • Loading branch information
kevinsawicki committed Oct 15, 2014
1 parent aa0cba7 commit b120210
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/install.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b120210

Please sign in to comment.