apps with no release file are now assumed to be the latest release, not 0.6.0

This commit is contained in:
David Glasser
2013-03-28 16:24:43 -07:00
parent d8179cd255
commit 1ceef40beb
3 changed files with 13 additions and 16 deletions

View File

@@ -61,7 +61,8 @@ Fiber(function () {
if (context.appDir) {
context.appReleaseVersion =
project.getMeteorReleaseVersion(context.appDir);
project.getMeteorReleaseVersion(context.appDir) ||
warehouse.latestRelease();
}
// Recalculate release version, taking the current app into account.
context.releaseVersion = calculateReleaseVersion(argv);
@@ -402,8 +403,7 @@ Fiber(function () {
// Write the release to .meteor/release if it's changed (or if this is a
// pre-engine app that is being assumed to be 0.6.0).
var appRelease = project.getMeteorReleaseVersion(context.appDir);
var appPredatesEngine = project.appPredatesEngine(context.appDir);
if (appPredatesEngine || appRelease !== context.releaseVersion) {
if (appRelease === null || appRelease !== context.releaseVersion) {
project.writeMeteorReleaseVersion(context.appDir,
context.releaseVersion);
} else {

View File

@@ -67,18 +67,14 @@ _.extend(exports, {
getMeteorReleaseVersion: function (appDir) {
var releasePath = project._meteorReleaseFilePath(appDir);
if (project.appPredatesEngine(appDir)) {
try {
var lines = project._get_lines(releasePath);
} catch (e) {
// This is a legacy app with no '.meteor/release'
// file. Default to the first release of Engine.
return '0.6.0';
} else {
return project._trim_line(project._get_lines(releasePath)[0]);
// file.
return null;
}
},
appPredatesEngine: function (appDir) {
var releasePath = project._meteorReleaseFilePath(appDir);
return !fs.existsSync(releasePath);
return project._trim_line(lines[0]);
},
writeMeteorReleaseVersion: function (appDir, release) {

View File

@@ -619,10 +619,11 @@ exports.run = function (context, options) {
// tools version does change, but this (which prevents weird errors) is a
// start.)
if (files.usesWarehouse() && !context.userReleaseOverride) {
var newAppRelease = project.getMeteorReleaseVersion(context.appDir);
var newAppRelease = project.getMeteorReleaseVersion(context.appDir) ||
warehouse.latestRelease();;
if (newAppRelease !== context.appReleaseVersion) {
console.error("Your app has been updated to release '%s' from " +
"release '%s'.\nRestart meteor to use the new release.",
console.error("Your app has been updated to Meteor %s from " +
"Meteor %s.\nRestart meteor to use the new release.",
newAppRelease,
context.appReleaseVersion);
process.exit(1);