private void ForceReCrawl() { Log.Info("(Hidden feature) Forcing recrawl of rootsite and all subsites"); var deployManager = new DeployManager(_urlToSite, _credentials, _isSharePointOnline); deployManager.ForceRecrawl(); }
internal async Task DeployMono(OleMenuCommand menuCommand) { try { string teamNumber = Package.GetTeamNumber(); if (teamNumber == null) { return; } //Disable Install Button m_installing = true; menuCommand.Visible = false; DeployManager m = new DeployManager(Package.PublicGetService(typeof(DTE)) as DTE); MonoDeploy deploy = new MonoDeploy(teamNumber, m, m_monoFile); await deploy.DeployMono(); m_installing = false; menuCommand.Visible = true; } catch (Exception ex) { Output.WriteLine(ex.ToString()); m_installing = false; menuCommand.Visible = true; } }
protected override async Task ButtonCallbackAsync(object sender, EventArgs e) { await ThreadHelperExtensions.SwitchToUiThread(); var menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } if (!Deploying) { try { Output.ProgressBarLabel = "Deploying Robot Code"; await OutputWriter.Instance.ClearAsync().ConfigureAwait(false); string teamNumber = await Package.GetTeamNumberAsync().ConfigureAwait(false); if (teamNumber == null) { return; } //Disable the deploy buttons await DisableAllButtonsAsync().ConfigureAwait(false); await ThreadHelperExtensions.SwitchToUiThread(); bool success = false; using (DeployManager m = new DeployManager(Package.PublicGetService <DTE>())) { success = await m.DeployCodeAsync(teamNumber, DebugButton, m_robotProject).ConfigureAwait(false); } await EnableAllButtonsAsync().ConfigureAwait(false); Output.ProgressBarLabel = success ? "Robot Code Deploy Successful" : "Robot Code Deploy Failed"; } catch (SshConnectionException) { await Output.WriteLineAsync("Connection to RoboRIO lost. Deploy aborted.").ConfigureAwait(false); await ThreadHelperExtensions.SwitchToUiThread(); await EnableAllButtonsAsync().ConfigureAwait(true); Output.ProgressBarLabel = "Robot Code Deploy Failed"; } catch (Exception ex) { await Output.WriteLineAsync(ex.ToString()).ConfigureAwait(false); await ThreadHelperExtensions.SwitchToUiThread(); await EnableAllButtonsAsync().ConfigureAwait(true); Output.ProgressBarLabel = "Robot Code Deploy Failed"; } } }
public SingleExampleViewModel() { this.deployManager = new DeployManager(); this.CurrentExampleResource = new ObservableCollection<string>(); ExampleLoader.Instance.Initialize(this.Data, this.deployManager); ExampleLoader.Instance.PropertyChanged += OnExampleLoaderPropertyChanged; ExampleLoader.Instance.ExampleInstantiated += OnExampleLoaderExampleInstantiated; }
public void SetUp() { deployerMock = new DynamicMock(typeof(IDeployer)); deployerMock.Strict = false; deployer = (IDeployer)deployerMock.Object; deployLocation = new MyDeploy(); deployManager = new DeployManager(new DirectExecutor(), new NullSpringDeployer(), deployLocation, deployer); }
public void SetUp() { springAssembliesDeployer = new SpringAssembliesDeployer("."); location = new FileSystemDeployLocation(deployPath); location.StartWatching(); sync = new Latch(); defaultDeployer = new SyncedDeployer(sync); deployManager = new DeployManager(springAssembliesDeployer, location, defaultDeployer); deployManager.Start(); }
private void Awake() { // Déclaration du singleton if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } }
protected void btnCreate_Click(object sender, EventArgs e) { var spContext = SharePointContextProvider.Current.GetSharePointContext(Context); var clientContext = spContext.CreateUserClientContextForSPHost(); //check if we should create site collection or subsite Microsoft.SharePoint.Client.Web newWeb = null; if (Page.Request["IsDlg"].Contains("1")) { newWeb = new DeployManager().CreateSiteCollection( Page.Request["SPHostUrl"], txtUrl.Text, listSites.SelectedValue, txtTitle.Text, txtDescription.Text, clientContext, this, this.Configuration); //update the client context var newWebUri = new Uri(newWeb.Url); var token = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, newWebUri.Authority, TokenHelper.GetRealmFromTargetUrl(newWebUri)).AccessToken; clientContext = TokenHelper.GetClientContextWithAccessToken(newWeb.Url, token); newWeb = clientContext.Web; clientContext.Load(newWeb); clientContext.ExecuteQuery(); } else { newWeb = new DeployManager().CreateSubSite( txtUrl.Text, listSites.SelectedValue, txtTitle.Text, txtDescription.Text, clientContext, this, this.Configuration); } //Call Provision on each provisioning module foreach (Control ctrl in pnlModules.Controls) { if (ctrl is BaseProvisioningModule) { ((BaseProvisioningModule)ctrl).Provision(clientContext, newWeb); } } //dispose the clientContext clientContext.Dispose(); if (Page.Request["IsDlg"].Contains("1")) { //redirect to new site ScriptManager.RegisterClientScriptBlock(this, typeof(Default), "RedirectToSite", "navigateParent('" + newWeb.Url + "');", true); } else { // Redirect to just created site Response.Redirect(newWeb.Url); } }
private void UploadAndActivateAllSandboxSolutions(ClientContext context) { Log.Info("Uploading and activating sandboxed solution(s)"); var deployManager = new DeployManager(_urlToSite, _credentials, _isSharePointOnline); var solutionPackages = Directory.GetFiles(SolutionsDirectoryPath, "*.wsp", SearchOption.AllDirectories); if (!deployManager.IsCurrentUserSiteCollectionAdmin(context)) { Log.Fatal("You need to be site collection administrator to perform this operation."); return; } foreach (var file in solutionPackages) { UploadAndActivatePackage(context, deployManager, file); } Log.Info("Done uploading and activating sandboxed solution(s)"); }
public override async void ButtonCallback(object sender, EventArgs e) { var menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } if (!Deploying) { try { Output.ProgressBarLabel = "Deploying Robot Code"; OutputWriter.Instance.Clear(); string teamNumber = Package.GetTeamNumber(); if (teamNumber == null) { return; } //Disable the deploy buttons DisableAllButtons(); DeployManager m = new DeployManager(Package.PublicGetService(typeof(DTE)) as DTE); bool success = await m.DeployCode(teamNumber, DebugButton, m_robotProject); EnableAllButtons(); Output.ProgressBarLabel = success ? "Robot Code Deploy Successful" : "Robot Code Deploy Failed"; } catch (SshConnectionException) { Output.WriteLine("Connection to RoboRIO lost. Deploy aborted."); EnableAllButtons(); Output.ProgressBarLabel = "Robot Code Deploy Failed"; } catch (Exception ex) { Output.WriteLine(ex.ToString()); EnableAllButtons(); Output.ProgressBarLabel = "Robot Code Deploy Failed"; } } }
public void UploadAndActivateSandboxSolution() { if (!IsCurrentUserSiteCollectionAdmin()) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("You need to be site collection administrator to perform this operation."); Console.ResetColor(); } else { Console.WriteLine("Uploading and activating sandboxed solution(s)"); var deployManager = new DeployManager(_urlToSite, _credentials, _isSharePointOnline); foreach (var file in Directory.GetFiles(SolutionsDirectoryPath, "*.wsp", SearchOption.AllDirectories)) { deployManager.UploadDesignPackageToSiteAssets(file); deployManager.ActivateDesignPackage(file, "SiteAssets"); } Console.WriteLine("Done uploading and activating sandboxed solution(s)"); } }
/// <summary> /// This function is called when the NetConsole button is pressed. /// </summary> protected override async Task ButtonCallbackAsync(object sender, EventArgs e) { await DeployManager.StartNetConsoleAsync().ConfigureAwait(false); }
public MonoDeploy(string teamNumber, DeployManager deployManager, MonoFile monoFile) { m_deployManager = deployManager; m_teamNumber = teamNumber; m_monoFile = monoFile; }
public void ForceReCrawl() { var deployManager = new DeployManager(_urlToSite, _credentials, _isSharePointOnline); deployManager.ForceRecrawl(); }
public override async void ButtonCallback(object sender, EventArgs e) { var menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } if (!m_killing) { try { string teamNumber = Package.GetTeamNumber(); if (teamNumber == null) { return; } DeployManager m = new DeployManager(Package.PublicGetService(typeof(DTE)) as DTE); var writer = OutputWriter.Instance; menuCommand.Visible = false; m_killing = true; //Connect to RoboRIO writer.WriteLine("Attempting to Connect to RoboRIO"); Task <bool> rioConnectionTask = m.StartConnectionTask(teamNumber); Task delayTask = Task.Delay(10000); //Successfully extracted files. writer.WriteLine("Waiting for Connection to Finish"); if (await Task.WhenAny(rioConnectionTask, delayTask) == rioConnectionTask) { //Connected if (rioConnectionTask.Result) { writer.WriteLine("Killing currently running robot code."); await RoboRIOConnection.RunCommand(DeployProperties.KillOnlyCommand, ConnectionUser.LvUser); writer.WriteLine("Done."); m_killing = false; menuCommand.Visible = true; } else { //Did not successfully connect writer.WriteLine("Failed to Connect to RoboRIO. Exiting."); m_killing = false; menuCommand.Visible = true; } } else { //Timedout writer.WriteLine("RoboRIO connection timedout. Exiting."); m_killing = false; menuCommand.Visible = true; } } catch (Exception ex) { Output.WriteLine(ex.ToString()); m_killing = false; menuCommand.Visible = true; OutputWriter.Instance.WriteLine("Code Kill Failed"); } } }
private static void UploadAndActivatePackage(ClientContext context, DeployManager deployManager, string file) { Log.Info("Processing solution package " + file); deployManager.UploadDesignPackageToSiteAssets(context, file); deployManager.ActivateDesignPackage(context, file, "SiteAssets"); }
public void SetUp () { springAssembliesDeployer = new SpringAssembliesDeployer("."); location = new FileSystemDeployLocation(deployPath); location.StartWatching(); sync = new Latch(); defaultDeployer = new SyncedDeployer(sync); deployManager = new DeployManager(springAssembliesDeployer, location, defaultDeployer); deployManager.Start(); }
private static async Task Main(string[] args) { // 0. Bootstraping Log.Logger = new LoggerConfiguration() .WriteTo.Console() .CreateLogger(); var appConfig = await new AppConfigurationProvider().Get(); var repositoryImportStrategies = new IRepositoryImportStrategy[] { new SvnRepositoryStrategy() }; var buildStrategies = new ISourceCodeBuilderStrategy[] { new DotNetCoreSourceBuilderStrategy() }; var deployStrategies = new IDeployStrategy[] { new InternetInformationServerDeploymentStrategy() }; // 1. Source Repo // 1.1 Type (SVN, GIT) // 1.2 Central Credentials // Moved to settings. // 3. Project Name // Moved to settings. var fetchResult = await RepositoryImporter.ImportAsync(Settings.ProjectName, Settings.SourceRepoUrl, SourceCodeRepositoryType.Svn, appConfig, new SvnAuthInfo(Settings.Username, Settings.Password), new ReadOnlyCollection <IRepositoryImportStrategy>(repositoryImportStrategies)); if (fetchResult.HasErrors) { goto end; } Log.Information(fetchResult.CheckOutDirectory); // 4. Targets to build. var buildTargets = new[] { new BuildTarget("Web", @"Trunk\Nrea.Web", BuildTargetType.DotNetCore), //new BuildTarget("Migration", @"Trunk\Nrea.Migration", BuildTargetType.DotNetCore) }; var buildResult = await SourceCodeBuilder.BuildTargetsAsync(fetchResult.CheckOutDirectory, buildTargets, new ReadOnlyCollection <ISourceCodeBuilderStrategy>(buildStrategies)); if (buildResult.Any(x => x.HasErrors)) { goto end; } // 5. Targets to deploy. var deployTargets = new[] { new DeployTarget(buildResult[0], DeployTargetType.IIS, new IISDeployTargetExtraInfo("Nrea", 54007)), //new DeployTarget(buildTargets[1], DeployTargetType.DotNetCoreRun, new IISDeployTargetExtraInfo("Nrea")) }; var deployResult = await DeployManager.DeployTargetsAsync(deployTargets, new ReadOnlyCollection <IDeployStrategy>(deployStrategies)); foreach (var item in deployResult) { Log.Information($"Deployment result: {item.Target.BuildTarget.Target.Name}, IsError: {item.HasErrors}"); } end: Log.Information("End."); Console.ReadLine(); }
public void Init(DeployManager manager, Point point) { this.manager = manager; this.point = point; }
/// <summary> /// This function is called when the NetConsole button is pressed. /// </summary> public override async void ButtonCallback(object sender, EventArgs e) { await DeployManager.StartNetConsole(); }
public void InstallOperation(InstallationOperation installationOperation, string siteHierarchyFileName) { Log.Info("Executing operation " + installationOperation); if (installationOperation == InstallationOperation.Invalid) { Log.Warn("Invalid user input"); return; } if (installationOperation == InstallationOperation.ExitApplication) { Log.Warn("Installation aborted based on user input"); Environment.Exit(1); } var useConfigurationForInstall = false; var configurationFile = string.Empty; if (string.IsNullOrEmpty(siteHierarchyFileName)) { Log.Info("No configuration file - convention mode enabled"); } else { Log.Debug("Site configuration file: " + siteHierarchyFileName); configurationFile = FindFileInDirectory(ConfigurationDirectoryPath, siteHierarchyFileName); useConfigurationForInstall = true; if (!File.Exists(configurationFile)) { Log.Fatal("Couldn't find the configuration file " + configurationFile); throw new ArgumentException("Couldn't find the configuration file " + configurationFile); } } using (var context = new ClientContext(_urlToSite) { Credentials = _credentials }) { var siteSetupManagerFromConfig = new SiteSetupManager(context, new ShSiteCollection(), _rootPath, _incrementalUpload); if (useConfigurationForInstall) { var filePersistanceProvider = new FilePersistanceProvider <ShSiteCollection>(configurationFile); siteSetupManagerFromConfig = new SiteSetupManager(context, filePersistanceProvider.Load(), _rootPath, _incrementalUpload); } switch (installationOperation) { case InstallationOperation.InstallTaxonomy: { if (useConfigurationForInstall) { foreach (var filename in siteSetupManagerFromConfig.ConfigurationSiteCollection.TaxonomyConfigurations) { InstallTaxonomyFromSingleFile(context, FindFileInDirectory(ConfigurationDirectoryPath, filename)); } } else { InstallAllTaxonomy(context); } break; } case InstallationOperation.UploadAndActivateSolution: { if (useConfigurationForInstall) { var deployManager = new DeployManager(_urlToSite, _credentials, _isSharePointOnline); foreach (var filename in siteSetupManagerFromConfig.ConfigurationSiteCollection.SandboxedSolutions) { UploadAndActivatePackage(context, deployManager, FindFileInDirectory(SolutionsDirectoryPath, filename)); } } else { UploadAndActivateAllSandboxSolutions(context); } break; } case InstallationOperation.AddTemplatesToCts: { if (useConfigurationForInstall) { foreach (var fileName in siteSetupManagerFromConfig.ConfigurationSiteCollection.AddTemplatesToCts) { var filePath = FindFileInDirectory(ConfigurationDirectoryPath, fileName); AddTemplatesToCts(context, filePath); } } else { AddTemplatesToCts(context, null); } break; } case InstallationOperation.InstallFieldsAndContentTypes: { if (useConfigurationForInstall) { siteSetupManagerFromConfig.ActivateContentTypeDependencyFeatures(); foreach (var fileName in siteSetupManagerFromConfig.ConfigurationSiteCollection.FieldConfigurations) { var filePath = FindFileInDirectory(ConfigurationDirectoryPath, fileName); CreateFieldsFromFile(context, filePath); } foreach (var fileName in siteSetupManagerFromConfig.ConfigurationSiteCollection.ContentTypeConfigurations) { var filePath = FindFileInDirectory(ConfigurationDirectoryPath, fileName); CreateContentTypesFromFile(context, filePath); } } else { CreateAllSiteColumnsAndContentTypes(context); } break; } case InstallationOperation.ConfigureSites: { if (useConfigurationForInstall) { siteSetupManagerFromConfig.SetupSites(); } else { ConfigureSitesFromAllSiteHierarchyFiles(context); } break; } case InstallationOperation.ImportSearch: { if (useConfigurationForInstall) { var searchMan = new SearchImportManager(); foreach ( var fileName in siteSetupManagerFromConfig.ConfigurationSiteCollection.SearchConfigurations) { try { var pathToSearchSettingsFile = FindFileInDirectory(SearchDirectoryPath, fileName); Log.Info("Importing search configuration in " + fileName); searchMan.ImportSearchConfiguration(context, pathToSearchSettingsFile); } catch (Exception e) { Log.Error("Could not import seach configuration.", e); } } } else { ImportAllSearchSettings(context); } break; } case InstallationOperation.ExecuteCustomTasks: { //TODO: Refactor and allow both convention and configuration var customTasksManager = new CustomTasksManager(_rootPath); customTasksManager.ExecuteTasks(siteSetupManagerFromConfig.ConfigurationSiteCollection.RootWeb, context); break; } case InstallationOperation.DeleteSites: { TeardownSites(); break; } case InstallationOperation.DeleteFieldsAndContentTypes: { if (useConfigurationForInstall) { foreach ( var fileName in siteSetupManagerFromConfig.ConfigurationSiteCollection.ContentTypeConfigurations) { var filePath = FindFileInDirectory(ConfigurationDirectoryPath, fileName); DeleteContentTypesSpecifiedInFile(context, filePath); } foreach ( var fileName in siteSetupManagerFromConfig.ConfigurationSiteCollection.FieldConfigurations) { var filePath = FindFileInDirectory(ConfigurationDirectoryPath, fileName); DeleteFieldsSpecifiedInFile(context, filePath); } } else { DeleteAllSherpaSiteColumnsAndContentTypes(context); } break; } case InstallationOperation.FileWatchUploader: { if (useConfigurationForInstall) { siteSetupManagerFromConfig.StartFileWatching(); } else { UploadAllChangedFiles(context); } break; } case InstallationOperation.ExportTaxonomy: { ExportTaxonomyGroup(); break; } case InstallationOperation.ExportData: { var outputDirectoryPath = Path.Combine(_rootPath, "export"); Directory.CreateDirectory(outputDirectoryPath); siteSetupManagerFromConfig.ExportListData(outputDirectoryPath); break; } case InstallationOperation.ImportData: { foreach (var fileName in siteSetupManagerFromConfig.ConfigurationSiteCollection.ImportDataConfigurations) { var filePath = FindFileInDirectory(ImportDataDirectoryPath, fileName); ImportDataFromFile(context, filePath); } break; } case InstallationOperation.ForceRecrawl: { ForceReCrawl(); break; } case InstallationOperation.ExitApplication: { Environment.Exit(1); break; } default: { Log.Warn("Operation not supported in unmanaged mode"); break; } } } Log.Debug("Completed installation operation"); }
private void OnGameReset() { instance = null; Destroy(this); }
public async Task DoWork(BuildAndDeployRequestModel request) { try { using (var scope = Payload.ServiceProvider.CreateScope()) { Logger.Information("Start fetching reposiotory..."); var config = scope.ServiceProvider.GetRequiredService <AppConfiguration>(); var authConfigs = scope.ServiceProvider.GetServices <IRepositoryAuthenticationInfo>(); var importStrategies = scope.ServiceProvider.GetServices <IRepositoryImportStrategy>(); var buildStrategies = scope.ServiceProvider.GetServices <ISourceCodeBuilderStrategy>(); var deployStrategies = scope.ServiceProvider.GetServices <IDeployStrategy>(); var importResult = await RepositoryManager.ImportAsync(request.Project, config, authConfigs.First(x => x.Type == request.Project.RepositoryType), new ReadOnlyCollection <IRepositoryImportStrategy>(importStrategies.ToList()), Logger, request.Cursor.Info.CommitId); if (importResult.HasErrors) { Logger.Error($"Importing repository did not complete successfully."); return; } Logger.Information($"Project directory: {importResult.CheckOutDirectory}"); Logger.Information("Start building reposiotory..."); if (request.Project.BuildTargets == null || request.Project.BuildTargets.Count == 0) { Logger.Error("Project doesn't contain BuildTargets."); return; } var buildResults = await SourceCodeBuilder.BuildTargetsAsync(importResult.CheckOutDirectory, request.Project.BuildTargets.ToArray(), new ReadOnlyCollection <ISourceCodeBuilderStrategy>(buildStrategies.ToList()), Logger); if (buildResults.Any(x => x.HasErrors)) { Logger.Error("Not all BuildTargets where build successfully. Skipping deployment."); Logger.Information("End."); return; } Logger.Information("Start deploying reposiotory..."); var deployResult = await DeployManager.DeployTargetsAsync(buildResults.ToArray(), new ReadOnlyCollection <IDeployStrategy>(deployStrategies.ToList()), Logger); if (deployResult.Any(x => x.HasErrors)) { Logger.Error("Not all deployments ran successfully."); } Logger.Information("End."); } } catch (Exception exp) { Logger.Error(exp); } }
public void SetUp () { deployerMock = new DynamicMock(typeof(IDeployer)); deployerMock.Strict = false; deployer = (IDeployer) deployerMock.Object; deployLocation = new MyDeploy (); deployManager = new DeployManager (new DirectExecutor(), new NullSpringDeployer(), deployLocation, deployer); }