Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow live-reload to be disabled from command line. #510

Merged
merged 1 commit into from
Apr 29, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* Added `ember test --server` to run the `testem` command line server. `ember test --server` will automatically re-run your tests after a rebuild. [#474](https://github.com/stefanpenner/ember-cli/pull/474)
* Add JSHinting for `app/` and `test/` trees when building in development. This generates console logs as well as QUnit tests (so that `ember test` shows failures). [#482](https://github.com/stefanpenner/ember-cli/pull/482)
* Use the name specified in `package.json` while doing `ember init`. This allows you to use a different application name than your folder name. [#491](https://github.com/stefanpenner/ember-cli/pull/491)
* Allow disabling live reload via `ember server --live-reload=false`. [#510](https://github.com/stefanpenner/ember-cli/pull/510)

### 0.0.23

Expand Down
1 change: 1 addition & 0 deletions lib/commands/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = new Command({
{ name: 'host', type: String, default: '0.0.0.0' },
{ name: 'proxy-port', type: Number },
{ name: 'proxy-host', type: String },
{ name: 'live-reload', type: Boolean, default: true },
{ name: 'environment', type: String, default: 'development' }
],

Expand Down
4 changes: 4 additions & 0 deletions lib/tasks/server/livereload-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ exports.start = function(options) {
var leek = this.leek;
var ui = this.ui;

if (!options.liveReload) {
return Promise.resolve('live-reload is disabled');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks exotic. But if it makes @twokul happy...

Enabled: resolves to undefined
Disabled: resolves to a String ^^' yah...

}

var listen = Promise.denodeify(liveReloadServer.listen.bind(liveReloadServer));

// Reload on file changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ember": "./bin/ember"
},
"scripts": {
"test": "mocha --timeout 8000 --reporter spec tests/**/*-test.js tests/**/*/*-test.js tests/**/*-slow.js",
"test": "mocha --timeout 8000 --reporter spec tests/**/*-test.js tests/**/*/*-test.js tests/**/*/*/*-test.js tests/**/*-slow.js",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems dumb, but without adding a * for each folder depth, but without adding this it won't run the new test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're using npm run-script autotest then you have to restart the command after you added new files.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am running npm test which is what Travis runs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MajorBreakfast - FYI npm run-script autotest only sees 7 passing tests, but npm test sees 81. The autoscript line below needs to match the test script line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is super strange... o.O

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but that is how mocha apparently works.

Somewhat related: http://blog.zackehh.com/starting-mocha-tests-programmically-runner-js/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've already though about creating a run-tests.js script.

var mocha = ...;
globSync('**/*-test.js')(require);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But mocha depends on glob. It shouldn't mess up in the first place...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should open a speparate issue for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I figured you were working up the PR already 😃

"autotest": "mocha --watch --reporter spec tests/**/*-test.js"
},
"repository": {
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/tasks/server/livereload-server-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

var assert = require('../../../helpers/assert');
var liveReloadServer = require('../../../../lib/tasks/server/livereload-server');

describe('livereload-server', function() {
it('should return immediately if `liveReload` option is false', function() {
return liveReloadServer.start({liveReload: false})
.then(function(result) {
assert.equal('live-reload is disabled', result);
});
});
});