示例#1
0
 public void Pull(string workingDirectory, ILog log, IBounce bounce)
 {
     using (new DirectoryChange(workingDirectory)) {
         log.Info("pulling git repo in: " + workingDirectory);
         Git(bounce, "pull");
     }
 }
示例#2
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");
            }
        }
示例#3
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");
            }
        }
示例#4
0
        private bool IsServiceStatus(IBounce bounce, string status)
        {
            Regex statePattern = new Regex(@"STATE\s+:\s+\d\s+" + status.ToUpper(), RegexOptions.IgnoreCase);
            var   queryOutput  = ExecuteSc(bounce, @"query ""{0}""", Name.Value).Output;

            return(statePattern.Match(queryOutput).Success);
        }
示例#5
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));
     }
 }
示例#6
0
 public void Pull(string workingDirectory, ILog log, IBounce bounce)
 {
     using (new DirectoryChange(workingDirectory)) {
         log.Info("pulling git repo in: " + workingDirectory);
         Git(bounce, "pull");
     }
 }
示例#7
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);
        }
示例#8
0
 public override void Clean(IBounce bounce)
 {
     if (SolutionExists)
     {
         bounce.Log.Info("cleaning solution at: " + SolutionPath.Value);
         bounce.ShellCommand.ExecuteAndExpectSuccess(MsBuildExe.Value, String.Format(@"/target:Clean ""{0}""", SolutionPath.Value));
     }
 }
示例#9
0
 public override void Build(IBounce bounce)
 {
     if (ServiceInstalled) {
         bounce.Log.Info("service {0} installed, deleting", Name.Value);
         DeleteService();
     }
     InstallService();
 }
示例#10
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");
     }
 }
示例#11
0
        public override void InvokeTask(IBounceCommand command, IBounce bounce)
        {
            _value = GetTasks(bounce);

            foreach (var task in _value)
            {
                bounce.Invoke(command, task);
            }
        }
示例#12
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);
        }
示例#13
0
文件: Copy.cs 项目: jdomzhang/bounce
        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);
        }
示例#14
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.");
 }
示例#15
0
文件: Copy.cs 项目: svoruganti/bounce
        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));
        }
示例#16
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);
     }
 }
示例#17
0
 public override void InvokeTask(IBounceCommand command, IBounce bounce)
 {
     if (IsDebug)
     {
         bounce.Log.Debug("{0}: {1}", Message.Value, Value.Value);
     }
     else
     {
         bounce.Log.Info("{0}: {1}", Message.Value, Value.Value);
     }
 }
示例#18
0
        private void InstallService(IBounce bounce)
        {
            System.Console.WriteLine("installing service {0}", Name.Value);

            ExecuteScAndExpectSuccess(bounce, @"create ""{0}"" binPath= ""{1}""{2}", Name.Value, Path.GetFullPath(BinaryPath.Value), GetSettings());

            if (Description != null && Description.Value != null)
            {
                ExecuteScAndExpectSuccess(bounce, @"description ""{0}"" ""{1}""", Name.Value, Description.Value);
            }
        }
示例#19
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);
            }
        }
示例#20
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);
            }
        }
示例#21
0
 public override IEnumerable <T> GetTasks(IBounce bounce)
 {
     if ((Condition.Value ^ Invert))
     {
         return(new[] { GetResult() });
     }
     else
     {
         return(new T[0]);
     }
 }
示例#22
0
 public override void Clean(IBounce bounce)
 {
     if (IsServiceInstalled(bounce))
     {
         bounce.Log.Info("service {0} installed, deleting", Name.Value);
         DeleteService(bounce);
     }
     else
     {
         bounce.Log.Info("service {0} not installed");
     }
 }
示例#23
0
        private string GetBounceArguments(IBounce bounce, IBounceCommand command)
        {
            var args = new List <string>();

            args.Add(LogOptionCommandLineTranslator.GenerateCommandLine(bounce));

            args.Add(command.CommandLineCommand);
            args.AddRange(Targets);
            args.Add(CommandLineTasksParametersGenerator.GenerateCommandLineParametersForTasks(bounce.ParametersGiven, Parameters));

            return(String.Join(" ", args.ToArray()));
        }
示例#24
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();
            }
        }
示例#25
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();
            }
        }
示例#26
0
文件: Delete.cs 项目: nbucket/bounce
        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);
            }
        }
示例#27
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);
            }
        }
示例#28
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);
            }
        }
示例#29
0
        public override void Invoke(IBounceCommand command, IBounce bounce)
        {
            IObsoleteTask action;

            if (Cases.TryGetValue(Condition.Value, out action))
            {
                bounce.Invoke(command, action);
            }
            else
            {
                throw new ConfigurationException(String.Format("no such case for `{0}'", Condition.Value));
            }
        }
示例#30
0
        public override void Build(IBounce bounce)
        {
            bounce.Log.Info("building solution at: " + SolutionPath.Value);

            var arguments = Arguments(
                "\"" + SolutionPath.Value + "\"",
                ConfigIfSpecified,
                OutputDirIfSpecified,
                TargetIfSpecified
                );

            bounce.ShellCommand.ExecuteAndExpectSuccess(MsBuildExe.Value, arguments);
        }
 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;
                                               });
 }
示例#32
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);
            }
        }
示例#33
0
        public override void Build(IBounce bounce)
        {
            var args = new[]
            {
                Register,
                Output,
                Target,
                TargetArgs,
                IncludedRules,
                ExcludedRules
            }.Where(arg => arg != "").ToArray();

            bounce.ShellCommand.ExecuteAndExpectSuccess(PartCoverPath.Value, String.Join(" ", args));
        }
 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;
     });
 }
示例#35
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");
            }
        }
示例#36
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);
            }
        }
示例#37
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);
            }
        }
示例#38
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
            {
                var options = GetCommandOptions();
                GitCommand.Clone(Repository.Value, WorkingDirectory, options, bounce.Log, bounce);
            }
        }
示例#39
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");
            }
        }
示例#40
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.");
     }
 }
        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());
        }
示例#42
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));
        }
示例#43
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));
        }
示例#44
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));
        }
        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()));
        }
示例#46
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");
            }
        }
示例#47
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);
            }
        }
示例#48
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);
            }
        }
示例#49
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);
     }
 }
示例#50
0
 public override void Clean(IBounce bounce)
 {
     Console.WriteLine("Cleaning {0}", Description.Value);
 }
示例#51
0
 public override void Clean(IBounce bounce)
 {
     Console.WriteLine("Cleaning {0}", Description.Value);
 }
示例#52
0
 public override void Build(IBounce bounce)
 {
     BuiltWithBounce = bounce;
 }
示例#53
0
 public override void Build(IBounce bounce)
 {
     WasBuilt = true;
 }
示例#54
0
 public override void Invoke(IBounceCommand command, IBounce bounce)
 {
     base.Invoke(command, bounce);
     Invoked = true;
 }
示例#55
0
 public override void Build(IBounce bounce)
 {
     bounce.ShellCommand.ExecuteAndExpectSuccess(@"VeryLongRunningConsole\bin\Debug\VeryLongRunningConsole", "");
 }
示例#56
0
 public override void Build(IBounce bounce)
 {
     bounce.ShellCommand.ExecuteAndExpectSuccess(@"VeryLongRunningConsole\bin\Debug\VeryLongRunningConsole", "");
 }
示例#57
0
 public override void Build(IBounce bounce)
 {
     Output.WriteLine(@"##teamcity[publishArtifacts '{0}']", ArtifactPath.Value);
 }
示例#58
0
 public override void Build(IBounce bounce)
 {
     bounce.ShellCommand.ExecuteAndExpectSuccess("cmd", "/c dir");
 }
示例#59
0
 public override void Clean(IBounce bounce)
 {
     CleanedWithBounce = bounce;
 }
示例#60
0
 public override void Build(IBounce bounce)
 {
     bounce.ShellCommand.ExecuteAndExpectSuccess("cmd", "/c dir");
 }