Пример #1
0
 public ActionResult CreateInitial(int projectId)
 {
     ViewData["Creating"] = true;
     ViewData["CreatingProject"] = true;
     VcsSource s = new VcsSource ();
     s.ProjectId = projectId;
     return View ("Edit", s);
 }
Пример #2
0
 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 });
 }
Пример #3
0
 public ActionResult Edit(int id, VcsSource source)
 {
     try
     {
         CurrentUserModel.UpdateSource (source, true);
         return RedirectToAction ("Index", new { projectId = source.ProjectId });
     }
     catch
     {
         return View();
     }
 }
Пример #4
0
        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);
        }
Пример #5
0
 public void CreateSource(VcsSource source)
 {
     source.LastFetchTime = DateTime.Now.Subtract (TimeSpan.FromDays (1));
     db.InsertObject (source);
     BuildService.Build (CurrentApplication.Id, source.ProjectId);
 }
Пример #6
0
        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;
        }
Пример #7
0
 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;
 }