예제 #1
0
        public ActionResult Build(string name)
        {
            string values = Request.Form.ToString();

            try
            {
                Log(string.Concat("Form: ", Request.Form.ToString()));
                IEnumerable <HookInfo> hi;
                if (!string.IsNullOrEmpty(name))
                {
                    hi = new List <HookInfo> {
                        new HookInfo {
                            Repository = new Repository {
                                Name = name
                            }, User = null
                        }
                    }
                }
                ;
                else
                {
                    var parser = new CodebaseHqHookParser();
                    hi = parser.Parse(Request.Form);
                }
                if (hi.Count() > 0)
                {
                    IBuildEngine engine = GetBuildEngine();
                    Log(string.Concat("Repository: ", hi.First().Repository.Name, "(", (hi.First().Branch ?? new Branch()).Name, ")"));
                    engine.ForceBuild(hi.First().Repository.Name, hi.First().Branch);
                }
                Log(Environment.NewLine);
            }
            catch (Exception ex)
            {
                Log(string.Concat("Error:", ex.Message));
                if (ex.InnerException != null)
                {
                    Log(string.Concat("Inner Error:", ex.InnerException.Message));
                }
                throw;
            }

            return((string.IsNullOrEmpty(name)) ? View() : (ActionResult)RedirectToAction("index"));
        }