예제 #1
0
        public void RunFinished()
        {
            try
            {
                Solution2 solution = (Solution2)this.Dte2.Solution;

                var path           = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                var templatePath   = path + "\\ProjectTemplates\\AspNetScaffolding3";
                var solutionPath   = this.Variables["$basedir$"];
                var mainProjectDir = this.Variables["$destinationdirectory$"] + "\\" + this.Variables["$safeprojectname$"] + ".Api";

                Projects projects      = solution.Projects;
                var      firstProject  = projects.Cast <Project>().First();
                var      solutionItems = (SolutionFolder)firstProject.Object;

                // git
                var git = solutionItems.AddSolutionFolder("git");
                git.ProjectItems.AddFromFileCopy(templatePath + "\\.gitignore");
                git.ProjectItems.AddFromFileCopy(templatePath + "\\.gitattributes");

                // github
                var github = solutionItems.AddSolutionFolder("github");
                github.ProjectItems.AddFromFileCopy(templatePath + "\\README.md");

                Directory.CreateDirectory(solutionPath + "\\.github");
                File.Copy(templatePath + "\\.github\\CONTRIBUTING.md", solutionPath + "\\.github\\CONTRIBUTING.md");
                File.Copy(templatePath + "\\.github\\ISSUE_TEMPLATE.md", solutionPath + "\\.github\\ISSUE_TEMPLATE.md");
                File.Copy(templatePath + "\\.github\\PULL_REQUEST_TEMPLATE.md", solutionPath + "\\.github\\PULL_REQUEST_TEMPLATE.md");

                github.ProjectItems.AddFromFile(solutionPath + "\\.github\\CONTRIBUTING.md");
                github.ProjectItems.AddFromFile(solutionPath + "\\.github\\ISSUE_TEMPLATE.md");
                github.ProjectItems.AddFromFile(solutionPath + "\\.github\\PULL_REQUEST_TEMPLATE.md");

                // devops
                var devops = solutionItems.AddSolutionFolder("devops");

                Directory.CreateDirectory(solutionPath + "\\devops");
                File.Copy(templatePath + "\\devops\\azure-pipelines.yml", solutionPath + "\\devops\\azure-pipelines.yml");
                File.Copy(templatePath + "\\devops\\docker-compose.yml", solutionPath + "\\devops\\docker-compose.yml");
                File.Copy(templatePath + "\\devops\\Dockerfile", solutionPath + "\\devops\\Dockerfile");

                devops.ProjectItems.AddFromFile(solutionPath + "\\devops\\azure-pipelines.yml");
                devops.ProjectItems.AddFromFile(solutionPath + "\\devops\\docker-compose.yml");
                devops.ProjectItems.AddFromFile(solutionPath + "\\devops\\Dockerfile");

                // docs
                var docs = solutionItems.AddSolutionFolder("docs");
                docs.ProjectItems.AddFromFile(mainProjectDir + "\\Docs.md");

                foreach (var openedDocument in this.Dte2.Documents.Cast <Document>())
                {
                    openedDocument.Close();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Ocorreu um errinho aqui, mas tenta rodar como administrador pra ver se é permissão :)", "Ops!");
            }
        }
        private static void FillSolutionTree(Package connect, SolutionItem solutionItem, Projects projects)
        {
            if (projects == null)
            {
                return;
            }

            foreach (var item in
                     projects.Cast <Project>()
                     .Select(p => ConstructSolutionItem(connect, p))
                     .Where(item => item != null))
            {
                solutionItem.SubItems.Add(item);
            }
        }
 public DefaultProjectSnapshot GetSnapshot(Project workspaceProject)
 {
     return(Projects.Cast <DefaultProjectSnapshot>().FirstOrDefault(s => s.FilePath == workspaceProject.FilePath));
 }
 public DefaultProjectSnapshot GetSnapshot(HostProject hostProject)
 {
     return(Projects.Cast <DefaultProjectSnapshot>().FirstOrDefault(s => s.FilePath == hostProject.FilePath));
 }
예제 #5
0
 public DefaultProjectSnapshot GetSnapshot(ProjectId id)
 {
     return(Projects.Cast <DefaultProjectSnapshot>().FirstOrDefault(s => s.UnderlyingProject.Id == id));
 }
예제 #6
0
 public VsProject GetProject(DteProject dteProject)
 {
     return(Projects.Cast <VsProject>().FirstOrDefault(
                p => String.Equals(p.DteProject.UniqueName, dteProject.UniqueName, StringComparison.OrdinalIgnoreCase)));
 }
예제 #7
0
        public void Write(string time)
        {
            var dataModels = Projects.Cast <AbstractDataModel>().ToList();

            WriteToBulk(dataModels, $"{Resources.Global_Data_Path}projects_{time}.bulk");
        }
예제 #8
0
 public static IEnumerable<Node> BuildProjectTree(Projects projects)
 {
     return projects.Cast<Project>()
         .Select(GetProjectItemNode);
 }
예제 #9
0
 public static IEnumerable <Project> AsEnumerable(this Projects source)
 {
     return(source.Cast <Project>());
 }