mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
minor bug cleanup to make tests pass
This commit is contained in:
@@ -708,7 +708,7 @@ main.registerCommand({
|
||||
}
|
||||
|
||||
// If the version was specified, check that the version exists.
|
||||
if ( constraint.constraint !== "none") {
|
||||
if ( constraint.constraint !== null) {
|
||||
var versionInfo = catalog.getVersion(
|
||||
constraint.package,
|
||||
constraint.constraint);
|
||||
@@ -814,11 +814,11 @@ main.registerCommand({
|
||||
// If the previous versions file had this, then we are upgrading, if it did
|
||||
// not, then we must be adding this package anew.
|
||||
if (_.has(versions, packageName)) {
|
||||
messageLog.push("upgraded " + packageName + " from version " +
|
||||
messageLog.push(" upgraded " + packageName + " from version " +
|
||||
versions[packageName] +
|
||||
" to version " + newVersions[packageName]);
|
||||
} else {
|
||||
messageLog.push("added " + packageName +
|
||||
messageLog.push(" added " + packageName +
|
||||
" at version " + newVersions[packageName]);
|
||||
};
|
||||
});
|
||||
@@ -889,9 +889,14 @@ main.registerCommand({
|
||||
// constraint solver, because our contract with the user says that we will
|
||||
// never downgrade a dependency.
|
||||
var versions = project.getIndirectDependencies(options.appDir);
|
||||
// Combine into one object mapping package name to list of
|
||||
// constraints, to pass in to the constraint solver.
|
||||
var allPackages = project.combinedConstraints(
|
||||
packages,
|
||||
release.current.isProperRelease() ? release.current.getPackages() : {});
|
||||
|
||||
// Call the constraint solver.
|
||||
var newVersions = catalog.resolveConstraints(packages,
|
||||
var newVersions = catalog.resolveConstraints(allPackages,
|
||||
{ previousSolution: versions });
|
||||
if ( ! newVersions) {
|
||||
// This should never really happen.
|
||||
@@ -967,21 +972,25 @@ main.registerCommand({
|
||||
// Generate a package loader for this project. This will also compute the
|
||||
// nessessary versions and write them to disk.
|
||||
project.generatePackageLoader(options.appDir);
|
||||
var packages = project.getDirectDependencies(options.appDir);
|
||||
var packages = project.getDirectDependencies(options.appDir).appDeps;
|
||||
var versions = project.getIndirectDependencies(options.appDir);
|
||||
|
||||
var messages = buildmessage.capture(function () {
|
||||
_.each(packages.appDeps, function (version, name) {
|
||||
_.each(packages, function (version, name) {
|
||||
//XXX: Now that we don't store the version in the .meteor/packages file,
|
||||
//we should read the versions file for the version to use in this
|
||||
//description.
|
||||
if (version) {
|
||||
var versionInfo = catalog.getVersion(name, version);
|
||||
if (!versionInfo) {
|
||||
buildmessage.error("Cannot process package list. Unknown: " + name +
|
||||
if (!version) {
|
||||
version = versions[name];
|
||||
}
|
||||
var versionInfo = catalog.getVersion(name, version);
|
||||
if (!versionInfo) {
|
||||
buildmessage.error("Cannot process package list. Unknown: " + name +
|
||||
" at version " + version + "\n");
|
||||
return;
|
||||
}
|
||||
items.push({ name: name, description: versionInfo.description });
|
||||
}
|
||||
return;
|
||||
}
|
||||
items.push({ name: name, description: versionInfo.description });
|
||||
|
||||
});
|
||||
});
|
||||
if (messages.hasMessages()) {
|
||||
|
||||
@@ -162,7 +162,7 @@ var determineBuildTimeDependencies = function (packageSource) {
|
||||
});
|
||||
|
||||
|
||||
var versions = packageSource.dependencyVersions.dependencies;
|
||||
var versions = packageSource.dependencyVersions.dependencies || {};
|
||||
ret.packageDependencies = catalog.catalog.resolveConstraints(constraints,
|
||||
{ previousSolution: versions });
|
||||
|
||||
@@ -191,7 +191,7 @@ var determineBuildTimeDependencies = function (packageSource) {
|
||||
constraints[parsedSpec.package] = parsedSpec.constraint || null;
|
||||
});
|
||||
|
||||
var pluginVersion = pluginVersions[info.name];
|
||||
var pluginVersion = pluginVersions[info.name] || {};
|
||||
ret.pluginDependencies[info.name] =
|
||||
catalog.catalog.resolveConstraints(
|
||||
constraints, { previousSolution: pluginVersion });
|
||||
|
||||
@@ -155,7 +155,8 @@ var rewriteDependencies = function (appDir, deps, versions) {
|
||||
// XXX: Do not remove comments from packages file.
|
||||
var lines = [];
|
||||
_.each(deps, function (versionConstraint, name) {
|
||||
if (versionConstraint && versionConstraint[0] === "=") { /* exact version required */
|
||||
if (versionConstraint) {
|
||||
console.log(versionConstraint);
|
||||
lines.push(name + "@" + versionConstraint + "\n");
|
||||
} else {
|
||||
lines.push(name + "\n");
|
||||
|
||||
@@ -24,14 +24,11 @@ var copyFile = function(from, to, sand) {
|
||||
// packages: an array of packages in order. Packages can be of the form:
|
||||
//
|
||||
// standard-app-packages (ie: name), in which case this will match any
|
||||
// version of that package as long as it is included. This is for packages
|
||||
// external to the app, since we don't want this test to fail when we push a
|
||||
// new version.
|
||||
// version of that package as long as it is included.
|
||||
//
|
||||
// awesome-pack@1.0.0+local (ie: name@version) to match that name at that
|
||||
// version explicitly. This is for packages that only exist for the purpose
|
||||
// of this test (for example, packages local to this app), so we know exactly
|
||||
// what version we expect.
|
||||
// version explicitly. This is for packages that we included at a specific
|
||||
// version.
|
||||
var checkPackages = function(sand, packages) {
|
||||
var lines = sand.read(".meteor/packages").split("\n");
|
||||
var i = 0;
|
||||
@@ -170,16 +167,16 @@ selftest.define("add packages", function () {
|
||||
|
||||
run = s.run("--once");
|
||||
|
||||
run = s.run("add", "say-something", "--offline-catalog");
|
||||
run = s.run("add", "say-something@1.0.0", "--offline-catalog");
|
||||
run.match("Successfully added");
|
||||
checkPackages(s,
|
||||
["accounts-base", "say-something@1.0.0+local", "standard-app-packages"]);
|
||||
["accounts-base", "say-something@1.0.0", "standard-app-packages"]);
|
||||
|
||||
run = s.run("add", "depends-on-plugin", "--offline-catalog");
|
||||
run.match("Successfully added");
|
||||
checkPackages(s,
|
||||
["accounts-base", "depends-on-plugin@1.0.0+local",
|
||||
"say-something@1.0.0+local", "standard-app-packages"]);
|
||||
["accounts-base", "depends-on-plugin",
|
||||
"say-something@1.0.0", "standard-app-packages"]);
|
||||
|
||||
checkVersions(s,
|
||||
["accounts-base", "depends-on-plugin",
|
||||
@@ -201,7 +198,6 @@ selftest.define("add packages", function () {
|
||||
checkVersions(s,
|
||||
["accounts-base",
|
||||
"standard-app-packages"]);
|
||||
|
||||
run = s.run("list", "--using", "--offline-catalog");
|
||||
run.match("accounts-base");
|
||||
run.match("standard-app-packages");
|
||||
|
||||
Reference in New Issue
Block a user