Пример #1
0
        public ModuleStateEditor(ModuleState moduleStateToBeEdited, IEnumerable <Tuple <IRepositoryManager, IModule> > modules, string validationLabel, GUIStyles styles)
        {
            this.validationLabel     = validationLabel;
            this.styles              = styles;
            this.objectEdited        = moduleStateToBeEdited;
            this.dependenciesEditors = new DependenciesEditor(this.objectEdited.Dependencies, modules.ToList());
            this.Modules             = modules;

            this.version   = new BranchVersion(1, 0, 0);
            this.tag       = new Tag("New tag", Color.red);
            this.trlLabels = new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
        }
Пример #2
0
        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));
            }
        }
Пример #3
0
        void DisplayModuleForm()
        {
            //NAME
            EditorGUILayout.Space();
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField(new GUIContent("Name"), this.styles.BoldLabelStyle, GUILayout.MaxWidth(100f));
                this.objectEdited.Name = EditorGUILayout.TextField(this.objectEdited.Name, GUI.skin.textField, GUILayout.MaxWidth(400f));
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.Space();

            //PATH
            EditorGUILayout.Space();
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField(new GUIContent("Path"), this.styles.BoldLabelStyle, GUILayout.MaxWidth(100f));
                if (GUILayout.Button("...", GUILayout.MaxWidth(40f)))
                {
                    string path = EditorUtility.SaveFolderPanel("Select the folder for the repository of your module", Application.dataPath, this.objectEdited.Name + ".git");
                    if (path.StartsWith(Application.dataPath))
                    {
                        this.objectEdited.Path = path;
                    }
                    else
                    {
                        if (this.OnMessageTriggered != null)
                        {
                            this.OnMessageTriggered(new Message("The repository should be inside the current project.", MessageType.Warning));
                        }
                    }
                }
                EditorGUILayout.LabelField(new GUIContent(this.objectEdited.Path), GUILayout.MaxWidth(800f));
            }
            EditorGUILayout.Space();

            //VERSION
            if (this.isVersionEditionEnabled)
            {
                EditorGUILayout.Space();
                using (new EditorGUILayout.HorizontalScope())
                {
                    EditorGUILayout.LabelField(new GUIContent("Version"), this.styles.BoldLabelStyle, GUILayout.MaxWidth(100f));
                    this.version.major = (uint)EditorGUILayout.IntField((int)version.major, GUILayout.MaxWidth(30f));
                    this.version.minor = (uint)EditorGUILayout.IntField((int)version.minor, GUILayout.MaxWidth(30f));
                    this.version.patch = (uint)EditorGUILayout.IntField((int)version.patch, GUILayout.MaxWidth(30f));
                    EditorGUILayout.Space();
                    if (GUILayout.Button("Reset version", GUILayout.MaxWidth(100f)))
                    {
                        this.version = new BranchVersion(1, 0, 0);
                    }
                    GUILayout.FlexibleSpace();
                }
                EditorGUILayout.Space();
                EditorGUILayout.Space();
            }

            // TRL
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUILayout.LabelField(new GUIContent("Estimated TRL"), this.styles.BoldLabelStyle, null);
                this.objectEdited.TRL = GUILayout.Toolbar(this.objectEdited.TRL - 1, this.trlLabels, EditorStyles.toolbarButton, null) + 1;
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.Space();

            // TAGS
            EditorGUILayout.LabelField(new GUIContent("Tags"), this.styles.BoldLabelStyle, null);
            using (new EditorGUILayout.HorizontalScope(GUILayout.MaxWidth(300f)))
            {
                this.tag.name  = EditorGUILayout.TextField(this.tag.name, GUI.skin.textField, GUILayout.MaxWidth(400f));
                this.tag.color = EditorGUILayout.ColorField(this.tag.color, GUILayout.MaxWidth(400f));
                if (GUILayout.Button("Add tag", GUILayout.MaxWidth(100f)))
                {
                    if (this.tag.name != "New tag")
                    {
                        this.objectEdited.Tags.Add(this.tag);
                        this.tag = new Tag("New tag", Color.red);
                    }
                }
            }
            using (new EditorGUILayout.HorizontalScope())
            {
                this.DisplayTags(this.objectEdited.Tags);
            }
            EditorGUILayout.Space();

            // DESCRIPTION
            EditorGUILayout.LabelField(new GUIContent("Description"), this.styles.BoldLabelStyle, null);
            EditorGUILayout.Space();
            this.objectEdited.Description = EditorGUILayout.TextArea(this.objectEdited.Description, GUI.skin.textArea, GUILayout.MinHeight(75f));
            EditorGUILayout.Space();

            // DEPENDENCIES
            using (new EditorGUILayout.HorizontalScope())
            {
                GUILayout.Space(13f);
                using (new EditorGUILayout.VerticalScope(GUI.skin.textArea, GUILayout.ExpandWidth(false)))
                {
                    this.foldoutDependencies = EditorGUILayout.Foldout(this.foldoutDependencies, new GUIContent("Dependencies of the module"));
                    EditorGUILayout.Space();
                    if (this.foldoutDependencies)
                    {
                        if (this.displayDependencies)
                        {
                            this.dependenciesEditors.Display();
                        }
                        else
                        {
                            EditorGUILayout.LabelField(new GUIContent("No modules found. You can't add dependencies for this module."), this.styles.BoldLabelStyle, null);
                        }
                    }
                }
            }
            EditorGUILayout.Space();
        }
Пример #4
0
 void OnModuleCreationCompleted(IRepositoryManager repositoryManager, ModuleState moduleState, Moduni.BranchVersion version)
 {
     this.moduniModel.CreateModule(repositoryManager, moduleState, version);
 }