Commit Graph

141 Commits

Author SHA1 Message Date
David Glasser
94683896b7 Don't ignore nonexistent settings file in run
Refactorings in 1.0.2 accidentally started ignoring errors related to
--settings.  Fixes #3757.
2015-02-17 16:36:39 -08:00
Slava Kim
712225c77a Fix the typo of watchForChanges->ipcPipe 2015-02-10 18:35:11 -08:00
Slava Kim
dbfc4c9de7 Glasser's comments 2015-02-10 18:11:44 -08:00
Slava Kim
1e604a0941 Enable the client refresh on Windows 2015-02-10 16:57:44 -08:00
Slava Kim
9a95c83b2a Don't use SIGUSR2 to communicate "refresh client program" from proxy to app
process. Use an ipc message instead.
2015-02-10 15:11:38 -08:00
Ben Newman
4ad860ca47 Move tools/shell/server.js to tools/server/shell-server.js.
Since this file ends up getting copied into the server bundle, along with
files like boot.js, it makes sense to keep it with those files.

Renamed tools/shell/client.js to tools/shell-client.js for symmetry.
2015-02-09 11:42:49 -05:00
Ben Newman
19080bd53d Split server/shell.js into shell/server.js and shell/client.js.
Note that shell/server.js is copied into the bundle as shell-server.js,
like before, however now it contains none of the extraneous code that
belongs in shell/client.js.

The original reason server and client code were combined in a single file
was to share helper functions and configuration variables (e.g.
getInfoFile and EXITING_MESSAGE). Now, shell/client.js requires
shell/server.js to access those shared exports.
2015-02-06 14:33:19 -05:00
Sashko Stubailo
3cd883bda4 Merge branch 'windows-r' into devel
Conflicts:
	meteor
	tools/tropohouse.js
2015-02-05 20:28:09 -08:00
Sashko Stubailo
0c8e7baf30 Add fail fast and rename option to "reference directly" 2015-02-05 20:12:39 -08:00
Slava Kim
4eb73b3984 Fix requires to profile.js since we replaced the wrapper with tiny-profile.js 2015-02-05 16:40:14 -08:00
Slava Kim
d9d8147a3d Correct comments according to avi's and sashko's comments 2015-02-05 15:00:35 -08:00
Ben Newman
27cf3f550b Refactor server/shell.js into classes, and add simple authentication.
Summary:
Requiring a key that is only discoverable via the file system will allow
us to safely listen for connections on a port instead of a socket file.

Test Plan:
Use `meteor shell` and verify that it still works as before, especially
when started before/after/during server startup, and when the server is
killed while multiple shell clients are connected.

Reviewers: Slava, dgreensp, stubailo, glasser

Reviewed By: glasser

Differential Revision: https://phabricator.meteor.io/D20
2015-02-04 19:39:36 -05:00
Slava Kim
24830980d2 Change includeNodeModules mode from 'NODE_PATH' to 'link-to-system-paths'
Changes:
- rename 'NODE_PATH' mode to 'link-to-system-paths'
- the mentioned mode now affects the way node_modules in isopacks are
  copied/symlinked:
  In the new mode the node_modules folders are not even created, the
  program.json for the server program would point to the system path such as
  /User/slava/.meteor/packages/iron_router/version/npm/node_modules instead of
  local 'npm/iron_router/npm/node_modules'
- make the 'symlink' option and explicit argument to builder#copyDirectory as
  the way it used to be before (a hidden state of builder instance) was hella
  confusing
2015-02-04 14:10:47 -08:00
Slava Kim
45e5f6e721 Convert paths set for NODE_PATH 2015-02-03 19:04:32 -08:00
Slava Kim
9ad75660e1 wip to NODE_PATH 2015-02-03 18:14:03 -08:00
Slava Kim
9243bfad3d Profiling in Isopack.saveToPath 2015-02-02 15:53:38 -08:00
Sashko Stubailo
9e8e993b57 Stop client side refresh in a better way 2015-01-27 16:30:23 -08:00
Sashko Stubailo
3059961704 Make meteor shell work on Windows
We just need to convert paths before passing them to shell.js
2015-01-22 12:31:44 -08:00
Sashko Stubailo
575ce0a83a Add comment explaining SIGUSR2 2015-01-21 14:04:09 -08:00
Sashko Stubailo
b0a22a8b98 Fix meteor debug by changing cmd options 2015-01-20 22:08:15 -08:00
Sashko Stubailo
5f1407aba9 Convert paths in _spawn 2015-01-20 22:04:22 -08:00
Sashko Stubailo
76d49f28d2 Send correct kill signal 2015-01-20 22:03:22 -08:00
Ben Newman
1aba3a8e7a Eliminate the need for getAppDir in tools/server/shell.js.
Summary:
Instead of expecting the child process to figure out where the
`.meteor/local` directory is, we now tell it explicitly via the
`METEOR_SHELL_DIR` environment variable.

Fixes #3437.

Test Plan:
Run `meteor shell` in a separate terminal and see that it still connects
to an app running from the same app directory.

Reviewers: glasser

Reviewed By: glasser

Differential Revision: https://phabricator.meteor.io/D11
2015-01-20 13:56:57 -05:00
David Glasser
096df9d62d Refactor parent pid check; drop --keepalive
This commit moves parent pid process from the webapp package to the boot
script. This means that daemonized apps without webapp will also exit
when the runner exits, if run from the runner. (For example, several
self-tests such as 'autoupdate' no longer leak node processes.) This is
controlled via the $METEOR_PARENT_PID environment variable instead of
from command line arguments, in order to make fewer assumptions about
how Meteor apps process arguments.

This also drops the old --keepalive support (which already has stopped
being used by the dev mode runner or any MDG deployment platforms).
Neither --parent-pid nor --keepalive were documented beforehand, and
--keepalive was already deprecated before 1.0.

These flags used to also incidentally trigger printing the LISTENING
line; this is now controlled by $METEOR_PRINT_ON_LISTEN.

Fixes #3315.
2015-01-05 15:48:32 -08:00
David Glasser
6cac0513d5 Only try to refresh client if app uses autoupdate
Because that's where the SIGUSR2 handler is.

Arguably this should be some more abstract interface where packages can
say "I have a handler for client refresh", but whatever.

Fixes #3365.
2014-12-26 16:22:19 -08:00
Rahul
5a70151a57 Correct spelling 2014-12-20 19:23:57 -06:00
David Glasser
6a55c35837 Implement soft refresh.
Fixes #3213.

Also ameliorates the memory leak of parsedSourceMaps in
files.runJavaScript (because now we don't reload unchanged plugins).
2014-12-17 00:13:07 -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
118e330cba fix deadlock in mongod startup failure
AppRunner.stop needs to be able to cause any Future which the AppRunner
is waiting on to return, so that it can get back to the top level of its
loop and return. (This is because for some reason it is important that
AppRunner.stop does not return until the app is guaranteed to be
stopped.)  This had not been the place for the injected "wait for mongo
to start up before running the AppProcess" future.

This also means we can't use f.future() any more, because that code
assumes that it is the only code allowed to resolve its future (it
unconditionally resolves the future when the wrapped function returns,
which is an error if it is already resolved).

This is tested by 'run errors' which was failing.  Also, the test should
only expect 2 unexpected exit code messages, not 3, since we don't print
the message the first time which didn't have a kill before it.
2014-12-09 19:38:09 -08:00
David Glasser
31a43fc019 prune dead code 2014-12-09 18:30:22 -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
Ben Newman
ba89b7db60 Automatically attach to and continue debugger when server restarts. 2014-12-09 13:38:28 -05:00
David Glasser
4920ad1724 Use current previousSolution on runner rebuild 2014-12-08 22:02:50 -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
Ben Newman
ff7863d3e2 Start Mongo in parallel with the build.
For freshly created apps, this commit reduces the time required to start
the development server from 4.6s to 2.5s on my machine.

Not calling findMongoAndKillItDead unless Mongo fails to start shaves off
a few hundred milliseconds, too.

Fixes #3010.
2014-12-02 18:21:36 -05:00
David Glasser
a937aa606d Soft refresh, versioned packages only
First half of #3213.
2014-12-01 19:48:06 -08:00
David Glasser
ab3d6c5bfb Clean up some #3006 comments 2014-12-01 18:29:20 -08:00
David Glasser
7d4757b3ac Show package changes and prerelease warnings
This reimplements functionality that had been removed as part of the
`isopack-cache` branch refactoring.

Information about package changes is encapsulated inside a
PackageMapDelta object on the ProjectContext.  It is the responsibility
of the command that prepares the ProjectContext to choose to call
projectContext.packageMapDelta.displayOnConsole at the appropriate time
if it wishes to display changes.

Part of #3006.
2014-12-01 01:26:35 -08:00
David Glasser
e42e104bc2 check platforms before plugins
a platform change often creates a plugin change, so we should mention
the more major change first.  also helps with "meteor exits when cordova
platforms change" self-test
2014-11-25 09:06:29 -08:00
David Glasser
a0c05857d9 Fix client refresh bundle failure crash
hot-code-push file passes
2014-11-25 09:06:28 -08:00
David Glasser
45cc54fb63 comment and require cleanup 2014-11-25 09:06:20 -08:00
David Glasser
e05692a8d2 Fix meteor shell 2014-11-25 09:06:19 -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
a7c0cfdc77 Comment about future work 2014-11-25 09:06:18 -08:00
David Glasser
266b75c33b Fix client refresh 2014-11-25 09:06:18 -08:00
David Glasser
f0ff76a24b watch local package search dirs 2014-11-25 09:06:18 -08:00
David Glasser
5808c56af8 rebuilds in run work
(but not for client-only refresh)

(and haven't implemented "soft reload" yet)
2014-11-25 09:06:18 -08:00
David Glasser
4563258ec0 'meteor run' works once
restart crashes intentionally

(client-only changes to app code work; client-only changes to packages
don't get reloaded.)
2014-11-25 09:06:17 -08:00