-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
install:addon
will show a deprecation warning then it will run the …
…`install` command. Changed the verbage on install-npm.
- Loading branch information
1 parent
d36a41e
commit 9f8b99a
Showing
4 changed files
with
114 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
|
||
var InstallCommand = require('./install'); | ||
var chalk = require('chalk'); | ||
|
||
module.exports = InstallCommand.extend({ | ||
name: 'install:addon', | ||
description: 'This command has been deprecated. Please use `ember install` instead.', | ||
works: 'insideProject', | ||
|
||
anonymousOptions: [ | ||
'<addon-name>' | ||
], | ||
|
||
init: function() { | ||
var warning = 'This command has been deprecated. Please use `ember '; | ||
warning += 'install <addonName>` instead.'; | ||
this.ui.writeLine(chalk.red(warning)); | ||
|
||
if (this._super.init) { | ||
this._super.init.call(this); | ||
} | ||
} | ||
}); |
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,88 @@ | ||
'use strict'; | ||
|
||
var expect = require('chai').expect; | ||
var InstallAddonCommand = require('../../../lib/commands/install-addon'); | ||
var commandOptions = require('../../factories/command-options'); | ||
var AddonInstall = require('../../../lib/tasks/addon-install'); | ||
var Task = require('../../../lib/models/task'); | ||
var Promise = require('../../../lib/ext/promise'); | ||
var stub = require('../../helpers/stub').stub; | ||
var Project = require('../../../lib/models/project'); | ||
|
||
describe('install:addon command', function() { | ||
var command, options, tasks, npmInstance, generateBlueprintInstance; | ||
|
||
beforeEach(function() { | ||
tasks = { | ||
AddonInstall: AddonInstall, | ||
NpmInstall: Task.extend({ | ||
init: function() { | ||
npmInstance = this; | ||
} | ||
}), | ||
|
||
GenerateFromBlueprint: Task.extend({ | ||
init: function() { | ||
generateBlueprintInstance = this; | ||
} | ||
}) | ||
}; | ||
|
||
options = commandOptions({ | ||
settings: {}, | ||
project: { | ||
name: function() { | ||
return 'some-random-name'; | ||
}, | ||
isEmberCLIProject: function() { | ||
return true; | ||
}, | ||
initializeAddons: function() { }, | ||
reloadAddons: function() { | ||
this.addons = [{ | ||
pkg: { | ||
name: 'ember-cli-photoswipe', | ||
'ember-addon': { | ||
defaultBlueprint: 'photoswipe' | ||
} | ||
} | ||
}]; | ||
}, | ||
|
||
findAddonByName: Project.prototype.findAddonByName | ||
}, | ||
|
||
tasks: tasks | ||
}); | ||
|
||
stub(tasks.NpmInstall.prototype, 'run', Promise.resolve()); | ||
stub(tasks.GenerateFromBlueprint.prototype, 'run', Promise.resolve()); | ||
|
||
command = new InstallAddonCommand(options); | ||
|
||
}); | ||
|
||
afterEach(function() { | ||
tasks.NpmInstall.prototype.run.restore(); | ||
tasks.GenerateFromBlueprint.prototype.run.restore(); | ||
}); | ||
|
||
|
||
it('will show a deprecation warning', function() { | ||
return command.validateAndRun(['ember-cli-photoswipe']).then(function() { | ||
var msg = 'This command has been deprecated. Please use `ember install '; | ||
msg += '<addonName>` instead.'; | ||
|
||
expect(command.ui.output).to.include(msg); | ||
|
||
expect(npmInstance.ui, 'ui was set'); | ||
expect(npmInstance.project, 'project was set'); | ||
expect(npmInstance.analytics, 'analytics was set'); | ||
|
||
expect(generateBlueprintInstance.ui, 'ui was set'); | ||
expect(generateBlueprintInstance.project, 'project was set'); | ||
expect(generateBlueprintInstance.analytics, 'analytics was set'); | ||
|
||
}); | ||
}); | ||
}); |
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