Ejemplo n.º 1
0
        public static void RequirePackDm(bool force = false)
        {
            RequireToolsPath();

#if WINDOWS
            var packExe      = "pack.exe";
            var bootstrapExe = "pack-bootstrap.exe";
#else
            var packFile      = "pack";
            var bootstrapFile = "pack-bootstrap";
#endif

            var bootstrapPath = Path.GetFullPath($@"{ToolsFolder}\{bootstrapExe}");
            if (force || !File.Exists(bootstrapPath))
            {
                using (var output = new FileStream(bootstrapPath, FileMode.Create))
                {
                    EmbeddedFiles.CopyTo(bootstrapExe, output);
                }
            }

            var packPath = Path.GetFullPath($@"{ToolsFolder}\{packExe}");
            if (force || !File.Exists(packPath))
            {
                using (Shell.ChDir(ToolsFolder))
                {
                    Shell.Run(bootstrapExe);
                }
            }

            Prompt.PrintInfo("PackDm detectado:\n" + bootstrapPath);
        }
Ejemplo n.º 2
0
        private static void ApplyDevenvWorkaround(string devenv)
        {
            // Workaround VisualStudio 2012+
            //
            // Correção para permitir ao VisualStudio 2017 compilar projetos do tipo
            // Setup na linha de comando.
            //
            // Leia mais no comentário sobre o Workaround no início do arquivo.

            var folder     = Path.GetDirectoryName(devenv);
            var workaround = Path.Combine(folder,
                                          @"CommonExtensions\Microsoft\VSI\DisableOutOfProcBuild\DisableOutOfProcBuild.exe"
                                          );

            if (File.Exists(workaround))
            {
                Prompt.PrintInfo(
                    "Aplicando um workaround para evitar o erro: HRESULT = '8000000A'\n"
                    );

                using (workaround.GetDir().ChDir())
                {
                    var ok = workaround.Quote().Run();
                    if (!ok)
                    {
                        Prompt.PrintWarn("Falhou a aplicação do workaround.");
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static void RequireNuGet(bool force = false)
        {
            RequireToolsPath();

            var exe = Path.GetFullPath($@"{ToolsFolder}\nuget.exe");

            if (force || !File.Exists(exe))
            {
                using (var output = new FileStream(exe, FileMode.Create))
                {
                    EmbeddedFiles.UnpackTo("nuget.exe.gz", output);
                }
            }

            Prompt.PrintInfo("NuGet detectado:\n" + exe);
        }
Ejemplo n.º 4
0
        public static void RequireDevenv(bool force = false)
        {
            var programFiles = new[] {
                Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
                Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
            }.Distinct();

            var folders = new[] {
                @"Microsoft Visual Studio\2019\Community",
                @"Microsoft Visual Studio\2017\Community",
                @"Microsoft Visual Studio 16.0",
                @"Microsoft Visual Studio 15.0",
                @"Microsoft Visual Studio 10.0",
                @"Microsoft Visual Studio 9.0"
            };

            var filepaths =
                from programFile in programFiles
                from folder in folders
                select Path.Combine(programFile, folder, @"Common7\IDE\devenv.com");

            var devenv = (
                from filepath in filepaths
                where File.Exists(filepath)
                select filepath
                ).FirstOrDefault();

            if (devenv == null)
            {
                throw new PromptException("Nenhuma versão compatível do VisualStudio foi detectada.");
            }

            var devenvPath = Path.GetDirectoryName(devenv);
            var path       = Environment.GetEnvironmentVariable("PATH");

            if (!path.Contains(devenvPath))
            {
                path += ";" + devenvPath;
                Environment.SetEnvironmentVariable("PATH", path);
            }

            Prompt.PrintInfo($"VisualStudio detectado:\n{devenv}");

            ApplyDevenvWorkaround(devenv);
        }
Ejemplo n.º 5
0
        public static void RequireToolsPath(bool force = false)
        {
            var toolsPath = Path.GetFullPath(ToolsFolder);

            if (!Directory.Exists(toolsPath))
            {
                Directory.CreateDirectory(toolsPath);
            }

            var path = Environment.GetEnvironmentVariable("PATH");

            if (!path.Contains(toolsPath))
            {
                path += ";" + toolsPath;
                Environment.SetEnvironmentVariable("PATH", path);

                Prompt.PrintInfo("Caminho dos binários:\n" + toolsPath);
            }
        }
Ejemplo n.º 6
0
        public static void RequireSubversion(bool force = false)
        {
            bool ok;

            RequireToolsPath(force);

            ok = "svn --version".Run();
            if (!ok)
            {
                var programFiles = new[] {
                    Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
                    Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
                }.Distinct();

                var folders = new[] {
                    @"TortoiseSVN\bin"
                };

                var filepaths =
                    from programFile in programFiles
                    from folder in folders
                    select Path.Combine(programFile, folder, @"svn.exe");

                var svn = (
                    from filepath in filepaths
                    where File.Exists(filepath)
                    select filepath
                    ).FirstOrDefault();

                if (svn == null)
                {
                    throw new PromptException("Nenhuma versão do Subversion foi detectada.");
                }

                var path = Environment.GetEnvironmentVariable("PATH");
                path += ";" + Path.GetDirectoryName(svn);
                Environment.SetEnvironmentVariable("PATH", path);
            }

            Prompt.PrintInfo($"Subversion detectado:\nsvn");
        }