public ActionResult CreateInitial(int projectId) { ViewData["Creating"] = true; ViewData["CreatingProject"] = true; VcsSource s = new VcsSource (); s.ProjectId = projectId; return View ("Edit", s); }
public ActionResult Create(VcsSource source, bool? initialCreation) { CurrentUserModel.CreateSource (source); if (initialCreation.HasValue && initialCreation.Value) return RedirectToAction ("Index", "Project", new { id = source.ProjectId }); else return RedirectToAction ("Index", new { projectId = source.ProjectId }); }
internal void SetSourceStatus(int id, string status, string message) { VcsSource s = GetSource(id); s.Status = status; if (message != null) { s.ErrorMessage = message; } db.UpdateObject(s); }
public ActionResult Edit(int id, VcsSource source) { try { CurrentUserModel.UpdateSource (source, true); return RedirectToAction ("Index", new { projectId = source.ProjectId }); } catch { return View(); } }
public void DeleteSource(int id) { VcsSource s = db.SelectObjectById <VcsSource> (id); if (s != null) { ValidateProject(s.ProjectId); foreach (SourceTag st in GetVcsSourceTags(s.Id)) { DeleteSourceTag(st); } db.DeleteObject(s); } }
public VcsSource GetSource(int sourceId) { VcsSource s = db.SelectObjectById <VcsSource> (sourceId); if (s != null) { ValidateProject(s.ProjectId); return(s); } else { return(null); } }
public void UpdateSource(VcsSource s, bool rebuild) { VcsSource os = db.SelectObjectById <VcsSource> (s.Id); db.UpdateObject(s); if (os.Directory != s.Directory) { foreach (SourceTag st in GetVcsSourceTags(s.Id)) { st.Status = SourceTagStatus.Waiting; db.UpdateObject(st); } } if (rebuild) { BuildService.Build(CurrentApplication.Id, os.ProjectId); } }
public void UpdateSource(VcsSource s, bool rebuild) { VcsSource os = db.SelectObjectById<VcsSource> (s.Id); db.UpdateObject (s); if (os.Directory != s.Directory) { foreach (SourceTag st in GetVcsSourceTags (s.Id)) { st.Status = SourceTagStatus.Waiting; db.UpdateObject (st); } } if (rebuild) BuildService.Build (CurrentApplication.Id, os.ProjectId); }
public void CreateSource(VcsSource source) { source.LastFetchTime = DateTime.Now.Subtract (TimeSpan.FromDays (1)); db.InsertObject (source); BuildService.Build (CurrentApplication.Id, source.ProjectId); }
SourceTag UploadRelease(int projectId, HttpPostedFileBase file, byte[] fileData, string appVersion, string[] platforms) { if (platforms.Length == 0) throw new Exception ("No platform selected"); VcsSource uploadSource = GetSources (projectId).Where (s => s.Type == "Upload").FirstOrDefault (); if (uploadSource == null) { uploadSource = new VcsSource (); uploadSource.ProjectId = projectId; uploadSource.Type = "Upload"; db.InsertObject (uploadSource); } SourceTag st = new SourceTag (); st.IsUpload = true; st.ProjectId = projectId; st.SourceId = uploadSource.Id; st.BuildDate = DateTime.Now; st.Name = "Upload"; st.Platforms = string.Join (" ", platforms); st.TargetAppVersion = appVersion; st.Status = SourceTagStatus.Ready; db.InsertObject (st); string filePath = null; if (!Directory.Exists (st.PackagesPath)) Directory.CreateDirectory (st.PackagesPath); if (platforms.Length == CurrentApplication.PlatformsList.Length) { filePath = Path.Combine (st.PackagesPath, "All.mpack"); if (file != null) file.SaveAs (filePath); else File.WriteAllBytes (filePath, fileData); } else { foreach (string plat in platforms) { filePath = Path.Combine (st.PackagesPath, plat + ".mpack"); if (file != null) file.SaveAs (filePath); else File.WriteAllBytes (filePath, fileData); } } AddinInfo mpack = ReadAddinInfo (filePath); st.AddinId = Addin.GetIdName (mpack.Id); st.AddinVersion = mpack.Version; db.UpdateObject (st); return st; }
public SourceInfo(Project p, VcsSource s, SourceTagInfo[] stags) { Id = s.Id; ProjectName = p.Name; ProjectId = p.Id; Type = s.Type; Url = s.Url; Tags = s.Tags; Branches = s.Branches; LastFetchTime = s.LastFetchTime; AutoPublish = s.AutoPublish; Directory = s.Directory; SourceTags = stags; ProjectFlags = p.Flags; }
SourceTag UploadRelease(int projectId, HttpPostedFileBase file, byte[] fileData, string appVersion, string[] platforms) { if (platforms.Length == 0) { throw new Exception("No platform selected"); } VcsSource uploadSource = GetSources(projectId).Where(s => s.Type == "Upload").FirstOrDefault(); if (uploadSource == null) { uploadSource = new VcsSource(); uploadSource.ProjectId = projectId; uploadSource.Type = "Upload"; db.InsertObject(uploadSource); } SourceTag st = new SourceTag(); st.IsUpload = true; st.ProjectId = projectId; st.SourceId = uploadSource.Id; st.BuildDate = DateTime.Now; st.Name = "Upload"; st.Platforms = string.Join(" ", platforms); st.TargetAppVersion = appVersion; st.Status = SourceTagStatus.Ready; db.InsertObject(st); string filePath = null; if (!Directory.Exists(st.PackagesPath)) { Directory.CreateDirectory(st.PackagesPath); } if (platforms.Length == CurrentApplication.PlatformsList.Length) { filePath = Path.Combine(st.PackagesPath, "All.mpack"); if (file != null) { file.SaveAs(filePath); } else { File.WriteAllBytes(filePath, fileData); } } else { foreach (string plat in platforms) { filePath = Path.Combine(st.PackagesPath, plat + ".mpack"); if (file != null) { file.SaveAs(filePath); } else { File.WriteAllBytes(filePath, fileData); } } } AddinInfo mpack = ReadAddinInfo(filePath); st.AddinId = Addin.GetIdName(mpack.Id); st.AddinVersion = mpack.Version; db.UpdateObject(st); return(st); }
public void CreateSource(VcsSource source) { source.LastFetchTime = DateTime.Now.Subtract(TimeSpan.FromDays(1)); db.InsertObject(source); BuildService.Build(CurrentApplication.Id, source.ProjectId); }