Commit Graph

45 Commits

Author SHA1 Message Date
ekatek
25dfd39ef1 Everywhere that we call a raw function, add a new line 2014-12-06 17:38:41 -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
f5901a74da steps towards making report-stats test pass
It doesn't, though, for reasons that mostly seem to be "talking to the
stats server (and auth) is really slow"
2014-11-25 09:06:30 -08:00
David Glasser
45cc54fb63 comment and require cleanup 2014-11-25 09:06:20 -08:00
David Glasser
c344278b96 Fix up stats.
Satisfyingly delete a long comment explaining how somehow it is annoying
to work with a codebase that's full of singletons.
2014-11-25 09:06:18 -08:00
David Glasser
4079c2276f ServiceConnection directly loads ddp
Caching works fine here.
2014-11-07 16:45:58 -08:00
David Glasser
170c0acad7 Rename unibuild everywhere to isopackets 2014-11-07 16:45:58 -08:00
David Glasser
9cab094f18 uniload now works via named "isopackets"
You can only request a named set of packages, not a random assortment.

In future commits, we will pre-build these packages into JsImages and
load them from that. Building packages for uniload will eventually not
involve the .build.foo directories at all.  (All saved packages will be
built in app context, eventually.)
2014-11-07 16:45:57 -08:00
David Glasser
6382bd8474 Remove buildmessage usage by stats code 2014-10-29 19:10:05 -07:00
Emily Stark
14e6b8e298 Use Console.stderr for package stats errors 2014-10-21 14:14:16 -07:00
Emily Stark
e3c5743cec Simplify packageList in stats.js 2014-09-25 14:57:39 -07:00
ekatek
f7574429bd Stats should not run the constraint solver. 2014-09-11 16:41:59 -07:00
David Glasser
d6957bad00 All uniload.load for ddp should be the same
Otherwise the uniload cache doesn't work. This shaves a 365 ms off of
stats report for me (in a built release, which doesn't even use the
compiler!)
2014-09-08 18:45:30 -07:00
Sashko Stubailo
3189a364e9 Rename livedata to ddp, meteor test-packages passes 2014-08-28 12:53:34 -07:00
Emily Stark
28e2719ae5 Add new argument to another loginWithTokenOrOAuth call 2014-08-26 17:53:23 -07:00
Emily Stark
3c6c51acd1 Add extra check in stats retrieval in test 2014-08-21 18:31:46 -07:00
Emily Stark
1852e7b2c0 Update test for new package stats format 2014-08-21 18:23:38 -07:00
Emily Stark
81a0a0c7e2 Update to new package stats format 2014-08-21 18:23:38 -07:00
David Glasser
4ac638d60b oops, didn't mean to add blank line 2014-08-18 00:32:15 -07:00
David Glasser
558fb92651 state that package stat error is only in checkout 2014-08-18 00:31:12 -07:00
David Glasser
8a262adc97 Close stats server connections after using them
Notably, we were leaking a (DDP/https/TCP) connection for every restart
in 'meteor run'.
2014-08-16 16:07:28 -07:00
David Glasser
7d05640ea0 Make buildmessage fiber-aware
Port a simplified version of Meteor.EnvironmentVariable and
Meteor.bindEnvironment to fiber-helpers.js to deal with this.

Identify uses of fiberHelpers.inFiber and switch them to either
fiberHelpers.bindEnvironment (if the callback they are wrapping is
semantically "part of" the context that creates the callback) or
fiberHelpers.inBareFiber (otherwise).

Without this, concurrency was causing the wrong buildmessage message
sets and jobs to be active when builds yielded.
2014-08-04 19:03:05 -07:00
David Glasser
06a7dc90b5 Add many buildmessage.capture/assertInCapture
Moving towards a world where all things that might invoke buildmessage.error are
encouraged to be in a buildmessage.capture.

This commit is the answer to the question "how many small changes need to be
made to add buildmessage.assertInCapture to PackageCache.loadPackageAtPath?"

Next steps include:
 - Making catalog.resolveConstraints ALWAYS buildmessage.assertInCapture
   (not just when ignoreProjectDeps isn't passed)
 - Then changing resolveConstraints to complain using buildmessage
 - Removing the process.exit(1) in _ensureDepsUpToDate
 - Adding a more structured way to ensure that most commands
   call _ensureDepsUpToDate at an unsurprising location
2014-07-30 22:16:21 -07:00
Emily Stark
5918a51fef Don't send package stats on bundle.
Send them only on 'run' (which is likely to be running for a long time,
giving us plenty of time to send stats) and 'deploy' (which has to go
over the network anyway), though we don't wait for stats to be sent
before exiting from any commands.

Update stats self-test to run apps instead of bundling them. Add an
environment variable to print some output about when package stats have
been sent for the test to know when it's okay to stop the 'meteor run'
process.
2014-07-21 18:00:22 -07:00
Emily Stark
29f99597c9 Don't log login errors when sending package stats.
Exceptions during login happen fairly regularly (particularly for expired/revoked login tokens)
2014-06-27 17:49:06 -07:00
Emily Stark
8571143d8d Fix name of stats error logging function 2014-06-27 17:47:26 -07:00
Emily Stark
f761e898c8 Record session id on package stats 2014-06-25 11:12:12 -07:00
Emily Stark
e4ecda9fe8 Fix direct dependency reporting.
And test for it.
2014-06-25 11:12:12 -07:00
Emily Stark
4b58ba4d99 A steaming pile of hacks to get report-stats test passing. 2014-06-25 11:12:12 -07:00
Emily Stark
6f92768559 Add hostname/meteor release/os to package stats 2014-06-25 11:12:12 -07:00
Avital Oliver
600ae65304 Don't print errors on stream level failures, and a little reorg
In particular, this becomes especially important with packaging
since we ping the server with a DDP connection every time you
run an app. Multiple times actually.

So now there's no ECONN error messages printed
2014-06-16 16:33:07 -07:00
Avital Oliver
a9fb0072b7 When running from a checkout, print errors from package usage recording 2014-06-16 14:01:53 -07:00
David Glasser
471cc487e6 Merge branch 'packaging' into unified-version-files
Conflicts:
	tools/stats.js
2014-06-03 15:14:56 -07:00
David Glasser
3f5ea39a48 use project.project consistently in stats.js 2014-06-03 15:13:10 -07:00
Emily Stark
fe36e7e473 Add package stats opt-out 2014-05-29 08:23:29 -07:00
ekatek
9e04e2dc35 unified versions wip two 2014-05-23 14:07:48 -07:00
ekatek
6f3504a2d3 project refactoring, wip 1 2014-05-21 15:42:12 -07:00
Emily Stark
a9c944c4d9 Catch errors reporting package stats 2014-05-14 10:25:38 -07:00
Emily Stark
624ddcb655 Remove stats login XXX 2014-05-13 14:30:22 -07:00
Avital Oliver
6696e2751e Respond to Emily's code review comments 2014-05-12 16:45:49 -07:00
Avital Oliver
a51b4697ae Test that userId is recorded when sending package stats. 2014-05-12 16:24:36 -07:00
Emily Stark
2da8567df7 Add OAuth login to package stats reporting 2014-05-12 13:49:35 -07:00
Avital Oliver
14f6570d73 WIP: Failing test for reporting stats on 'meteor bundle' 2014-05-09 11:25:42 -07:00
Emily Stark
7dd6fa1478 Change package stats object to match server change 2014-05-08 12:35:45 -07:00
Emily Stark
7ec7cb4d97 WIP: record package usage stats 2014-05-07 11:27:25 -07:00