コード例 #1
0
ファイル: StopNodeCommand.cs プロジェクト: jasperdk/NPloy
        public override int Run(string[] remainingArguments)
        {
            try
            {
                SetDefaultOptionValues();

                if (!_nPloyConfiguration.HasInstalledPackages(WorkingDirectory))
                {
                    Console.WriteLine("Nothing to stop");
                    return 0;
                }
                Console.WriteLine("Stop node in: " + WorkingDirectory);
                var installedPackages = _nPloyConfiguration.GetInstalledPackges(WorkingDirectory);

                foreach (var package in installedPackages.Reverse())
                {
                    var stopPackageCommand = new StopPackageCommand
                        {
                            WorkingDirectory = WorkingDirectory
                        };
                    var result = stopPackageCommand.Run(new[] { package.FullName });
                    if (result > 0)
                        return result;
                }

                return 0;
            }
            catch (ConsoleException c)
            {
                return c.ExitCode;
            }
        }
コード例 #2
0
 public void SetUp()
 {
     _nPloyConfiguration = new Mock<INPloyConfiguration>();
     _powershellRunner = new Mock<IPowershellRunner>();
     _command = new StopPackageCommand(_nPloyConfiguration.Object,_powershellRunner.Object);
 }