Skip to content

Commit 12d030d

Browse files
author
ekatek
committed
completely rewrite of ‘meteor show’; some changes to ‘meteor search’.
The ‘show’ command has been completely rewritten. It has different output and now does the following: - Interacts with local package versions. Checks in the local package catalog, and returns the local versions along with the server versions. When ‘meteor show’ is run with a specific version request (‘meteor show foo@<version>’), default to showing the local package version (but show a message that a server version is available). Running ‘meteor show foo@local’ will always show the local version (useful for version-less local packages). - Simplify the interface. Instead of various ‘show-*’ flags, we only have one: show-all. By default, we only show the top 5 official (non-prerelease) unmigrated versions of a package (+ local version, if applicable). This can be overridden with ‘show-all’, and we let the user know that more versions are available. For releases, ‘show-all’ will show non-recommended releases. - Display publication time for non-local package versions. This makes it easier to run ‘meteor show <name>’ and see if <name> is actively maintained. For local packages, we display the root directory (useful for large apps or running with the LOCAL_PACKAGE_DIRS variable, for example). - For non-local package versions, show if the version is ‘installed’ (downloaded into the warehouse). This involved minor changes to tropohouse.js. The idea is that this should give a pretty good clue whether the version can be added offline. - Show version dependencies. This should help the user understand, track down and debug constraint solver failures. - Do not show version architectures except in —ejson mode. - Allow an ‘—ejson’ flag to get the output in EJSON format. That should make scripting easier. (As a bonus, for release versions, the EJSON output acts as a nice template for the release configuration file.) The search command now does the following: - Interacts with local package versions. Specifically, local versions override equivalent server versions. Also, ‘search’ works on local packages (so, for example, ‘meteor search troposphere’ inside the package server app will give you the troposphere package). - Allows an ‘—ejson’ flag to get the outout in EJSON format. Minor changes to some minor testing infrastructure: - A new skeleton package, package-for-show. Its versions contain different values for various metadata, so we can test that metadata comes from the right version. - In several places, replace the pattern of copying around package.js files with using the replace function on a placeholder string. (Mostly, as applied to package versions). This is based on these hackpads: https://mdg.hackpad.com/Showing-Package-Metadata-HdGo3Lzx3hR and https://mdg.hackpad.com/Meteor-Search-Output-1xxEzrAK9YU.
1 parent 7f87518 commit 12d030d

22 files changed

+2417
-446
lines changed

meteor

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/bin/bash
22

3+
<<<<<<< HEAD
34
BUNDLE_VERSION=0.3.82
5+
=======
6+
BUNDLE_VERSION=0.3.76
7+
>>>>>>> d1d1353... completely rewrite of ‘meteor show’; some changes to ‘meteor search’.
48

59
# OS Check. Put here because here is where we download the precompiled
610
# bundles that are arch specific.

scripts/dev-bundle-tool-package.js

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var packageJson = {
3333
phantomjs: "1.9.12",
3434
"http-proxy": "1.6.0",
3535
"wordwrap": "0.0.2",
36+
"moment": "2.8.4",
3637
// XXX We ought to be able to get this from the copy in js-analyze rather
3738
// than in the dev bundle.)
3839
esprima: "1.2.2",

scripts/generate-dev-bundle.sh

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ delete browserstack-webdriver/lib/test
146146

147147
delete sqlite3/deps
148148
delete wordwrap/test
149+
delete moment/min
149150

150151
# dedupe isn't good enough to eliminate 3 copies of esprima, sigh.
151152
find . -path '*/esprima/test' | xargs rm -rf

tools/catalog-remote.js

+43-7
Original file line numberDiff line numberDiff line change
@@ -791,16 +791,25 @@ _.extend(RemoteCatalog.prototype, {
791791
return true;
792792
},
793793

794-
// Given a release track, return all recommended versions for this track, sorted
795-
// by their orderKey. Returns the empty array if the release track does not
796-
// exist or does not have any recommended versions.
794+
// Given a release track, returns all recommended versions for this track,
795+
// sorted by their orderKey. Returns the empty array if the release track does
796+
// not exist or does not have any recommended versions.
797797
getSortedRecommendedReleaseVersions: function (track, laterThanOrderKey) {
798+
var self = this;
799+
var versions =
800+
self.getSortedRecommendedReleaseRecords(track, laterThanOrderKey);
801+
return _.pluck(versions, "version");
802+
},
803+
804+
// Given a release track, returns all recommended version *records* for this
805+
// track, sorted by their orderKey. Returns the empty array if the release
806+
// track does not exist or does not have any recommended versions.
807+
getSortedRecommendedReleaseRecords: function (track, laterThanOrderKey) {
798808
var self = this;
799809
// XXX releaseVersions content objects are kinda big; if we put
800810
// 'recommended' and 'orderKey' in their own columns this could be faster
801811
var result = self._contentQuery(
802812
"SELECT content FROM releaseVersions WHERE track=?", track);
803-
804813
var recommended = _.filter(result, function (v) {
805814
if (!v.recommended)
806815
return false;
@@ -811,19 +820,46 @@ _.extend(RemoteCatalog.prototype, {
811820
return rec.orderKey;
812821
});
813822
recSort.reverse();
814-
return _.pluck(recSort, "version");
823+
return recSort;
824+
},
825+
826+
// Given a release track, returns all version records for this track.
827+
getReleaseVersionRecords: function (track) {
828+
var self = this;
829+
var result = self._contentQuery(
830+
"SELECT content FROM releaseVersions WHERE track=?", track);
831+
return result;
832+
},
833+
834+
// For a given track, returns the total number of release versions on that
835+
// track.
836+
getNumReleaseVersions: function (track) {
837+
var self = this;
838+
var result = self._columnsQuery(
839+
"SELECT count(*) FROM releaseVersions WHERE track=?", track);
840+
return result[0]["count(*)"];
815841
},
816842

843+
// Returns the default release version on the DEFAULT_TRACK, or for a
844+
// given release track.
817845
getDefaultReleaseVersion: function (track) {
818846
var self = this;
847+
var versionRecord = self.getDefaultReleaseVersionRecord(track);
848+
return _.pick(versionRecord, ["track", "version" ]);
849+
},
850+
851+
// Returns the default release version record for the DEFAULT_TRACK, or for a
852+
// given release track.
853+
getDefaultReleaseVersionRecord: function (track) {
854+
var self = this;
819855

820856
if (!track)
821857
track = exports.DEFAULT_TRACK;
822858

823-
var versions = self.getSortedRecommendedReleaseVersions(track);
859+
var versions = self.getSortedRecommendedReleaseRecords(track);
824860
if (!versions.length)
825861
return null;
826-
return {track: track, version: versions[0]};
862+
return versions[0];
827863
},
828864

829865
getBuildWithPreciseBuildArchitectures: function (versionRecord, buildArchitectures) {

0 commit comments

Comments
 (0)