public ActionResult Post(NewDeploy deploy) { ConventNewDeployToDeploy(deploy); var repository = new DeployRepository(); repository.Update(deploy); return JsonNet(new { success = true }); }
public void ExportCurrentMonth() { var now = DateTime.Now; var repo = new DeployRepository(); var deploys = repo.Collection.FindAll().Where(x => !x.DateDeleted.HasValue && x.DeployTime.HasValue && x.DeployTime.Value.Month == now.Month && x.DeployTime.Value.Year == now.Year).ToList(); WriteTsv(deploys, String.Format("CurrentDeploys{0}{1}.tsv", CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(now.Month), now.Year)); }
public ActionResult NewDeploy(NewDeploy deploy) { ConventNewDeployToDeploy(deploy); deploy.DeployTime = DateTime.Now; var repository = new DeployRepository(); repository.Add(deploy); return JsonNet(new { success = true }); }
public ActionResult GetAll() { var repository = new DeployRepository(); return JsonNet(new Deploys { Items = repository.GetSince(DateTime.UtcNow.AddYears(-1000), Int32.MaxValue).ToArray() }); }
public ActionResult Get() { var repository = new DeployRepository(); return JsonNet(new Deploys { Items = repository.GetSince(DateTime.UtcNow.AddMonths(-2), MaxReturnSize).Where(x => x.DateDeleted == null).ToArray() }); }
static void Main(string[] args) { var repo = new DeployRepository(); var deploys = repo.Collection.FindAll().ToList(); using (var csv = new CsvWriter(new StreamWriter("black-mesa.tsv"))) { csv.Configuration.Delimiter = "\t"; csv.WriteRecords<Deploy>(deploys); } }
public void ExportLastMonth() { var now = DateTime.Now; var isJanuary = now.Month - 1 == 0; var month = isJanuary ? 12 : now.Month - 1; var year = isJanuary ? now.Year - 1 : now.Year; var repo = new DeployRepository(); var deploys = repo.Collection.FindAll().Where(x => !x.DateDeleted.HasValue && x.DeployTime.HasValue && x.DeployTime.Value.Month == month && x.DeployTime.Value.Year == year).ToList(); WriteTsv(deploys, String.Format("Deploys{0}{1}.tsv", CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(month), year)); }
public void Should_get_latest_delta_as_no_delta_when_the_database_is_fresh() { const string connectionString = "xcc://*****:*****@localhost:9001"; DeleteTheLatestDeltaInTheDatabase(); Delta latestDelta = new DeployRepository(connectionString, null).GetLatestDeltaInDatabase(); Assert.IsInstanceOf(typeof(NoDelta), latestDelta); }
public void Should_get_latest_delta_when_there_is_an_existing_delta_in_the_database_without_any_description() { const string connectionString = "xcc://*****:*****@localhost:9001"; SetupLatestDeltaAs(10L); Delta latestDelta = new DeployRepository(connectionString, null).GetLatestDeltaInDatabase(); Assert.That(typeof(Delta) == latestDelta.GetType()); Assert.AreEqual(10L, latestDelta.Number); Assert.AreEqual(string.Empty, latestDelta.Description); DeleteTheLatestDeltaInTheDatabase(); }
public ActionResult Delete(string id) { var repository = new DeployRepository(); var first = repository.FirstOrDefault(x => x.Id == id); if (first != null) { log.InfoFormat("Deleting {0}\n{1}", first.Id, first.ToJson()); first.DateDeleted = DateTime.UtcNow; repository.Update(first); } return JsonNet(new { success = true }); }
public void ExportAllTime() { var repo = new DeployRepository(); var deploys = repo.Collection.FindAll().Where(x => !x.DateDeleted.HasValue).ToList(); WriteTsv(deploys, "AllTimeDeploys.tsv"); }
static void Main(string[] args) { Console.WriteLine("Do you have the latest deploy_doc.csv and hotfix_doc.csv in the folder than this exe is in? Press enter when you do"); Console.Read(); var deploys = doDeployDoc(); var hotfixes = doHotfixDoc(); var finalDeploys = new List<Deploy>(); foreach (var deploy in deploys) { var desArray = cleanName(deploy.DES).Split('/'); var devArray = cleanName(deploy.DEV).Split('/'); var crArray = cleanName(deploy.DEVCR).Split('/'); var pmArray = cleanName(deploy.PM).Split('/'); var qaArray = cleanName(deploy.QA).Split('/'); int index = 0; foreach (string name in desArray) { insertIntoNameArray(name, desArray, index); index++; } index = 0; foreach (string name in devArray) { insertIntoNameArray(name, devArray, index); index++; } index = 0; foreach (string name in crArray) { insertIntoNameArray(name, crArray, index); index++; } index = 0; foreach (string name in pmArray) { insertIntoNameArray(name, pmArray, index); index++; } index = 0; foreach (string name in qaArray) { insertIntoNameArray(name, qaArray, index); index++; } finalDeploys.Add(new Deploy { Action = deploy.ACTION.Trim(), Branch = deploy.BRANCH.Trim(), Component = deploy.COMPONENT.Trim(), DeployTime = deploy.DATE_TIME.Trim().TryParseDateTime(), LineNumber = deploy.ID, Notes = deploy.NOTES, Project = deploy.PROJECT.Trim(), PullRequestId = deploy.PR.Trim().TryParseInt(), Type = deploy.TYPE.Trim(), People = new People { Designers = desArray.ToList(), Developers = devArray.ToList(), CodeReviewers = crArray.ToList(), ProjectManagers = pmArray.ToList(), Quails = qaArray.ToList(), }, }); } var i = 0; foreach (var hotfix in hotfixes) { Deploy deploy = null; if (hotfix.BRANCH.ToLower().Contains("(2nd pr)")) { hotfix.BRANCH = hotfix.BRANCH.ToLower().Replace("(2nd pr)", "").Trim(); deploy = finalDeploys.Where(d => d.Branch.ToLower().Trim().Equals(hotfix.BRANCH.ToLower().Trim())).LastOrDefault(); } else { deploy = finalDeploys.Where(d => d.Branch.ToLower().Trim().Equals(hotfix.BRANCH.ToLower().Trim())).FirstOrDefault(); } if (deploy == null) { Console.WriteLine("NO MATCH!! -- Line: " + (Int32.Parse(hotfix.ID) + 17) + " - HF Branch: " + hotfix.BRANCH); i++; } else { deploy.Hotfixes.Add(new Hotfix { BranchThatBrokeIt = hotfix.Breaker_Branch.Trim(), Notes = hotfix.Notes, ProdTicket = hotfix.PROD_Ticket_Num.Trim().TryParseInt(), Special = hotfix.SPECIAL, Ticket = hotfix.TICKET, Assessments = new Assessments { Developers = new Assessment { Culpability = hotfix.DEV_Team_Culpability.Trim().TryParseDecimal(), HudlWideImpact = hotfix.DEV_Hudl_Wide_Impact.Trim().TryParseDecimal(), AffectedUserImpact = hotfix.DEV_Affected_User_Impact.Trim().TryParseDecimal(), Initials = hotfix.DEV_Initials.Trim(), }, Quails = new Assessment { Culpability = hotfix.QA_Team_Culpability.Trim().TryParseDecimal(), HudlWideImpact = hotfix.QA_Hudl_Wide_Impact.Trim().TryParseDecimal(), AffectedUserImpact = hotfix.QA_Affected_User_Impact.Trim().TryParseDecimal(), Initials = hotfix.QA_Initials.Trim(), } } }); } } Console.WriteLine(i + " unmatched hotfixes"); var repo = new DeployRepository(); i = 0; foreach (Deploy d in finalDeploys) { Console.WriteLine("Updating Entry " + ++i +" of " + finalDeploys.Count); repo.Upsert(d); } }
public DeployPage(Program program) : base("Efetuar deploy", program, new Option("WTE", () => DeployRepository.DeployWTE()), new Option("3J", () => program.NavigateTo <DeployPage>())) { }