-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(commands): override ng destroy
It's common for users to try and do `ng destroy component name` and have it only partially work. Since we don't support the command, it's better to not have it do any partial operations. Close #2739
- Loading branch information
1 parent
ae56b89
commit 02d8d66
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const Command = require('ember-cli/lib/models/command'); | ||
const SilentError = require('silent-error'); | ||
|
||
|
||
const DestroyCommand = Command.extend({ | ||
name: 'destroy', | ||
aliases: ['d'], | ||
works: 'insideProject', | ||
|
||
anonymousOptions: [ | ||
'<blueprint>' | ||
], | ||
|
||
run: function() { | ||
return Promise.reject(new SilentError('The destroy command is not supported by Angular-CLI.')); | ||
} | ||
}); | ||
|
||
export default DestroyCommand; | ||
DestroyCommand.overrideCore = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use strict'; | ||
|
||
const ng = require('../helpers/ng'); | ||
const tmp = require('../helpers/tmp'); | ||
const conf = require('ember-cli/tests/helpers/conf'); | ||
const SilentError = require('silent-error'); | ||
const expect = require('chai').expect; | ||
|
||
describe('Acceptance: ng destroy', function () { | ||
before(conf.setup); | ||
|
||
after(conf.restore); | ||
|
||
beforeEach(function () { | ||
this.timeout(10000); | ||
return tmp.setup('./tmp').then(function () { | ||
process.chdir('./tmp'); | ||
}).then(function () { | ||
return ng(['new', 'foo', '--skip-npm', '--skip-bower']); | ||
}); | ||
}); | ||
|
||
afterEach(function () { | ||
return tmp.teardown('./tmp'); | ||
}); | ||
|
||
it('without args should fail', function () { | ||
return ng(['destroy']).then(() => { | ||
throw new SilentError('ng destroy should fail.'); | ||
}, (err) => { | ||
expect(err.message).to.equal('The destroy command is not supported by Angular-CLI.'); | ||
}); | ||
}); | ||
|
||
it('with args should fail', function () { | ||
return ng(['destroy', 'something']).then(() => { | ||
throw new SilentError('ng destroy something should fail.'); | ||
}, (err) => { | ||
expect(err.message).to.equal('The destroy command is not supported by Angular-CLI.'); | ||
}); | ||
}); | ||
}); |