public void CopyPortalItemsToTarget(ShadowCopyItemCollection deploymentItems) { IDeploymentTarget target = DeploymentTargetConfigurationManager.GetMappedTarget(_target.TargetType); string deploymentPath = target.GetDeploymentPath(_target, _targetPortal); if (string.IsNullOrEmpty(deploymentPath)) return; for (int i = 0; i < deploymentItems.Count; i++) { IShadowCopyItem item = deploymentItems[i]; LazyShadowCopyItem lazyItem = item as LazyShadowCopyItem; FileInfo targetFile = new FileInfo(System.IO.Path.Combine(deploymentPath, item.Url)); if (ItemNeedsToBeDeployed(item, targetFile)) { string targetPath = System.IO.Path.Combine(deploymentPath.TrimEnd('\\'), item.Url); IFileInfo file = FileSystem.GetFileInfo(targetPath); if (!file.Directory.Exists) file.Directory.Create(); if (lazyItem != null) { FSFile.Copy(FileSystem.GetFileInfo(lazyItem.FullPath), file, true); } else { using (Stream writeStream = file.Open(FileMode.Create, FileAccess.Write)) { FSFile.CopyStream(item.Data, writeStream); } } } } }
private ShadowCopyItemCollection GetAllDeployables() { const string CONST_APPCONFIGFILE = "application.xml"; ShadowCopyItemCollection results = new ShadowCopyItemCollection(); ReportProgress(Resources.GatheringDeploymentFiles); //Application Configuration CallWithTiming("Generating application.xml", () => { Stream appConfigStream = (Stream) CallPrivateMethod("ToApplicationConfigFile", new object[] { _portal }); results.Add(new ShadowCopyItem(CONST_APPCONFIGFILE, appConfigStream)); }); CallWithTiming("Getting support files", () => AddSupportFilesToDeployables(results)); CallWithTiming("Getting navitems", () => CallPrivateMethod("AddNavItemsToDeployables", new object[] { _portal, false, results, _worker })); CallWithTiming("Getting menu items", () => CallPrivateMethod("AddMenuItemsToDeployables", new object[] { _portal, false, results, _worker })); CallWithTiming("Getting pages", () => AddPagesToDeployables(results)); CallWithTiming("Getting smart part mappings", () => CallPrivateMethod("AddSmartPartMappingsToDeployables", new object[] { _portal, results, _worker })); CallWithTiming("Getting resources", () => CallPrivateMethod("AddResourcesToDeployables", new object[] { _portal, results, _worker })); return results; }
private void AddSupportFilesToDeployables(ShadowCopyItemCollection deployables) { if (ThisPortalWasAlreadyDeployedDuringThisSession()) { var changes = (List<string>) _workItem.State["FilesChangedSinceLastQuickDeploy"]; var supportFileChanges = changes.Where(url => url.StartsWith(_portal.SupportFilesDefinition.ResolvedProjectPath)); foreach (string url in supportFileChanges) { var file = _portal.FilePath.DriveInfo.GetFileInfo(url); var trimPosition = url.IndexOf("SupportFiles"); var relativeUrl = url.Substring(trimPosition + "SupportFiles".Length + 1); if (file.Exists) deployables.Add(new LazyShadowCopyItem(url, relativeUrl)); } return; } LinkedFile[] supportFiles = _portal.SupportFiles.GetFiles(true); foreach (LinkedFile item in supportFiles) { string relativeUrl = _manager.SupportFilePathToAppRelativePath(item.ProjectPath); //if (PortalUtil.IsShadowCopyFile(item.ProjectPath) && item.Source.Exists) if (item.Source.Exists) deployables.Add(new LazyShadowCopyItem(item.Source.FullName, relativeUrl)); } }
private bool DeployTarget(ShadowCopyItemCollection deploymentItems) { bool result = false; string path = _target.GetFolderName(_targetPortal); if (!string.IsNullOrEmpty(path)) { // Copy the files to the target ReportProgress(Resources.Status_Copy_Target_Files); CopyPortalItemsToTarget(deploymentItems); try { JSBuilderAction action = new JSBuilderAction(); action.Execute(path); } catch (Exception) { } result = true; } //else // OutputError(Resources.Info_Target_Folder_Is_Invalid); return result; }
private void AddPagesToDeployables(ShadowCopyItemCollection deployables) { var pageGen = new QuickPageGenerator(_portal.Project); foreach (PortalPage page in _portal.AllPages) { page.Validate(true); IShadowCopyProvider provider = new QuickPageGenerationProvider(pageGen, page, _portal); deployables.AddRange(provider.GetItems(_worker)); } }