Skip to content

Commit 78b2671

Browse files
committed
Kill ember fastboot command
1 parent ee565e5 commit 78b2671

16 files changed

Lines changed: 371 additions & 1511 deletions

index.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
const path = require('path');
55
const fs = require('fs');
66

7-
const EventEmitter = require('events').EventEmitter;
87
const MergeTrees = require('broccoli-merge-trees');
98
const FastBootExpressMiddleware = require('fastboot-express-middleware');
109
const FastBoot = require('fastboot');
@@ -28,28 +27,15 @@ module.exports = {
2827

2928
init() {
3029
this._super.init && this._super.init.apply(this, arguments);
31-
32-
// TODO remove once serve PR is checked in
33-
this.emitter = new EventEmitter();
3430
},
3531

36-
// TODO remove once serve PR is checked in
32+
// TODO remove after few ember-cli-fastboot rc builds
3733
includedCommands: function() {
3834
return {
3935
'fastboot': require('./lib/commands/fastboot')(this),
4036
};
4137
},
4238

43-
// TODO remove once serve PR is checked in
44-
on: function() {
45-
this.emitter.on.apply(this.emitter, arguments);
46-
},
47-
48-
// TODO remove once serve PR is checked in
49-
emit: function() {
50-
this.emitter.emit.apply(this.emitter, arguments);
51-
},
52-
5339
/**
5440
* Called at the start of the build process to let the addon know it will be
5541
* used. Sets the auto run on app to be false so that we create and route app
@@ -263,14 +249,7 @@ module.exports = {
263249
}
264250
},
265251

266-
// TODO remove once serve PR is checked in
267-
outputReady: function() {
268-
this.emit('outputReady');
269-
},
270-
271-
// TODO remove once serve PR is checked in
272252
postBuild: function(result) {
273-
this.emit('postBuild');
274253
if (this.fastboot) {
275254
// should we reload fastboot if there are only css changes? Seems it maynot be needed.
276255
// TODO(future): we can do a smarter reload here by running fs-tree-diff on files loaded

lib/commands/fastboot.js

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
'use strict';
22

3-
const RSVP = require('rsvp');
4-
const getPort = RSVP.denodeify(require('portfinder').getPort);
5-
const ServerTask = require('../tasks/fastboot-server');
63
const SilentError = require('silent-error');
7-
const VersionChecker = require('ember-cli-version-checker');
8-
9-
const blockForever = () => (new RSVP.Promise(() => {}));
104

115
module.exports = function(addon) {
126
return {
@@ -24,69 +18,8 @@ module.exports = function(addon) {
2418
{ name: 'assets-path', type: String, default: 'dist' }
2519
],
2620

27-
blockForever,
28-
getPort,
29-
ServerTask,
30-
3121
run(options) {
32-
const printDeprecations = () => this.printDeprecations(options);
33-
const runBuild = () => this.runBuild(options);
34-
const runServer = () => this.runServer(options);
35-
const startServer = (serverTask) => this.startServer(serverTask, options);
36-
const blockForever = this.blockForever;
37-
38-
return this.checkPort(options)
39-
.then(printDeprecations)
40-
.then(runServer) // starts on postBuild SIGHUP
41-
.then(options.build ? runBuild : startServer)
42-
.then(blockForever);
43-
},
44-
45-
runServer(options) {
46-
const ServerTask = this.ServerTask;
47-
const serverTask = new ServerTask({
48-
ui: this.ui,
49-
addon: addon
50-
});
51-
serverTask.run(options);
52-
return serverTask;
53-
},
54-
55-
startServer(serverTask, options) {
56-
serverTask.start(options);
22+
throw new SilentError('the command: `ember fastboot` has been removed, ember serve now supports fastboot.');
5723
},
58-
59-
runBuild(options) {
60-
const BuildTask = options.watch ? this.tasks.BuildWatch : this.tasks.Build;
61-
const buildTask = new BuildTask({
62-
ui: this.ui,
63-
analytics: this.analytics,
64-
project: this.project,
65-
});
66-
buildTask.run(options); // no return, BuildWatch.run blocks forever
67-
},
68-
69-
checkPort(options) {
70-
return this.getPort({ port: options.port, host: options.host })
71-
.then((foundPort) => {
72-
if (options.port !== foundPort && options.port !== 0) {
73-
const message = `Port ${options.port} is already in use.`;
74-
return Promise.reject(new SilentError(message));
75-
}
76-
options.port = foundPort;
77-
});
78-
},
79-
80-
printDeprecations(options) {
81-
var checker = new VersionChecker(this);
82-
var dep = checker.for('ember-cli', 'npm');
83-
84-
if (dep.gte('2.12.0-beta.1')) {
85-
this.ui.writeDeprecateLine('`ember fastboot --serve-assets` is deprecated. Please use `ember serve` to serve your fastboot assets.');
86-
} else {
87-
this.ui.writeWarnLine('`ember fastboot` will no longer work after FastBoot 1.0 is released.');
88-
}
89-
},
90-
9124
}
9225
};

lib/tasks/fastboot-server.js

Lines changed: 0 additions & 152 deletions
This file was deleted.

test/async-content-test.js

Lines changed: 21 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,65 +10,32 @@ const get = RSVP.denodeify(request);
1010
describe('async content via deferred content', function() {
1111
this.timeout(400000);
1212

13-
describe('with fastboot command', function() {
14-
let app;
13+
let app;
1514

16-
before(function() {
15+
before(function() {
16+
app = new AddonTestApp();
1717

18-
app = new AddonTestApp();
19-
20-
return app.create('async-content')
21-
.then(function() {
22-
return app.startServer({
23-
command: 'fastboot',
24-
additionalArguments: ['--serve-assets']
25-
});
26-
});
27-
});
28-
29-
after(function() {
30-
return app.stopServer();
31-
});
32-
33-
it('waits for async content when using `fastboot.deferRendering`', function() {
34-
return get({
35-
url: 'http://localhost:49741/'
36-
})
37-
.then(function(response) {
38-
expect(response.body).to.contain('Async content: foo');
18+
return app.create('async-content')
19+
.then(function() {
20+
return app.startServer({
21+
command: 'serve'
3922
});
40-
});
23+
});
4124
});
4225

43-
describe('with serve command', function() {
44-
let app;
45-
46-
before(function() {
47-
48-
app = new AddonTestApp();
49-
50-
return app.create('async-content')
51-
.then(function() {
52-
return app.startServer({
53-
command: 'serve'
54-
});
55-
});
56-
});
57-
58-
after(function() {
59-
return app.stopServer();
60-
});
26+
after(function() {
27+
return app.stopServer();
28+
});
6129

62-
it('waits for async content when using `fastboot.deferRendering`', function() {
63-
return get({
64-
url: 'http://localhost:49741/',
65-
headers: {
66-
'Accept': 'text/html'
67-
}
68-
})
69-
.then(function(response) {
70-
expect(response.body).to.contain('Async content: foo');
71-
});
72-
});
30+
it('waits for async content when using `fastboot.deferRendering`', function() {
31+
return get({
32+
url: 'http://localhost:49741/',
33+
headers: {
34+
'Accept': 'text/html'
35+
}
36+
})
37+
.then(function(response) {
38+
expect(response.body).to.contain('Async content: foo');
39+
});
7340
});
7441
});

0 commit comments

Comments
 (0)