Skip to content

Commit 82122cc

Browse files
author
Kelly Selden
committed
add bootstrap command
1 parent 8998174 commit 82122cc

3 files changed

Lines changed: 61 additions & 0 deletions

File tree

bin/commands/bootstrap.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
const bootstrap = require('../../src/bootstrap');
4+
5+
module.exports.command = 'bootstrap';
6+
7+
module.exports.describe = 'saves the detected blueprint state';
8+
9+
module.exports.handler = async function handler() {
10+
try {
11+
let message = await bootstrap();
12+
if (message) {
13+
console.log(message);
14+
}
15+
} catch (err) {
16+
console.error(err);
17+
}
18+
};

src/bootstrap.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
3+
const saveDefaultBlueprint = require('./save-default-blueprint');
4+
5+
module.exports = async function bootstrap() {
6+
let defaultBlueprint = {
7+
name: 'ember-cli'
8+
};
9+
10+
let cwd = process.cwd();
11+
12+
await saveDefaultBlueprint({
13+
cwd,
14+
defaultBlueprint
15+
});
16+
};

test/acceptance/ember-cli-update-test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ describe(function() {
3535
blueprint,
3636
install,
3737
addon,
38+
bootstrap,
3839
beforeMerge = () => Promise.resolve()
3940
}) {
4041
tmpPath = await buildTmp({
@@ -65,6 +66,11 @@ describe(function() {
6566
addon
6667
];
6768
}
69+
if (bootstrap) {
70+
args = [
71+
'bootstrap'
72+
];
73+
}
6874

6975
return processBin({
7076
binFile: 'ember-cli-update',
@@ -272,4 +278,25 @@ describe(function() {
272278

273279
assertNoStaged(status);
274280
});
281+
282+
it('can bootstrap the default blueprint', async function() {
283+
let {
284+
status
285+
} = await (await merge({
286+
fixturesPath: 'test/fixtures/app/merge',
287+
commitMessage: 'my-app',
288+
bootstrap: true
289+
})).promise;
290+
291+
expect(path.join(tmpPath, 'ember-cli-update.json')).to.be.a.file()
292+
.and.equal('test/fixtures/ember-cli-update-json/default/ember-cli-update.json');
293+
294+
await fs.remove(path.join(tmpPath, 'ember-cli-update.json'));
295+
296+
fixtureCompare({
297+
mergeFixtures: 'test/fixtures/app/merge/my-app'
298+
});
299+
300+
assertNoStaged(status);
301+
});
275302
});

0 commit comments

Comments
 (0)