public void CreateModule(IRepositoryManager repositoryManager, ModuleState moduleState, Moduni.BranchVersion version) { Task <ISourceControlRepository> creationTask = repositoryManager.CreateRepository(moduleState.Name); creationTask.Wait(); ISourceControlRepository remoteRepository = creationTask.Result; ISourceControlRepository projectRepository = remoteRepository.InitOrCloneRepository(moduleState.Path); IModule module = this.moduleFactory.CreateModuleFromRepository(projectRepository); module.CurrentState = moduleState; module.SaveMetadata(); module.PublishChanges("feat(Global): initial commit of the module"); module.PublishVersion(version); module.CreateBaseBranches(); this.projectModules.Add(module); if (this.projectRepository != null) { this.projectRepository.AddSubmodule(module.Path, module.RepositoryURL); this.projectRepository.StageFile(projectRepository.RepositoryURL.Remove(projectRepository.RepositoryURL.Length - 1, 1)); } this.modules.Add(new Tuple <IRepositoryManager, IModule>(repositoryManager, this.moduleFactory.CreateModuleFromRepository(remoteRepository))); module.CheckoutBranchVersion(new BranchVersion("master")); if (this.OnModulesUpdated != null) { this.OnModulesUpdated(this.modules); } if (this.OnProjectModulesUpdated != null) { this.OnProjectModulesUpdated(this.projectModules); } if (this.OnMessageTriggered != null) { this.OnMessageTriggered(new Message(string.Format("Module ({0}) {1} created successfully !", repositoryManager.Name, module.Name), MessageType.Info)); } }