Пример #1
0
        public override void Build(IBounce bounce)
        {
            var iisServer = new ServerManager();

            var existingSite = iisServer.Sites[Name.Value];
            if (!SiteUpToDate(existingSite)) {
                bounce.Log.Info("installing IIS website at: " + Directory.Value);
                RemoveWebSiteIfExtant(iisServer);
                var site = iisServer.Sites.Add(Name.Value, Directory.Value, Port.Value);

                if (Bindings != null && Bindings.Value != null) {
                    site.Bindings.Clear();
                    foreach (var binding in Bindings.Value) {
                        site.Bindings.Add(binding.Information.Value, binding.Protocol.Value);
                    }
                }

                if (ApplicationPoolNameIfSet != null) {
                    site.ApplicationDefaults.ApplicationPoolName = ApplicationPoolNameIfSet;
                }

                iisServer.CommitChanges();
            } else {
                bounce.Log.Info("IIS website already installed");
            }
        }
Пример #2
0
 public void Pull(string workingDirectory, ILog log, IBounce bounce)
 {
     using (new DirectoryChange(workingDirectory)) {
         log.Info("pulling git repo in: " + workingDirectory);
         Git(bounce, "pull");
     }
 }
Пример #3
0
 public override void Clean(IBounce bounce)
 {
     if (SolutionExists) {
         bounce.Log.Info("cleaning solution at: " + SolutionPath.Value);
         bounce.ShellCommand.ExecuteAndExpectSuccess("msbuild.exe", String.Format(@"/target:Clean ""{0}""", SolutionPath.Value));
     }
 }
Пример #4
0
        public override void Build(IBounce bounce)
        {
            IEnumerable<string> testDlls = DllPaths.Select(dll => dll.Value).Where(dll => dll.EndsWith("Tests.dll"));
            string joinedTestDlls = "\"" + String.Join("\" \"", testDlls.ToArray()) + "\"";

            bounce.Log.Info("running unit tests for: " + joinedTestDlls);
            bounce.ShellCommand.ExecuteAndExpectSuccess(NUnitConsolePath.Value, joinedTestDlls);
        }
Пример #5
0
 public override void Build(IBounce bounce)
 {
     if (ServiceInstalled) {
         bounce.Log.Info("service {0} installed, deleting", Name.Value);
         DeleteService();
     }
     InstallService();
 }
Пример #6
0
 public override void Build(IBounce bounce)
 {
     if (Directory.Exists(To.Value))
         throw new ArgumentException("To directory '" + To.Value + "' already exists.");
     if (Directory.Exists(From.Value))
         Directory.Move(From.Value, To.Value);
     else
         throw new ArgumentException("From directory '" + From.Value + "' does not seem to to exist.");
 }
Пример #7
0
        public override void Build(IBounce bounce)
        {
            var fromPath = FromPath.Value;
            var toPath = _toPath.Value;

            bounce.Log.Debug("copying from: `{0}', to: `{1}'", fromPath, toPath);

            FileSystemCopier.Copy(fromPath, toPath, GetValueOf(Excludes), GetValueOf(Includes), DeleteToDirectory.Value);
        }
Пример #8
0
 public override void Clean(IBounce bounce)
 {
     if (ServiceInstalled) {
         bounce.Log.Info("service {0} installed, deleting", Name.Value);
         DeleteService();
     } else {
         bounce.Log.Info("service {0} not installed");
     }
 }
Пример #9
0
 public override void Build(IBounce bounce)
 {
     bounce.Log.Debug("pwd");
     bounce.Log.Debug(System.IO.Directory.GetCurrentDirectory());
     if (DirectoryUtils.DirectoryExists(WorkingDirectory)) {
         GitCommand.Pull(WorkingDirectory, bounce.Log, bounce);
     } else {
         GitCommand.Clone(Repository.Value, WorkingDirectory, bounce.Log, bounce);
     }
 }
Пример #10
0
        public override void Build(IBounce bounce)
        {
            var fromPath = FromPath.Value;
            var toPath = ToPath.Value;

            bounce.Log.Debug(Directory.GetCurrentDirectory());
            bounce.Log.Debug("copying from: {0}, to: {1}", FromPath.Value, ToPath.Value);

            FileSystemCopier.Copy(fromPath, toPath, GetValueOf(Excludes), GetValueOf(Includes));
        }
Пример #11
0
        public void Clone(string repo, string directory, IDictionary<string, string> options,  ILog log, IBounce bounce)
        {
            log.Info("cloning git repo: {0}, into: {1}", repo, directory);

            if (options == null) {
                Git(bounce, @"clone {0} ""{1}""", repo, directory);
            }
            else {
                Git(bounce, @"clone {0} {1} ""{2}""", options.ToOptionsString(), repo, directory);
            }
        }
Пример #12
0
        public override void Build(IBounce bounce)
        {
            DeleteIfExtant();
            IisWebSite webSite = Iis.CreateWebSite(Name.Value, ToInternalBindings(Bindings.Value), Path.GetFullPath(Directory.Value));

            SetupVirtualDirectory(webSite.VirtualDirectory);

            if (Started.Value)
            {
                webSite.Start();
            }
        }
Пример #13
0
        public override void Build(IBounce bounce)
        {
            string oldDirectory = Directory.GetCurrentDirectory();
            Directory.SetCurrentDirectory(WorkingDirectory.Value);

            try
            {
                bounce.ShellCommand.ExecuteAndExpectSuccess(Exe.Value, ArgumentsIfExists);
            } finally
            {
                Directory.SetCurrentDirectory(oldDirectory);
            }
        }
Пример #14
0
        protected override void BuildTask(IBounce bounce)
        {
            if (IsServiceInstalled(bounce)) {
                bounce.Log.Info("service {0} installed, deleting", Name.Value);
                DeleteService(bounce);
            }
            InstallService(bounce);

            if (IsServiceStartRequired.Value) {
                bounce.Log.Info("starting {0} service", Name.Value);
                StartService(bounce);
            }
        }
Пример #15
0
        public override void Build(IBounce bounce) {
            foreach (var file in Directory.GetFiles(".", Path.Value))
            {
                bounce.Log.Debug("deleting file: `{0}'", file);
                File.Delete(file);
            }

            foreach (var directory in Directory.GetDirectories(".", Path.Value))
            {
                bounce.Log.Debug("deleting directory: `{0}'", directory);
                DirectoryUtils.DeleteDirectory(directory);
            }
        }
Пример #16
0
        public override void Build(IBounce bounce)
        {
            var iisServer = new ServerManager();

            var existingSite = iisServer.Sites[Name.Value];
            if (!SiteUpToDate(existingSite)) {
                bounce.Log.Info("installing IIS website at: " + Directory.Value);
                RemoveWebSiteIfExtant(iisServer);
                iisServer.Sites.Add(Name.Value, Directory.Value, Port.Value);
                iisServer.CommitChanges();
            } else {
                bounce.Log.Info("IIS website already installed");
            }
        }
 public void ParseCommandLine(ParsedCommandLineParameters parsedParameters, IBounce bounce)
 {
     parsedParameters.IfParameterDo(LogLevelParameter, loglevel => bounce.LogOptions.LogLevel = ParseLogLevel(loglevel));
     parsedParameters.IfParameterDo(CommandOutputParameter, commandOutput => bounce.LogOptions.CommandOutput = ParseBoolOption(commandOutput));
     parsedParameters.IfParameterDo(LogFormatParameter, logformat => bounce.LogFactory = GetLogFactoryByName(logformat));
     parsedParameters.IfParameterDo(DescribeTasksParameter, descTasks => bounce.LogOptions.DescribeTasks = ParseBoolOption(descTasks));
     parsedParameters.IfParameterDo(LogFileParameter, logFileName =>
                                               {
                                                   var textWriter = File.AppendText(logFileName);
                                                   textWriter.AutoFlush = true;
                                                   bounce.LogOptions.StdOut = textWriter;
                                                   bounce.LogOptions.StdErr = textWriter;
                                               });
 }
        public string GenerateCommandLine(IBounce bounce)
        {
            var args = new List<string>();

            args.Add("/" + DescribeTasksParameter + ":" + bounce.LogOptions.DescribeTasks.ToString().ToLower());
            args.Add("/" + LogLevelParameter + ":" + bounce.LogOptions.LogLevel.ToString().ToLower());
            args.Add("/" + CommandOutputParameter + ":" + bounce.LogOptions.CommandOutput.ToString().ToLower());

            var logFormatName = LogFactoryRegistry.FindNameForLogFactory(bounce.LogFactory);
            if (logFormatName != null) {
                args.Add("/" + LogFormatParameter + ":" + logFormatName);
            }

            return String.Join(" ", args.ToArray());
        }
Пример #19
0
        public override void Build(IBounce bounce)
        {
            var output = bounce.ShellCommand.ExecuteAndExpectSuccess(NuGetExePath.Value, string.Format(@"pack ""{0}""", Spec.Value));

            var packageRegex = new Regex(@"Successfully created package '(.*)'.");

            var match = packageRegex.Match(output.Output);
            if (match.Success)
            {
                _packagePath = match.Groups[1].Value;
            } else
            {
                throw new TaskException(this, "could not parse package name");
            }
        }
Пример #20
0
        public override void Build(IBounce bounce)
        {
            IEnumerable<string> testDlls = DllPaths.Select(dll => dll.Value);
            string joinedTestDlls = "\"" + String.Join("\" \"", testDlls.ToArray()) + "\"";

            bounce.Log.Info("running unit tests for: " + joinedTestDlls);

            var args = new[]
            {
                Excludes,
                Includes,
                joinedTestDlls,
            };

            bounce.ShellCommand.ExecuteAndExpectSuccess(NUnitConsolePath.Value, String.Join(" ", args));
        }
Пример #21
0
        public override void Build(IBounce bounce)
        {
            var joinedTestDlls = "\"" + String.Join("\" \"", DllPaths.Value.ToArray()) + "\"";

            bounce.Log.Info("running unit tests for: " + joinedTestDlls);

            var args = new[]
            {
                Excludes,
                Includes,
                Framework,
                joinedTestDlls
            };

            bounce.ShellCommand.ExecuteAndExpectSuccess(NUnitConsolePath.Value, String.Join(" ", args));
        }
Пример #22
0
        protected override void BuildTask(IBounce bounce)
        {
            if (IsServiceInstalled(bounce) && !IsServiceStopped(bounce))
            {
                StopService(bounce);

                DateTime timeWhenAskedToStop = DateTime.Now;

                do
                {
                    Thread.Sleep(1000);

                    if (WaitedLongerThanTimeout(timeWhenAskedToStop))
                    {
                        throw new BounceException(String.Format("service {0} could not be stopped", Name));
                    }
                } while (!IsServiceStopped(bounce));

                Thread.Sleep(Wait.Value);
            }
        }
Пример #23
0
 public override void Clean(IBounce bounce)
 {
     CleanedWithBounce = bounce;
 }
Пример #24
0
 public override void Build(IBounce bounce)
 {
     BuiltWithBounce = bounce;
 }
Пример #25
0
 public override void Build(IBounce bounce)
 {
     Output.WriteLine(@"##teamcity[publishArtifacts '{0}']", ArtifactPath.Value);
 }
Пример #26
0
 public override void Build(IBounce bounce)
 {
     var cwd = Directory.GetCurrentDirectory();
     Directory.SetCurrentDirectory(WorkingDirectory.Value);
     try {
         bounce.ShellCommand.ExecuteAndExpectSuccess(@"bounce.exe", BounceArguments.Value);
     } finally {
         Directory.SetCurrentDirectory(cwd);
     }
 }
Пример #27
0
 public override void Clean(IBounce bounce)
 {
     Console.WriteLine("Cleaning {0}", Description.Value);
 }
Пример #28
0
 public override void Build(IBounce bounce)
 {
     bounce.ShellCommand.ExecuteAndExpectSuccess("cmd", "/c dir");
 }
Пример #29
0
 public override void Build(IBounce bounce)
 {
     bounce.ShellCommand.ExecuteAndExpectSuccess(@"VeryLongRunningConsole\bin\Debug\VeryLongRunningConsole", "");
 }
Пример #30
0
 public override void Build(IBounce bounce)
 {
     WasBuilt = true;
 }