Commit Graph

77 Commits

Author SHA1 Message Date
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
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
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
bebab08518 oops, still include site name in deploy 2014-11-25 09:06:21 -08:00
David Glasser
1e7a4f3b08 Fix meteor deploy 2014-11-25 09:06:20 -08:00
David Glasser
a11c8d8e09 Revert part of 8f3966fb
It looks wrong to see `Deploying to http://foo` without the
meteor.com.  (The "Now serving" message gets the full site name from the
server and is fine.)

Original commit was from #2770.
2014-11-16 17:50:52 -08:00
David Glasser
6382bd8474 Remove buildmessage usage by stats code 2014-10-29 19:10:05 -07:00
Justin SB
9144eec671 Use spinner for upload
Once we can calculate an accurate estimate, we should reintroduce it
2014-10-27 09:25:19 -07:00
ekatek
dffb80e37c print less stuff on deploy 2014-10-24 10:22:35 -07:00
David Glasser
8f3966fbf4 Format deploy console messages to include protocol 2014-10-13 17:36:40 -07:00
David Greenspan
9922283515 Disable progress bar when prompting
Can’t tell for sure if it works, but it ought to
2014-10-03 14:51:22 -07:00
David Greenspan
98eff9059e Capitalize buildmessages 2014-09-29 16:18:38 -07:00
Emily Stark
0f8ea3597e On deploy, record package stats after bundling.
My theory is that this prevents long-running bundles that don't yield
from interfering with the ServiceConnection to the package stats server.
2014-09-25 12:22:40 -07:00
Justin SB
30f4fa2cbe Progress bars and output formatting 2014-09-19 15:52:23 -07:00
Emily Stark
d785da8dcd Skip unknown usernames rather than print "<unknown>".
Not sure what the original motivation for printing <unknown> was (it
shouldn't ever come up in normal operation, only if something weird
happens like we manually unset a user's username in the database). But
it's now rather inconvenient because we don't yet clean up deleted
organizations from a site, so you would see <unknown> for every
authorized organization that has been deleted. While we should
eventually clean up deleted organizations from a site's
"authorized_orgs" field, for now this will clean up the output of this
command.
2014-08-27 08:54:18 -07:00
David Glasser
1ff35e49fb list-sites sorts its output. fix test. 2014-08-21 19:37:05 -07:00
Emily Stark
81a0a0c7e2 Update to new package stats format 2014-08-21 18:23:38 -07:00
David Glasser
b6955a3899 Move towards non-singleton catalog.complete
We're going to make uniload use a different flavor of "complete" catalog
soon.  So we need to reduce the number of singleton-ish references to
it.

Also, we need one PackageCache per catalog, so stop it from being a
singleton too.
2014-08-13 18:11:46 -07:00
Avital Oliver
aff7dfdb50 Record package usage on meteor bundle
Also eliminated arguments that weren't used anywhere,
and removed an XXX comment that was false (recordPackages
doesn't use buildmessage to report connection failures)
2014-08-13 13:57:08 -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
David Glasser
ddba5d4a3f Never copy dev bundle node_modules into bundle
symlink as a special case for runner only

future commits on this branch will add a
package.json/npm-shrinkwrap.json that can be used by "meteor bundle"
users
2014-07-01 14:09:44 -07:00
Avital Oliver
69cd9ccd8c Oops. This is the right merge conflict fix. 2014-06-16 14:06:16 -07:00
Avital Oliver
6ea5ab0ed1 Don't record package usage when running meteor test-packages 2014-06-16 14:02:47 -07:00
David Glasser
c5e5305a3b Merge branch 'devel' into packaging
Conflicts:
	tools/bundler.js
	tools/packages.js
2014-06-11 12:02:57 -07:00
David Glasser
31a5f4014f Improve comment and message
Make sure that it shows you that it added '.meteor.com'.
2014-06-10 17:10:34 -07:00
J. Bruni
ab5c2513cd Show meaningful deploy error message for long hostname
https://github.com/meteor/meteor/issues/1208#issuecomment-45158503
2014-06-10 17:05:28 -07:00
ekatek
1cf0655da4 Bundler should not take appDir and loader as arguments anymore 2014-05-30 18:32:49 -07:00
ekatek
6f3504a2d3 project refactoring, wip 1 2014-05-21 15:42:12 -07:00
Emily Stark
4997d57b5b Report package usage on bundle and deploy 2014-05-12 11:02:49 -07:00
David Glasser
fbde0a00a7 Merge branch 'publish-packages' into library-refactor
Conflicts:
	packages/domutils/package.js
	packages/handlebars/package.js
	packages/htmljs/package.js
	packages/liverange/package.js
	packages/spark/package.js
	packages/universal-events/package.js
	tools/bundler.js
	tools/help.txt
	tools/packages.js
	tools/run-app.js
	tools/run-mongo.js
	tools/skel/.meteor/packages
2014-04-24 17:01:36 -07:00
Emily Stark
e872bc72e3 Add 'meteor list-sites' command 2014-03-24 10:36:18 -07:00
ekatek
4f84ac57ba add in ctl hack and factor out project package loader 2014-03-18 16:24:45 -07:00
Emily Stark
cebffa7848 Use stderr for login prompt on deploy with expired token 2014-02-19 23:43:35 -08:00
Emily Stark
829dfdac68 Don't log out an invalid session immediately before deploy.
When we deploy:
* If we are logged in with a username, then we go straight to doing the
  actual deploy.
* If we are logged in without a username, we check if we have a username
  yet. If we have an invalid credential at this point, we do NOT want
  `pollForRegistrationComplete` to wipe our session file, because we
  already passed the point at which we handle the case of the user being
  logged out. Instead, we just want to continue with the deploy and let
  the deploy server handle the expired credential. (This case, where a
  user's credential has been expired before they set a username,
  shouldn't happen too often in real life.)
* If we deploy with an invalid credential, we get an "Expired
  credential" message.
2014-02-19 19:35:19 -08:00
Emily Stark
023276cd50 Only show username prompt on deploy if we know the user has a username.
We don't want a user to see a username/password prompt if they haven't
set a username yet.
2014-02-19 15:52:57 -08:00
Emily Stark
2ff0fa38ed Correctly check for current username when deploying 2014-02-19 15:49:46 -08:00
Geoff Schmidt
92abbf2f5c deploy server now returns 401 for invalid credentials 2014-02-19 12:34:33 -08:00
Geoff Schmidt
d1d714ec66 'whoami' gracefully handles revocation of a credential
on a passwordless account. with test
2014-02-18 17:25:19 -08:00
Geoff Schmidt
d3291f7234 one space after period 2014-02-18 15:44:09 -08:00
Geoff Schmidt
96e3273f28 make account setup link even more handy 2014-02-18 15:43:55 -08:00
Emily Stark
a4e5a07cab Fix mistaken infoResult.payload check on 'meteor claim' 2014-02-13 11:48:01 -08:00
Emily Stark
76464f647d Give login prompt when necessary on logs/mongo commands.
Add tests for authentication on logs and mongo commands.
2014-02-12 11:22:57 -08:00
Emily Stark
6f74596ab0 Add error messages for 'meteor mongo' too.
And some tests for logs error messages.
2014-02-11 15:12:52 -08:00
Emily Stark
c14cc0e6ca Add 'meteor logs' error messages for legacy-password/unauthorized apps. 2014-02-11 14:43:07 -08:00
Emily Stark
1f8fa55c69 Change capitalization of Meteor developer accounts 2014-02-11 11:20:21 -08:00
Emily Stark
c4315d38fb Print registration URL after deploy 2014-02-11 11:15:41 -08:00
Emily Stark
b771f4042e Clean up some legacy app error messages 2014-02-09 17:15:26 -08:00
Emily Stark
aabed4665c Print login failed error message once instead of twice 2014-02-06 10:14:32 -08:00