コード例 #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
ファイル: UserModel.cs プロジェクト: jsuarezruiz/cydin
        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);
        }
コード例 #4
0
 public ActionResult Edit(int id, VcsSource source)
 {
     try
     {
         CurrentUserModel.UpdateSource (source, true);
         return RedirectToAction ("Index", new { projectId = source.ProjectId });
     }
     catch
     {
         return View();
     }
 }
コード例 #5
0
ファイル: UserModel.cs プロジェクト: jsuarezruiz/cydin
        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);
            }
        }
コード例 #6
0
ファイル: UserModel.cs プロジェクト: jsuarezruiz/cydin
        public VcsSource GetSource(int sourceId)
        {
            VcsSource s = db.SelectObjectById <VcsSource> (sourceId);

            if (s != null)
            {
                ValidateProject(s.ProjectId);
                return(s);
            }
            else
            {
                return(null);
            }
        }
コード例 #7
0
ファイル: UserModel.cs プロジェクト: jsuarezruiz/cydin
        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);
            }
        }
コード例 #8
0
ファイル: UserModel.cs プロジェクト: pabloescribano/cydin
        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);
        }
コード例 #9
0
ファイル: UserModel.cs プロジェクト: pabloescribano/cydin
 public void CreateSource(VcsSource source)
 {
     source.LastFetchTime = DateTime.Now.Subtract (TimeSpan.FromDays (1));
     db.InsertObject (source);
     BuildService.Build (CurrentApplication.Id, source.ProjectId);
 }
コード例 #10
0
ファイル: UserModel.cs プロジェクト: pabloescribano/cydin
        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;
        }
コード例 #11
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;
 }
コード例 #12
0
ファイル: UserModel.cs プロジェクト: jsuarezruiz/cydin
        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);
        }
コード例 #13
0
ファイル: UserModel.cs プロジェクト: jsuarezruiz/cydin
 public void CreateSource(VcsSource source)
 {
     source.LastFetchTime = DateTime.Now.Subtract(TimeSpan.FromDays(1));
     db.InsertObject(source);
     BuildService.Build(CurrentApplication.Id, source.ProjectId);
 }