diff --git a/tools/catalog-local.js b/tools/catalog-local.js index eddcaee50c..b64f9c64ef 100644 --- a/tools/catalog-local.js +++ b/tools/catalog-local.js @@ -26,7 +26,6 @@ var LocalCatalog = function (options) { self.packages = {}; self.initialized = false; - self.containingCatalog = options.containingCatalog || self; // Local directories to search for package source trees self.localPackageSearchDirs = null; diff --git a/tools/catalog.js b/tools/catalog.js index 33de312966..271548999d 100644 --- a/tools/catalog.js +++ b/tools/catalog.js @@ -105,14 +105,14 @@ var ACCEPT_NON_EMPTY = function (result) { }; // The LayeredCatalog provides a way to query multiple catalogs in a uniform way -// A LayeredCatalog typically contains: +// A LayeredCatalog contains: // - a local catalog referencing the packages of the project // - a reference to the official catalog -var LayeredCatalog = function() { +var LayeredCatalog = function (localCatalog, otherCatalog) { var self = this; - self.localCatalog = null; - self.otherCatalog = null; + self.localCatalog = localCatalog; + self.otherCatalog = otherCatalog; }; _.extend(LayeredCatalog.prototype, { @@ -121,12 +121,6 @@ _.extend(LayeredCatalog.prototype, { return "LayeredCatalog []"; }, - setCatalogs: function(local, remote) { - var self = this; - self.localCatalog = local; - self.otherCatalog = remote; - }, - getLatestVersion: function (name) { var self = this; return self._returnFirst("getLatestVersion", arguments, ACCEPT_NON_EMPTY); @@ -147,14 +141,6 @@ _.extend(LayeredCatalog.prototype, { return self.otherCatalog[f].apply(self.otherCatalog, splittedArgs); }, - getLocalPackageNames: function () { - return this.localCatalog.getAllPackageNames(); - }, - - getPackageSource: function (packageName) { - return this.localCatalog.getPackageSource(packageName); - }, - getPackage: function (name) { return this._returnFirst("getPackage", arguments, ACCEPT_NON_EMPTY); }, @@ -180,14 +166,6 @@ _.extend(LayeredCatalog.prototype, { return result; }, - initialize: function (options) { - this.localCatalog.initialize(options); - }, - - reset: function () { - this.localCatalog.reset(); - }, - // As getVersion, but returns info on the latest version of the // package, or null if the package doesn't exist or has no versions. // It does not include prereleases (with dashes in the version); diff --git a/tools/package-map.js b/tools/package-map.js index b9997c1fe8..8ad11a766b 100644 --- a/tools/package-map.js +++ b/tools/package-map.js @@ -11,13 +11,13 @@ var utils = require('./utils.js'); // .meteor/packages file on disk.) // // It has a corresponding JSON format (used, eg, inside buildinfo files). -exports.PackageMap = function (versions, cat) { +exports.PackageMap = function (versions, localCatalog) { var self = this; self._map = {}; - self.catalog = cat; + self._localCatalog = localCatalog; _.each(versions, function (version, packageName) { - var packageSource = cat.getPackageSource(packageName); + var packageSource = localCatalog.getPackageSource(packageName); if (packageSource) { self._map[packageName] = { kind: 'local', version: version, packageSource: packageSource }; @@ -50,7 +50,7 @@ _.extend(exports.PackageMap.prototype, { throw Error("not a subset: " + packageName); subsetVersions[packageName] = info.version; }); - return new exports.PackageMap(subsetVersions, self.catalog); + return new exports.PackageMap(subsetVersions, self._localCatalog); }, toJSON: function () { diff --git a/tools/project-context.js b/tools/project-context.js index b6cf0b46dd..8ae400585a 100644 --- a/tools/project-context.js +++ b/tools/project-context.js @@ -401,7 +401,7 @@ _.extend(exports.ProjectContext.prototype, { return; // error is already in buildmessage self.packageMap = new packageMapModule.PackageMap( - solution.answer, self.projectCatalog); + solution.answer, self.localCatalog); self.packageMapDelta = new packageMapModule.PackageMapDelta({ cachedVersions: cachedVersions, @@ -444,15 +444,13 @@ _.extend(exports.ProjectContext.prototype, { var self = this; buildmessage.assertInCapture(); - self.projectCatalog = new catalog.LayeredCatalog; - self.localCatalog = new catalogLocal.LocalCatalog({ - containingCatalog: self.projectCatalog - }); - self.projectCatalog.setCatalogs(self.localCatalog, catalog.official); + self.localCatalog = new catalogLocal.LocalCatalog; + self.projectCatalog = new catalog.LayeredCatalog( + self.localCatalog, catalog.official); var searchDirs = self._localPackageSearchDirs(); buildmessage.enterJob({ title: "scanning local packages" }, function () { - self.projectCatalog.initialize({ + self.localCatalog.initialize({ localPackageSearchDirs: searchDirs, explicitlyAddedLocalPackageDirs: self._explicitlyAddedLocalPackageDirs });