Commit Graph

191 Commits

Author SHA1 Message Date
Sashko Stubailo
efca9d5ce5 Remove extra line 2015-01-20 22:06:57 -08:00
Sashko Stubailo
9255e14d3f Replace exec with spawn on Windows, need to test this 2015-01-20 22:04:24 -08:00
ekatek
12d030dd53 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.
2015-01-13 13:53:20 -08:00
David Glasser
f61ada859d Refresh catalog if release's tool has no build
This fixes a corner case where if you synced the catalog between the
creation of a release and the creation of its tool's build for your
platform, running `meteor --release R` would fail.

Fixes #3317.
2015-01-08 12:28:25 -08:00
David Glasser
ddd2fe8e91 Make 'pretty: true' to the default for commands
It was already set for most common commands, and was unnecessarily not
set for others.

The following commands are remaining "pretty: false":

- Commands that just print machine-parseable text: --version, --arch,
  admin members (without --add or --remove), mongo --url,
  authorized (without --add or --remove), whoami, list-organizations, list-sites
- Commands that just switch over to another codebase's interactive
  command: mongo without --url, admin get-machine, shell

The following commands used to be implicitly "pretty: false" and now
will be pretty:

- A bunch of troposphere admin commands: set-banners, recommend-release,
  change-homepage, set-unmigrated, set-latest-readme
- A few accounts/deploy related commands: logs, claim, login, logout
- remove-platform, reset, self-test
- admin maintainers (which unlike admin members and authorized prints an
  English header before the user list; maybe this is a mistake)

It might make sense in the future to further separate "pretty means can
show progress bars if the output is a TTY" from "pretty means can use
chalk styling and unicode bullets".

Fixes #3162.
2015-01-05 13:56:47 -08:00
David Glasser
a6dc912afb Remove redundant variable 2015-01-02 20:54:54 -08:00
Sashko Stubailo
e7167e5257 Factor out almost all fs. and path. calls in the tool
This will be useful when we want to be smart with windows file paths later
Also, all of the file calls are asynchronous with fibers now, which comes with
many benefits.

This is a combination of 23 commits. Original messages:
Wrap a large number of fs calls inside files.*

Convert a few more fs calls to files.*

More moving fs.* to files

Implement read/write streams and open/read/close

Get rid of fs from auth.js

Remove fs and unused imports from catalog-local and catalog-remote

Remove unused imports from catalog.js

Replace a whole lot of fs calls

Fix error

Migrate a lot more fs. calls to files.

Add a temporary symlink method

Convert old test to files.*

Use files.pathX instead of path.x everywhere

Replace path.x to files.pathX in tests

Small fixes to files.js and one rename

Make cleanup run in a fiber

Make wrapping functions take function name in case we need it

Add some timeouts and stuff to HCP tests

wrapFsFunc also makes a sync version of the function

Sometimes you just don't want to yield!

Make sure JsImage readFromDisk doesn't yield

Remove unused imports from npm test

Change order of test now that some things don't yield

Fix missing files import, and add a debug error printout
2014-12-15 15:32:06 -08:00
David Glasser
bc53d5f1e4 Use case in buildmessage titles consistently
Job names should not be capitalized (so they look OK in "While xxx"
messages), and are capitalized by the progress bar.

Fixes #3003.
2014-12-11 14:40:16 -08:00
David Glasser
1e5b7437a5 Refresh catalog only on relevant errors
Fixes #2846.  Fixes #2847. Fixes #2979.

Errors in the build process that could be fixed by refreshing the
catalog now cause the catalog to refresh, assuming we have not already
refreshed it recently and that we are not offline.

These commands now don't need to refresh at startup: remove, run, debug,
create, build, bundle, deploy, test-packages, rebuild, and self-test

It should be OK for create to throw SpringboardToLatestRelease even
without refreshing, since release.latestKnown is still something we know
about.
2014-12-10 19:03:05 -08:00
David Glasser
d7d51f9dac All downloads use downloadPackagesMissingFromMap
We now can make PackageMaps without a localCatalog, for cases like this
where we really want everything in the map to be downloaded.
2014-12-10 14:42:18 -08:00
ekatek
a79e69130f Merge pull request #3232 from meteor/word-wrap-final
Automatically line-wrap output
2014-12-09 12:23:30 -08:00
ekatek
f3e3dc7bca rename doNotWrap to noWrap in console.js' 2014-12-08 14:44:36 -08:00
ekatek
6bf699d5d9 Fixed some mistypes 2014-12-06 19:13:51 -08:00
ekatek
c9928d9c3a responding to minor fixes on 3232
- Wrapping URLs in Console.url. Making Console.url not word-wrap URLs,
on the off-chance that a URL could be wrapped.

- Creating a doNotWrap function on the Console. Call this on things that
are not commands or URLs, but still should not be wrapped.

- fixing minor mistypes, removing a comment about the dev bundle on the
Windows branch.
2014-12-06 18:32:40 -08:00
ekatek
25dfd39ef1 Everywhere that we call a raw function, add a new line 2014-12-06 17:38:41 -08:00
Sashko Stubailo
3e6f09f08b Fix if statement typo in error handling 2014-12-05 15:31:39 -08:00
ekatek
24a4ed9bdc Automatically line-wrap output
Includes the following changes to Console.js:

- Console.info, Console.warn, Console.debug and Console.error now automatically
  line-wrap the output to 80 characters, or the width of the terminal screen (if
  known). This is in line with our current style guide on how things should be wrapped!

- Sometimes, there are parts of text that we don't want to line-wrap. For example, if we are
  telling the user to run 'meteor long-command --with --options' we don't want to
  have a newline in the middle of that! Wrap those commands in Console.command, like
  this:
     Console.info("something and then run", Console.command(command), "and then");
  This also makes them bold if chalk is on, as a nice bonus. So, if we ever turn
  chalk back on, the bolding of commands will be more consistent.

- Sometimes, there is bulkier output that we don't want to format at all, including
  line-wrapping: log snippets, stack traces, JSON output, etc. In that case, we can use
  Console.rawInfo, Console.rawError, Console.rawWarn and Console.rawDebug. Don't use
  Console.command inside the raw* functions! It won't be processed (at all).

- There are fancier things that we can do, other than just simply wrapping things.
  We can indent:
  "  Start here and then when wrapping
     continue over here".

  We frequently do this for commands, for example. In the past, we did this manually --
  but we can't do this for long messages that might get wrapped, and anyway, it is
  good to codify this instead of counting spaces. Allows us to be better about consistency,
  for example.

- We can also add a bulletPoint, which is a small notice in the beginning that looks like
  this:
  " => Start here and then when wrapping
       continue below the bulletPoint".

  Since it is a elss intuitive option, I have wrapped most of the time that we use a
  bulletPoint into helper functions on the Console.js.

- Some common bulletpoints that we use are:
    ASCII Checkboxes (Console.success)
    ASCII X-s (Console.failWarn and Console.failInfo)
    =>  (Console.arrowError, Console.arrowWarn, Console.arrowInfo)
    WARNING (Console.labelWarn)

  The => are sometimes indented, so they take an optional indent argument, showing how
  many spaces to indent by.

The wrapper interface would be less complicated, if there was a more unified conceit behind our
terminal messages. If there is one, it is not documented. My hope is that, in many cases,
moving these to Console will make it easier for someone with great product sense to
clean up our terminal messages. It will also make it easier to write such messages, since
it will be easier to follow an accepted standard.

In the codebase outside of Console:

- Went through and looked at our use of Console.error/info/etc, replacing with rawError/etc
  whenever approporiate.

- Went through and modified most of 'stdout' and 'stderr' calls to use the new functions.
  I made an exception for stuff that doesn't want a new line at the end, or otherwise does
  weird things (ex: print user logs directly), on the basis that, at this juncture, it is
  better to be safe than to be sorry.

- Long messages no longer need to break the code style guide by ignoring indentation rules.
  Fixed that where approporiate.

- Fixed the tests! A number of our stock messages are actually longer than 80 chars.

- Personal favourite: The Android license agreement is now line wrapped! Much better experience.

- There is some more work to do on:
  - longform help (currently comes with built-in linebreaks, would have to change the entire
    mechanism for how that works)
  - Buildmessage sometimes has headers that start with =>, but they are short. I didn't want to
    pass wrapper options all the way to main.captureOrExit before merging the rest of this and
    making sure that we like it. Since these messages are fairly short, I don't think that's
    likely to be a serious problem.

I hope that this makes life easier for us in the future! No more counting chars, no more breaking
the style guide. Better experience for users with wider terminals (or even shorter terminals!).
Let's give this a try.
2014-12-04 17:56:04 -08:00
David Glasser
8deba5c9bb Last references to PackageLoader and catalog.complete are gone 2014-11-25 09:06:31 -08:00
David Glasser
a6add4ef34 more cleanup 2014-11-25 09:06:27 -08:00
David Glasser
380ab7c327 port meteor publish-for-arch 2014-11-25 09:06:26 -08:00
David Glasser
637a3ec37b Fix remove-platform 2014-11-25 09:06:19 -08:00
David Glasser
9f8b533fcc Write versions when app release matches current
This should take care of the special-casing that used to be in create
and update. (Will still need to confirm that it works properly for
update.)
2014-11-25 09:06:17 -08:00
David Glasser
7998389287 Read .meteor/release in ProjectContext 2014-11-25 09:06:16 -08:00
David Glasser
8f6a7b757b All commands are now newfangled.
Some just don't work yet :)
2014-11-25 09:06:16 -08:00
David Glasser
438ddad7bc Remove catalog.complete from core code
It's still in unmigrated commands.

Remove tropohouse's catalog.  It was there to stop you from downloading
local packages but downloadPackagesMissingFromMap does that based on the
PackageMap now.
2014-11-25 09:06:16 -08:00
David Glasser
8e484170ae Delete PackageLoader, references to it in new code
References are still sitting around in code that hasn't been
transitioned yet.
2014-11-25 09:06:14 -08:00
David Glasser
e737ef4cfe download correct arch of packages in bundle 2014-11-25 09:06:13 -08:00
David Glasser
1ea3a5c4a3 Revert "Prepare ProjectContext automatically in main"
This reverts commit 11f820a7dd38b6ce36fe06bcbf5131541d1e2756.

Better to have a little more control by doing this manually.
2014-11-25 09:06:12 -08:00
David Glasser
14db1041ce Prepare ProjectContext automatically in main 2014-11-25 09:06:12 -08:00
David Glasser
8d7139e624 Start on a new lightweight ProjectContext
This one won't be a singleton.  Eventually project.js will be moved into
here.

Add a 'meteor prep' command which exercises new codepaths. It will be
deleted eventually.

So far, it converts .meteor/packages directly into the format that the
constraint solver wants.  (Unlike the existing code which has several
intermediate formats.)
2014-11-25 09:06:09 -08:00
David Glasser
4aa33782fa New Console.withProgressDisplayVisible function
This replaces the pattern of turning two flags on and off by hand.

Also, avoid calling _updateProgressDisplay unless you're actually
changing values.
2014-11-11 17:28:30 -08:00
David Glasser
170c0acad7 Rename unibuild everywhere to isopackets 2014-11-07 16:45:58 -08:00
David Glasser
97f6a0236e get rid of catalog.uniload
There is no longer a uniload catalog when running from a release, since
the release contains whole isopackets (programs) not
isopacks (packages).

We only need a uniload-specific catalog when we're actually rebuilding
isopackets (not in order to load them), so we now have it as a local
variable in the two places that build isopackets.

The deleted code in package-loader.js was specific to the prebuilt
uniload package which no longer exists.
2014-11-07 16:45:58 -08:00
David Glasser
4000dfb993 from-checkout builds isopackets on startup
Nothing actually LOADS from isopackets yet.
2014-11-07 16:45:58 -08:00
David Glasser
5e1086775d Remove more unnecessary buildmessage.captures
Part of #3003.
2014-11-04 17:34:54 -08:00
David Glasser
b5d2cce308 Refactor LocalCatalog
- Simplify internal data structure to just have one map of name ->
  various data instead of a whole bunch of different unsynchronized data
  structures (most of which were used with frequent O(n) operations).

- Move the getLoadPathForPackage logic which combines local and remote
  packages into LayeredCatalog from LocalCatalog, and delete the
  unnecessary copy in BootstrapCatalogCheckout.

- Rename a bunch of fields to make it explicit which ones contain
  package objects, which ones contain package directories, and which
  ones contain package *search* directories

- Replace random version IDs and a long comment about why random is safe
  with sequential. (I don't think these version IDs are ever used
  anyway.)

- Drop unused "initializing" option to refresh

- Drop redundant call to _recomputeEffectiveLocalPackages in
  addLocalPackage (it is called immediately below by refresh).
2014-10-30 22:43:13 -07:00
David Glasser
c2a4134d97 Update Node to 0.10.33 from 0.10.29
Our npm patch is not yet in a Node 0.10 release (it's in npm 2.1.0).
2014-10-30 15:12:28 -07:00
David Glasser
e4a10e5f11 Package download no longer can emit buildmessages 2014-10-29 18:51:02 -07:00
David Glasser
f9ef2cf69f fix meteor create --example with packages 2014-10-27 23:36:17 -07:00
David Glasser
eb65687f75 "Normalize" most calls to getMeteorReleaseVersion
ie, make it prepend METEOR@ if necessary.

(We DON'T do that in the pre-springboard call in main because that one
might be telling us to springboard to a pre-0.9.0 release!)

Solves a bunch of issues like the previous commit where, if
.meteor/release just says "0.9.4", you get weird behavior.
2014-10-23 19:48:04 -07:00
David Glasser
8793d26d43 fix checkout message if app release lacks METEOR@
Reflow a word-wrapped message to look better

All non-slow 'releases' tests pass now
2014-10-23 10:51:20 -07:00
Emily Stark
620edd3f0c Line-wrap springboarding failure messages 2014-10-22 10:48:18 -07:00
ekatek
f2378ce616 some processing on how we display release name 2014-10-21 17:49:48 -07:00
David Glasser
5a2892a26c Better error on springboard failures 2014-10-21 17:18:50 -07:00
David Glasser
2db8e7bc61 Fix release.forced/explicit comment, simplify code
This comment has been wrong since "explicit" was introduced.

The code change is intended to be a no-op that is a clarity improvement.
2014-10-21 17:18:50 -07:00
Emily Stark
88143939a6 Use displayRelease helper for running-from-checkout message 2014-10-21 14:31:18 -07:00
Emily Stark
1eaba883ae Use Console in tools/main.js
The specific issue is the "Could not springboard to release..." message
showing up on the same line as a progress bar. Seems like a good idea to
use Console everywhere in this file anyway.
2014-10-21 10:56:03 -07:00
Ben Newman
453070bfde Assert that constructor functions in main.js are invoked with new. 2014-10-20 15:48:32 -04:00
David Glasser
d274ad9cd4 Make sure that early refreshes are visible 2014-10-17 14:55:16 -07:00
David Glasser
82bdaf86b9 no catalog.complete for non-refresh commands 2014-10-17 13:47:23 -07:00