From 78fcabbd58efc538cabc08b370c933592f990239 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Mon, 11 Jul 2016 18:39:52 -0400 Subject: [PATCH] Always link .meteor/dev_bundle to release specified in .meteor/release. I was mistaken to think that files.getDevBundle() would be called after springboarding to the appropriate release. --- tools/project-context.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tools/project-context.js b/tools/project-context.js index 3138d77af7..b63f72b512 100644 --- a/tools/project-context.js +++ b/tools/project-context.js @@ -315,7 +315,8 @@ _.extend(ProjectContext.prototype, { // Read .meteor/release. self.releaseFile = new exports.ReleaseFile({ - projectDir: self.projectDir + projectDir: self.projectDir, + catalog: self._officialCatalog, }); if (buildmessage.jobHasMessages()) return; @@ -1282,6 +1283,8 @@ exports.ReleaseFile = function (options) { var self = this; self.filename = files.pathJoin(options.projectDir, '.meteor', 'release'); + self.catalog = options.catalog || catalog.official; + self.watchSet = null; // The release name actually written in the file. Null if no fill. Empty if // the file is empty. @@ -1347,6 +1350,29 @@ _.extend(exports.ReleaseFile.prototype, { self.ensureDevBundleLink(); }, + // Returns an absolute path to the dev_bundle appropriate for the + // release specified in the .meteor/release file. + getDevBundle() { + let devBundle = files.getDevBundle(); + const devBundleParts = devBundle.split(files.pathSep); + const meteorToolIndex = devBundleParts.lastIndexOf("meteor-tool"); + + if (meteorToolIndex >= 0) { + const releaseVersion = this.catalog.getReleaseVersion( + this.releaseTrack, + this.releaseVersion + ); + + if (releaseVersion) { + const meteorToolVersion = releaseVersion.tool.split("@").pop(); + devBundleParts[meteorToolIndex + 1] = meteorToolVersion; + devBundle = devBundleParts.join(files.pathSep); + } + } + + return files.realpath(devBundle); + }, + ensureDevBundleLink() { import { makeLink, readLink } from "./cli/dev-bundle-links.js"; @@ -1368,7 +1394,7 @@ _.extend(exports.ReleaseFile.prototype, { return; } - const newTarget = files.realpath(files.getDevBundle()); + const newTarget = this.getDevBundle(); try { if (newTarget === readLink(devBundleLink)) {