Beispiel #1
0
 public async Task <bool> Install()
 {
     _command = new NpmInstallCommand(
         _npmController.FullPathToRootPackageDirectory,
         _npmController.PathToNpm);
     return(await DoCommandExecute(true));
 }
Beispiel #2
0
 public static async Task <bool> ExecuteAsync(NpmCommander commander, NpmCommand command)
 {
     using (var runner = new NmpCommandRunner(commander, command))
     {
         return(await runner.command.ExecuteAsync());
     }
 }
Beispiel #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;
        }
Beispiel #4
0
 public async Task <bool> ExecuteNpmCommandAsync(string arguments)
 {
     _command = new GenericNpmCommand(
         _npmController.FullPathToRootPackageDirectory,
         arguments,
         _npmController.PathToNpm);
     return(await DoCommandExecute(true));
 }
Beispiel #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;
        }
Beispiel #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));
 }
Beispiel #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));
 }
Beispiel #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);
        }
Beispiel #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;
            }
Beispiel #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;
            }
        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);
        }
Beispiel #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));
 }
Beispiel #13
0
 public NpmCommandRedirector(NpmCommand owner)
 {
     this.owner = owner;
 }
Beispiel #14
0
 public async Task<bool> ExecuteNpmCommandAsync(string arguments) {
     _command = new GenericNpmCommand(
         _npmController.FullPathToRootPackageDirectory,
         arguments,
         _npmController.PathToNpm);
     return await DoCommandExecute(true);
 }
Beispiel #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);
 }
Beispiel #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;
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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;
 }
Beispiel #20
0
 public static async Task<bool> ExecuteAsync(NpmCommander commander, NpmCommand command) {
     using (var runner = new NmpCommandRunner(commander, command)) {
         return await runner._command.ExecuteAsync();
     }
 }
Beispiel #21
0
 public async Task<bool> Install() {
     _command = new NpmInstallCommand(
         _npmController.FullPathToRootPackageDirectory,
         _npmController.PathToNpm);
     return await DoCommandExecute(true);
 }
Beispiel #22
0
 public NpmCommandRedirector(NpmCommand owner)
 {
     _owner = owner;
 }
 public NpmCommandRedirector(NpmCommand owner) {
     _owner = owner;
 }