Ejemplo n.º 1
0
 public async Task <bool> Install()
 {
     _command = new NpmInstallCommand(
         _npmController.FullPathToRootPackageDirectory,
         _npmController.PathToNpm);
     return(await DoCommandExecute(true));
 }
Ejemplo n.º 2
0
 public static async Task <bool> ExecuteAsync(NpmCommander commander, NpmCommand command)
 {
     using (var runner = new NmpCommandRunner(commander, command))
     {
         return(await runner.command.ExecuteAsync());
     }
 }
Ejemplo n.º 3
0
        private void UnregisterLogEvents(NpmCommand command) {
            command.CommandStarted -= command_CommandStarted;
            command.OutputLogged -= command_OutputLogged;
            command.CommandCompleted -= command_CommandCompleted;

            command.ErrorLogged -= command_ErrorLogged;
            command.ExceptionLogged -= command_ExceptionLogged;
        }
Ejemplo n.º 4
0
 public async Task <bool> ExecuteNpmCommandAsync(string arguments)
 {
     _command = new GenericNpmCommand(
         _npmController.FullPathToRootPackageDirectory,
         arguments,
         _npmController.PathToNpm);
     return(await DoCommandExecute(true));
 }
Ejemplo n.º 5
0
        private void UnregisterLogEvents(NpmCommand command)
        {
            command.CommandStarted   -= command_CommandStarted;
            command.OutputLogged     -= command_OutputLogged;
            command.CommandCompleted -= command_CommandCompleted;

            command.ErrorLogged     -= command_ErrorLogged;
            command.ExceptionLogged -= command_ExceptionLogged;
        }
Ejemplo n.º 6
0
 private async Task <bool> UpdatePackagesAsync(IEnumerable <IPackage> packages, bool global)
 {
     _command = new NpmUpdateCommand(
         _npmController.FullPathToRootPackageDirectory,
         packages,
         global,
         _npmController.PathToNpm);
     return(await DoCommandExecute(true));
 }
Ejemplo n.º 7
0
 private async Task <bool> UninstallPackageAsync(string packageName, bool global)
 {
     _command = new NpmUninstallCommand(
         _npmController.FullPathToRootPackageDirectory,
         packageName,
         GetDependencyType(packageName),
         global,
         _npmController.PathToNpm);
     return(await DoCommandExecute(true));
 }
Ejemplo n.º 8
0
        public async Task <IPackageCatalog> GetCatalogAsync(bool forceDownload, IProgress <string> progress)
        {
            _command = new NpmGetCatalogCommand(
                _npmController.FullPathToRootPackageDirectory,
                _npmController.CachePath,
                forceDownload,
                pathToNpm: _npmController.PathToNpm,
                progress: progress);
            await DoCommandExecute(false);

            return((_command as NpmGetCatalogCommand).Catalog);
        }
Ejemplo n.º 9
0
            private NmpCommandRunner(NpmCommander commander, NpmCommand command) {
                this._commander = commander;
                this._command = command;

                _commander._executingCommand = command;

                _command.CommandStarted += _commander.command_CommandStarted;
                _command.OutputLogged += _commander.command_OutputLogged;
                _command.CommandCompleted += _commander.command_CommandCompleted;

                _command.ErrorLogged += _commander.command_ErrorLogged;
                _command.ExceptionLogged += _commander.command_ExceptionLogged;
            }
Ejemplo n.º 10
0
            private NmpCommandRunner(NpmCommander commander, NpmCommand command)
            {
                this.commander = commander;
                this.command   = command;

                this.commander.executingCommand = command;

                this.command.CommandStarted   += this.commander.command_CommandStarted;
                this.command.OutputLogged     += this.commander.command_OutputLogged;
                this.command.CommandCompleted += this.commander.command_CommandCompleted;

                this.command.ErrorLogged     += this.commander.command_ErrorLogged;
                this.command.ExceptionLogged += this.commander.command_ExceptionLogged;
            }
Ejemplo n.º 11
0
        private async Task <bool> DoCommandExecute(bool refreshNpmController, NpmCommand command)
        {
            Debug.Assert(_executingCommand == null, "Attempting to execute multiple commands at the same time.");
            try {
                bool success = await NmpCommandRunner.ExecuteAsync(this, command);

                if (refreshNpmController)
                {
                    _npmController.Refresh();
                }
                return(success);
            } catch (Exception e) {
                OnOutputLogged(e.ToString());
            }
            return(false);
        }
Ejemplo n.º 12
0
 private async Task <bool> InstallPackageByVersionAsync(
     string packageName,
     string versionRange,
     DependencyType type,
     bool global,
     bool saveToPackageJson)
 {
     _command = new NpmInstallCommand(
         _npmController.FullPathToRootPackageDirectory,
         packageName,
         versionRange,
         type,
         global,
         saveToPackageJson,
         _npmController.PathToNpm);
     return(await DoCommandExecute(true));
 }
Ejemplo n.º 13
0
 public NpmCommandRedirector(NpmCommand owner)
 {
     this.owner = owner;
 }
Ejemplo n.º 14
0
 public async Task<bool> ExecuteNpmCommandAsync(string arguments) {
     _command = new GenericNpmCommand(
         _npmController.FullPathToRootPackageDirectory,
         arguments,
         _npmController.PathToNpm);
     return await DoCommandExecute(true);
 }
Ejemplo n.º 15
0
 private async Task<bool> UpdatePackagesAsync(IEnumerable<IPackage> packages, bool global) {
     _command = new NpmUpdateCommand(
         _npmController.FullPathToRootPackageDirectory,
         packages,
         global,
         _npmController.PathToNpm);
     return await DoCommandExecute(true);
 }
Ejemplo n.º 16
0
 public async Task<IPackageCatalog> GetCatalogAsync(bool forceDownload, IProgress<string> progress) {
     _command = new NpmGetCatalogCommand(
         _npmController.FullPathToRootPackageDirectory,
         _npmController.CachePath,
         forceDownload,
         pathToNpm:_npmController.PathToNpm,
         progress: progress);
     await DoCommandExecute(false);
     return (_command as NpmGetCatalogCommand).Catalog;
 }
Ejemplo n.º 17
0
 private async Task<bool> UninstallPackageAsync(string packageName, bool global) {
     _command = new NpmUninstallCommand(
         _npmController.FullPathToRootPackageDirectory,
         packageName,
         GetDependencyType(packageName),
         global,
         _npmController.PathToNpm);
     return await DoCommandExecute(true);
 }
Ejemplo n.º 18
0
 private async Task<bool> InstallPackageByVersionAsync(
     string packageName,
     string versionRange,
     DependencyType type,
     bool global,
     bool saveToPackageJson) {
     _command = new NpmInstallCommand(
         _npmController.FullPathToRootPackageDirectory,
         packageName,
         versionRange,
         type,
         global,
         saveToPackageJson,
         _npmController.PathToNpm);
     return await DoCommandExecute(true);
 }
Ejemplo n.º 19
0
 private async Task<bool> DoCommandExecute(bool refreshNpmController, NpmCommand command) {
     Debug.Assert(_executingCommand == null, "Attempting to execute multiple commands at the same time.");
     try {
         bool success = await NmpCommandRunner.ExecuteAsync(this, command);
         if (refreshNpmController) {
             _npmController.Refresh();
         }
         return success;
     } catch (Exception e) {
         OnOutputLogged(e.ToString());
     }
     return false;
 }
Ejemplo n.º 20
0
 public static async Task<bool> ExecuteAsync(NpmCommander commander, NpmCommand command) {
     using (var runner = new NmpCommandRunner(commander, command)) {
         return await runner._command.ExecuteAsync();
     }
 }
Ejemplo n.º 21
0
 public async Task<bool> Install() {
     _command = new NpmInstallCommand(
         _npmController.FullPathToRootPackageDirectory,
         _npmController.PathToNpm);
     return await DoCommandExecute(true);
 }
Ejemplo n.º 22
0
 public NpmCommandRedirector(NpmCommand owner)
 {
     _owner = owner;
 }
 public NpmCommandRedirector(NpmCommand owner) {
     _owner = owner;
 }