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

chore(commands): override ng destroy #2739

Closed
wants to merge 1 commit into from
Closed
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 packages/angular-cli/addon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
'serve': require('../commands/serve').default,
'new': require('../commands/new').default,
'generate': require('../commands/generate').default,
'destroy': require('../commands/destroy').default,
'init': require('../commands/init').default,
'test': require('../commands/test').default,
'e2e': require('../commands/e2e').default,
Expand Down
20 changes: 20 additions & 0 deletions packages/angular-cli/commands/destroy.ts
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;
1 change: 1 addition & 0 deletions packages/angular-cli/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const lookupCommand = require('ember-cli/lib/cli/lookup-command');

const commandsToIgnore = [
'easter-egg',
'destroy',
'github-pages-deploy' // errors because there is no base github-pages command
];

Expand Down
42 changes: 42 additions & 0 deletions tests/acceptance/destroy.spec.js
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.');
});
});
});