Skip to content

Commit

Permalink
Ensure require() uses latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
Naatan committed Apr 28, 2014
1 parent 7648476 commit 731352a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ var server = new function()
if ( ! fs.existsSync(path + "/deploy.js")) continue;

// Validate whether this deployerRunner has a schedule method
if (require.resolve(path + "/deploy.js") in require.cache)
delete require.cache[require.resolve(path + "/deploy.js")];
var deployerRunner = require(path + "/deploy.js");
if ( ! ("schedule" in deployerRunner)) continue;

Expand Down Expand Up @@ -203,6 +205,8 @@ var server = new function()
}

// Invoke the actual deployment script
if (require.resolve(deployer.path + "/deploy.js") in require.cache)
delete require.cache[require.resolve(deployer.path + "/deploy.js")];
var deployerRunner = require(deployer.path + "/deploy.js");
deployerRunner.init(logger);
deployerRunner.run(deployer, function(err)
Expand Down

0 comments on commit 731352a

Please sign in to comment.