Skip to content

plugin install alias added #1950

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

Merged
merged 1 commit into from
Jul 26, 2016
Merged
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 docs/man_pages/lib-management/plugin-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ General | `$ tns plugin add <Plugin>`
Command | Description
----------|----------
[plugin](plugin.html) | Lets you manage the plugins for your project.
[plugin install](plugin-install.html) | Installs the specified plugin and its dependencies.
[plugin remove](plugin-remove.html) | Uninstalls the specified plugin and its dependencies.
[plugin find](plugin-find.html) | Finds NativeScript plugins in npm.
[plugin search](plugin-search.html) | Finds NativeScript plugins in npm.
Expand Down
34 changes: 34 additions & 0 deletions docs/man_pages/lib-management/plugin-install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
plugin install
==========

Usage | Synopsis
------|-------
General | `$ tns plugin install <Plugin>`

<% if(isConsole) { %>Installs the specified plugin and any packages that it depends on.<% } %>
<% if(isHtml) { %>Installs the specified plugin and its dependencies in the local `node_modules` folder, adds it to the `dependencies` section in `package.json`, and prepares the plugin for all installed platforms. If you have not configured any platforms for the project, the NativeScript CLI will prepare the plugin when you add a platform. For more information about working with plugins, see [NativeScript Plugins](https://github.com/NativeScript/nativescript-cli/blob/master/PLUGINS.md).<% } %>

### Attributes

* `<Plugin>` is a valid NativeScript plugin, specified by any of the following.
* A `<Name>` or `<Name>@<Version>` where `<Name>` is the name of a plugin that is published in the npm registry and `<Version>` is a valid version of this plugin.
* A `<Local Path>` to the directory which contains the plugin, including its `package.json` file.
* A `<Local Path>` to a `.tar.gz` archive containing a directory with the plugin and its `package.json` file.
* A `<URL>` which resolves to a `.tar.gz` archive containing a directory with the plugin and its `package.json` file.
* A `<git Remote URL>` which resolves to a `.tar.gz` archive containing a directory with the plugin and its `package.json` file.

<% if(isHtml) { %>
### Prerequisites

* Verify that the plugin that you want to add contains a valid `package.json` file. Valid `package.json` files contain a `nativescript` section.

### Related Commands

Command | Description
----------|----------
[plugin](plugin.html) | Lets you manage the plugins for your project.
[plugin add](plugin-add.html) | Installs the specified plugin and its dependencies.
[plugin remove](plugin-remove.html) | Uninstalls the specified plugin and its dependencies.
[plugin find](plugin-find.html) | Finds NativeScript plugins in npm.
[plugin search](plugin-search.html) | Finds NativeScript plugins in npm.
<% } %>
1 change: 1 addition & 0 deletions lib/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ $injector.requireCommand("plugin|*list", "./commands/plugin/list-plugins");
$injector.requireCommand("plugin|find", "./commands/plugin/find-plugins");
$injector.requireCommand("plugin|search", "./commands/plugin/find-plugins");
$injector.requireCommand("plugin|add", "./commands/plugin/add-plugin");
$injector.requireCommand("plugin|install", "./commands/plugin/add-plugin");
$injector.requireCommand("plugin|remove", "./commands/plugin/remove-plugin");

$injector.require("doctorService", "./services/doctor-service");
Expand Down
6 changes: 3 additions & 3 deletions lib/commands/plugin/add-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export class AddPluginCommand implements ICommand {

canExecute(args: string[]): IFuture<boolean> {
return (() => {
if(!args[0]) {
if (!args[0]) {
this.$errors.fail("You must specify plugin name.");
}

let installedPlugins = this.$pluginsService.getAllInstalledPlugins().wait();
let pluginName = args[0].toLowerCase();
if(_.some(installedPlugins, (plugin: IPluginData) => plugin.name.toLowerCase() === pluginName)) {
if (_.some(installedPlugins, (plugin: IPluginData) => plugin.name.toLowerCase() === pluginName)) {
this.$errors.failWithoutHelp(`Plugin "${pluginName}" is already installed.`);
return false;
}
Expand All @@ -25,4 +25,4 @@ export class AddPluginCommand implements ICommand {

public allowedParameters: ICommandParameter[] = [];
}
$injector.registerCommand("plugin|add", AddPluginCommand);
$injector.registerCommand(["plugin|add", "plugin|install"], AddPluginCommand);
Loading