//public ActionResult Upgrade(string packageId, string source) //{ // try { // var projectManager = GetProjectManagers().Where(p => p.SourceRepository.Source == source).First(); // projectManager.addLog("Starting update..."); // IPackage installedPackage = GetInstalledPackage(projectManager, packageId); // IPackage update = projectManager.GetUpdate(installedPackage); // projectManager.UpdatePackage(update); // projectManager.addLog("Waiting to Reload Site"); // var logger = (string)System.Web.HttpContext.Current.Application["NugetLogger"]; // return Json(new { // msg = "Updated " + packageId + " to " + update.Version.ToString() + "!", // updated = true, NugetLog = logger // }, JsonRequestBehavior.AllowGet); // } catch (Exception exc) { // ErrorHandler.Publish(LogLevel.Error, exc); // return Json(new { // msg = "Error updating " + packageId, // updated = false // }, JsonRequestBehavior.AllowGet); // } //} //public ActionResult DelayedUpgrade(string packageId, string source, string version) //{ // SelfUpdaterEntities context = new SelfUpdaterEntities(); // var entity = context.SelfUpdatingPackages.Where(d => d.PackageId == packageId).FirstOrDefault(); // if (entity == default(SelfUpdatingPackages)) { // entity = new SelfUpdatingPackages() { // PackageId = packageId, // Source = source, // PackageVersion = version // }; // context.SelfUpdatingPackages.AddObject(entity); // context.SaveChanges(); // } // return Json(new { // msg = "Package " + packageId + " scheduled to update!", // res = true // }, JsonRequestBehavior.AllowGet); //} //public ActionResult RemoveDelayedUpgrade(string packageId) //{ // SelfUpdaterEntities context = new SelfUpdaterEntities(); // var entity = context.SelfUpdatingPackages.Where(d => d.PackageId == packageId).FirstOrDefault(); // if (entity != default(SelfUpdatingPackages)) { // context.SelfUpdatingPackages.DeleteObject(entity); // context.SaveChanges(); // return Json(new { // msg = "Package " + packageId + " unscheduled!", // res = true // }, JsonRequestBehavior.AllowGet); // } else { // return Json(new { // msg = "Package " + packageId + " unscheduled!", // res = false // }, JsonRequestBehavior.AllowGet); // } //} //[AcceptVerbs(HttpVerbs.Post)] //public void RestartSite() //{ // if (PortalSecurity.IsInRole("Admins")) { // /*Forcing site restart*/ // var doc = new XmlDocument(); // doc.PreserveWhitespace = true; // var configFile = Server.MapPath("~/web.config"); // doc.Load(configFile); // var writer = new XmlTextWriter(configFile, Encoding.UTF8) { Formatting = Formatting.Indented }; // doc.Save(writer); // writer.Flush(); // writer.Close(); // /*....................*/ // } //} //public ActionResult Status() //{ // var logger = (string)System.Web.HttpContext.Current.Application["NugetLogger"]; // if (logger == null || logger.Equals(string.Empty)) { // return Json(true); // } // else { // return Json(false); // } //} private IPackage GetInstalledPackage(WebProjectManager projectManager, string packageId) { IPackage package = projectManager.GetInstalledPackages(false).Where(d => d.Id == packageId).FirstOrDefault(); if (package == null) { throw new InvalidOperationException(string.Format("The package for package ID '{0}' is not installed in this website. Copy the package into the App_Data/packages folder.", packageId)); } return(package); }
//public ActionResult Upgrade(string packageId, string source) //{ // try { // var projectManager = GetProjectManagers().Where(p => p.SourceRepository.Source == source).First(); // projectManager.addLog("Starting update..."); // IPackage installedPackage = GetInstalledPackage(projectManager, packageId); // IPackage update = projectManager.GetUpdate(installedPackage); // projectManager.UpdatePackage(update); // projectManager.addLog("Waiting to Reload Site"); // var logger = (string)System.Web.HttpContext.Current.Application["NugetLogger"]; // return Json(new { // msg = "Updated " + packageId + " to " + update.Version.ToString() + "!", // updated = true, NugetLog = logger // }, JsonRequestBehavior.AllowGet); // } catch (Exception exc) { // ErrorHandler.Publish(LogLevel.Error, exc); // return Json(new { // msg = "Error updating " + packageId, // updated = false // }, JsonRequestBehavior.AllowGet); // } //} //public ActionResult DelayedUpgrade(string packageId, string source, string version) //{ // SelfUpdaterEntities context = new SelfUpdaterEntities(); // var entity = context.SelfUpdatingPackages.Where(d => d.PackageId == packageId).FirstOrDefault(); // if (entity == default(SelfUpdatingPackages)) { // entity = new SelfUpdatingPackages() { // PackageId = packageId, // Source = source, // PackageVersion = version // }; // context.SelfUpdatingPackages.AddObject(entity); // context.SaveChanges(); // } // return Json(new { // msg = "Package " + packageId + " scheduled to update!", // res = true // }, JsonRequestBehavior.AllowGet); //} //public ActionResult RemoveDelayedUpgrade(string packageId) //{ // SelfUpdaterEntities context = new SelfUpdaterEntities(); // var entity = context.SelfUpdatingPackages.Where(d => d.PackageId == packageId).FirstOrDefault(); // if (entity != default(SelfUpdatingPackages)) { // context.SelfUpdatingPackages.DeleteObject(entity); // context.SaveChanges(); // return Json(new { // msg = "Package " + packageId + " unscheduled!", // res = true // }, JsonRequestBehavior.AllowGet); // } else { // return Json(new { // msg = "Package " + packageId + " unscheduled!", // res = false // }, JsonRequestBehavior.AllowGet); // } //} //[AcceptVerbs(HttpVerbs.Post)] //public void RestartSite() //{ // if (PortalSecurity.IsInRole("Admins")) { // /*Forcing site restart*/ // var doc = new XmlDocument(); // doc.PreserveWhitespace = true; // var configFile = Server.MapPath("~/web.config"); // doc.Load(configFile); // var writer = new XmlTextWriter(configFile, Encoding.UTF8) { Formatting = Formatting.Indented }; // doc.Save(writer); // writer.Flush(); // writer.Close(); // /*....................*/ // } //} //public ActionResult Status() //{ // var logger = (string)System.Web.HttpContext.Current.Application["NugetLogger"]; // if (logger == null || logger.Equals(string.Empty)) { // return Json(true); // } // else { // return Json(false); // } //} private IPackage GetInstalledPackage(WebProjectManager projectManager, string packageId) { IPackage package = projectManager.GetInstalledPackages(false).Where(d => d.Id == packageId).FirstOrDefault(); if (package == null) { throw new InvalidOperationException(string.Format("The package for package ID '{0}' is not installed in this website. Copy the package into the App_Data/packages folder.", packageId)); } return package; }
private IEnumerable<IPackage> GetInstalledPackages(WebProjectManager projectManager) { var packages = projectManager.GetInstalledPackages(true); return packages; }
protected List<IPackage> GetAvailablePackages(WebProjectManager projectManager) { var packages = projectManager.GetRemotePackages().ToList(); return packages; }
protected List<IPackage> GetInstalledPackages(WebProjectManager projectManager) { var packages = projectManager.GetInstalledPackages(false).ToList(); return packages; }
public static List<IPackage> GetInstalledPackagesLatestList(WebProjectManager projectManager, bool filterTags) { var installedPackages = GetInstalledPackages(projectManager, filterTags); var packagesList = installedPackages.GroupBy(x => x.Id); return packagesList.Select(pack => pack.Single(y => y.Version == pack.Max(x => x.Version))).ToList(); }
public static List<IPackage> GetInstalledPackages(WebProjectManager projectManager, bool filterTags) { var packages = projectManager.GetInstalledPackages(filterTags).ToList(); return packages; }
public static List<IPackage> GetAvailablePackagesLatestList(WebProjectManager projectManager) { var availablePackages = GetAvailablePackages(projectManager); return availablePackages.GroupBy(x => x.Id).Select(pack => pack.Single(y => y.Version == pack.Max(x => x.Version))).ToList(); }
protected List <IPackage> GetAvailablePackages(WebProjectManager projectManager) { var packages = projectManager.GetRemotePackages().ToList(); return(packages); }
protected List <IPackage> GetInstalledPackages(WebProjectManager projectManager) { var packages = projectManager.GetInstalledPackages(false).ToList(); return(packages); }