indicate in meteor list when new versions are available

This commit is contained in:
ekatek
2014-07-15 17:19:08 -07:00
parent abfc8961a3
commit cf1d45fa82
4 changed files with 33 additions and 4 deletions

View File

@@ -870,6 +870,7 @@ main.registerCommand({
// Versions of the packages. We need this to get the right description for the
// user, in case it changed between versions.
var versions = project.getVersions();
var newVersionsAvailable = false;
var messages = buildmessage.capture(function () {
_.each(packages, function (version, name) {
@@ -883,7 +884,18 @@ main.registerCommand({
" at version " + version + "\n");
return;
}
var description = versionInfo.version +
var versionAddendum = "" ;
var latest = catalog.complete.getLatestVersion(name, version);
if (version !== latest.version &&
!catalog.complete.isLocalPackage(name)) {
versionAddendum = "*";
newVersionsAvailable = true;
} else {
versionAddendum = " ";
}
var description = version + versionAddendum +
(versionInfo.description ?
(": " + versionInfo.description) :
"");
@@ -895,7 +907,15 @@ main.registerCommand({
process.stdout.write("\n" + messages.formatMessages());
return 1;
}
process.stdout.write(formatList(items));
if (newVersionsAvailable) {
process.stdout.write(
"\n * New versions of these packages are available! " +
"Run 'meteor update' to update. \n");
}
return 0;
});

View File

@@ -0,0 +1,4 @@
Package.describe({
summary: "Test package.",
version: "1.0.0"
});

View File

@@ -0,0 +1,4 @@
Package.describe({
summary: "Test package.",
version: "1.0.1"
});

View File

@@ -128,7 +128,7 @@ selftest.define("list-with-a-new-version", ["slow", "online"], function () {
run.waitSecs(10);
run.match(fullPackageName);
run.match("1.0.0");
run.forbidAll("versions available");
run.forbidAll("New versions");
run.expectExit(0);
});
@@ -145,8 +145,9 @@ selftest.define("list-with-a-new-version", ["slow", "online"], function () {
s.cd('mapp', function () {
run = s.run("list");
run.match(fullPackageName);
run.match("1.0.0");
run.match("versions available");
run.match("1.0.0*:");
run.match("New versions");
run.match("meteor update");
run.expectExit(0);
});