Commit Graph

62 Commits

Author SHA1 Message Date
Slava Kim
727b48d3fa Fix path.join and similar bugs 2015-01-20 22:04:21 -08:00
Ben Newman
c2ce95fd11 Use both pathwatcher and polling to detect changes more robustly.
This strategy was suggested by @glasser after we realized just how
hopeless it is to probe the file system to test pathwatcher:
https://github.com/meteor/meteor/issues/3285#issuecomment-67296961

I've made some attempt to de-duplicate these events (since we're
effectively watching twice now), but we have other mechanisms for dealing
with bursty file change events, so these measures do not need to be
completely bulletproof.

Fixes #3284 (again).
2014-12-17 12:50:54 -05:00
Ben Newman
3b569ab33d Create temporary pathwatcher test file in app directory.
Previously we were testing pathwatcher.watch by creating a file in
.meteor/local, but developers using Vagrant VMs often mount .meteor on a
different (non-network) file system, for Mongo's sake.

Writing the file directly in the app directory increases the likelihood
that it will interact with pathwatcher in the same way as other source
files the developer will be editing.
2014-12-16 19:25:25 -05:00
Ben Newman
ddae20cb4b Fall back to fs.watchFile if pathwatcher.watch does not work.
Fixes #3284.
2014-12-15 11:17:50 -05: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
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
ekatek
8d213d0cb0 fix some newline breaks 2014-12-08 18:34:38 -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
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
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
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
David Glasser
a9a3411703 checkpoint on 'meteor run' 2014-11-25 09:06:17 -08:00
ekatek
41c793d570 another instance of printing METEOR 2014-10-23 15:03:48 -07:00
David Greenspan
480b05bc2c Display progress when restarting the server
Previously, all progress display was turned off after the app’s initial start, so no progress would be displayed on restart due to server code change.

Now, we enable/disable progress display from inside the loop that re-runs the app on change.

Remove the “suppressDisplay” approach to hiding the spinner when there’s an error building the app, because it didn’t work on rebuilds, only the first build.  Better to just call enableProgressDisplay(false) and hope for the best like we do elsewhere.
2014-10-22 13:05:19 -07:00
Emily Stark
97c85bc3da Exit 'meteor run' when cordova plugins or platforms change.
We don't have a way to HCP a changed set of plugins or platforms, so
just exit and ask the user to re-run. There are probably some cases
where we don't have to exit (e.g. if you add the android platform, we
probably don't need to exit out of 'meteor run ios'), but we exit in all
cases for simplicity.
2014-10-21 15:59:40 -07:00
Justin SB
a68a12dd02 Replace the progress npm dependency with our own version
More or less copied code, for now (MIT licensed)
2014-10-17 11:27:17 -07:00
Justin SB
d1fdb06103 Add yield to Console.nudge(), remove old exponential nudge which didn't look right 2014-10-17 11:27:13 -07:00
Justin SB
864af5061b Fix reported problem with "=> Starting Cordova" wrapping
This was one of the few remaining uses of logTemporary.

Replaced with buildmessage.enterJob
2014-10-15 14:22:44 -07:00
Emily Stark
5d2bd77d96 Add newline to error message 2014-10-07 15:19:02 -07:00
Emily Stark
07f0c56a85 Preserve --mobile-server setting across hot code pushes.
The server sends hot code push updates to mobile clients with ROOT_URL
and DDP_DEFAULT_CONNECTION_URL taken from the MOBILE_ROOT_URL and
MOBILE_DDP_URL environment variables. These are set by the main meteor
process when it starts the app runner.
2014-10-03 15:46:43 -07:00
Justin SB
6307ace605 Start android emulator earlier in the run process 2014-10-03 15:28:00 -07:00
Justin SB
b5023c6541 Make sure listenPort is an int before adding 1 to it 2014-09-30 22:13:50 -07:00
Ben Newman
f53c12815e Implement a meteor debug command.
Summary:
The `node-inspector` NPM package was added to the dev_bundle by this
recent commit: 64a624ae5c

Task: https://app.asana.com/0/15750483766338/16241466809965

Test Plan:
Add `debugger` statements to server code, run `meteor debug`, visit the
node-inspector URL in a browser, continue the application, and verify that
the debugger stops at the `debugger` statements that were set.

Reviewers: nim, slava, emily, avital, dgreenspan

CC: sashko

Differential Revision: https://phabricator.meteor.com/D827
2014-09-29 22:50:49 -04:00
Justin SB
0e79787c17 Make 'meteor run' pretty 2014-09-24 15:53:05 -07:00
Emily Stark
0ac1855166 Revert default bind IP to 0.0.0.0.
We still use localhost as DDP_DEFAULT_CONNECTION_URL for mobile builds
if another host isn't provided; we just don't want localhost to
overwrite an unspecified host for the proxy to bind to.

Fixes #2596.
2014-09-16 17:52:40 -07:00
Emily Stark
ccfee68145 Merge branch 'master' into devel
Conflicts:
	docs/client/api.html
	docs/client/data.js
	docs/client/names.json
	meteor
	packages/autoupdate/package.js
	packages/base64/.gitignore
	packages/constraint-solver/package.js
	packages/device-orientation/.gitignore
	packages/less/package.js
	packages/meteor-tool/package.js
	packages/meteor/package.js
	packages/package-version-parser/package.js
	packages/webapp/webapp_server.js
	scripts/admin/meteor-release-experimental.json
	tools/commands.js
	tools/help.txt
	tools/package-version-parser.js
	tools/run-all.js
	tools/tests/apps/build-errors/packages/with-colon-plugin/.gitignore
2014-09-15 14:48:57 -07:00
Justin SB
d223c21ae8 Initial support for selenium in test-packages
Run with
    ./meteor test-packages --driver-package test-in-console --selenium
2014-09-11 10:11:15 -07:00
Justin SB
36db11a63d Fix 'typo' 2014-09-09 08:12:29 -07:00
Justin SB
9ebd90bddc Start cordova using the runner infrastructure
Cleaner, but also we need to start the http proxy first
2014-09-09 07:55:37 -07:00
Justin SB
4ca704f93f Simple (generic) http proxy for meteor run & test-packages
Start it by passing --http-proxy-port=9999
2014-09-08 09:14:21 -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
Avital Oliver
6ea5ab0ed1 Don't record package usage when running meteor test-packages 2014-06-16 14:02:47 -07:00
David Glasser
e4000c6808 Merge branch 'devel' into packaging
Conflicts (around utils.quotemeta):
	tools/packages.js
	tools/utils.js
2014-05-12 17:06:11 -07:00
Felix Rabe
819bdb31b0 Looks like a typo (untested minor change) 2014-05-07 17:55:08 -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
568b0f929c Change 'port' to 'proxyPort' in test-packages and update run-all comment.
run-all interface was changed in 9b8bd31a.
2014-04-20 17:23:03 -07:00
David Glasser
9b8bd31a7b Allow specifying interface with -p and --app-port
The syntax is "--port host:port".

Not implemented for test-packages. No control is available over mongo
ports (port or host).

Fixes #469 and #1105.
2014-04-18 14:15:14 -07:00
David Glasser
a4a66aeede tools api change: rename port to proxyPort 2014-04-18 13:43:51 -07:00
David Glasser
72c9657b0e Test that observeChanges works over a failover 2014-04-10 16:56:32 -07:00
David Glasser
1d5da6b439 Add a flag to MongoRunner which runs 3 mongods
This is only intended for testing. No data is preserved from one run to
the next, and if any mongod exits for any reason, the rest are killed;
there is no mongod restarting.

It takes a while (~20 seconds) to start up because it waits for the
replset to be ready.
2014-04-10 16:56:31 -07:00
David Glasser
82aa3485ac Assign the Fiber to self.fiber.
Doing so reveals a deadlock in the stop code (which causes self-test to
fail, yay).  Fix it by trying harder to not stop the (all or app) runner
until after the app runner has processed the "hey you should stop"
return false from onRunEnd.
2014-04-02 20:27:54 -07:00
David Glasser
3e76ad7946 Don't use require('./run-log.js').runLog
If you happen to introduce a circular require into the stack, this
object will be undefined.

Instead, hang on to `require('./run-log.js')`, which is the exports
module which does get filled in later.
2014-03-31 19:52:02 -07:00
ekatek
18af114204 meteor run works, but doesn't actually render 2014-03-17 17:17:13 -07:00
David Glasser
2586a50cd0 Refactor RunLog to be a singleton
The rationale: RunLog is an object that is hardcoded around managing two
other singletons: stdout and stderr. Having multiple RunLogs wouldn't
work well without improving RunLog to have the ability to control other
streams.

We'd like to be able to use RunLog from other places in the tool, most
notably from code called from bundler (while running an app) such as the
npm updater. But threading a RunLog object through that code is
difficult (especially as bundling takes a detour through
release.current.library).
2014-02-13 19:11:30 -08:00
David Glasser
58a27d123c Fix and test some runner error handling issues
- Exit with failure if proxy starts to listen. Previously, we got stuck
  inside ProxyRunner.start(), and since we weren't waiting on any IO
  we'd exit 0!  (The existence of a yielded fiber is not sufficient to
  block Node exit.)

- Don't print various bits of startup text if we are stopped midway.

- Stop main Runner immediately if proxy or mongo runners invoke
  onFailure, rather than waiting for wait to be called and return.

- Ensure that a few Futures don't get return called on them multiple
  times.

- Ensure we don't try to call close() on the proxy's TCP server if it
  failed to listen in the first place.
2014-02-11 00:17:22 -08:00
David Glasser
1d391ee7a9 remove unused onFailure argument 2014-02-07 19:02:22 -08:00
David Glasser
b02857e4f2 re-randomize app port on each restart 2014-02-07 18:10:01 -08:00
David Glasser
aa4df6f274 Implement run --app-port 2014-02-07 17:55:46 -08:00
David Glasser
c3872d1dd6 Simplify onRunEnd API
Make comments more clear to me
2014-02-05 15:52:05 -08:00