Exemple #1
0
        public bool Exec(InitCommandOptions options)
        {
            bool ok;

            Toolchain.RequirePackDm(true);
            Toolchain.RequireSubversion(true);

            var pack = new Library.PackDm.PackDm();

            pack.PackConf = options.ConfFile.Text;
            pack.PackInfo = options.PackFile.Text;

            var svn = new Svn();

            ok = pack.Init();
            if (!ok)
            {
                return(Prompt.PrintCannotContinue());
            }

            ok = svn.Ignore("packages");
            if (!ok)
            {
                return(Prompt.PrintCannotContinue());
            }

            return(true);
        }
Exemple #2
0
        public bool Exec(TagCommandOptions options)
        {
            Toolchain.RequirePackDm();
            Toolchain.RequireSubversion();

            if (options.MakeLatest.On)
            {
                return(CreateLatestTag(options));
            }
            else
            {
                return(CreateTag(options));
            }
        }
Exemple #3
0
        public bool Exec(UpgradeCommandOptions options)
        {
            bool ok;

            Toolchain.RequirePackDm(true);

            var pack = new Library.PackDm.PackDm();

            pack.PackConf = options.ConfFile.Text;
            pack.PackInfo = options.PackFile.Text;

            ok = pack.Upgrade();
            if (!ok)
            {
                return(Prompt.PrintCannotContinue());
            }

            return(true);
        }
Exemple #4
0
        public bool Exec(BuildCommandOptions options)
        {
            Toolchain.RequireDevenv();
            Toolchain.RequirePackDm();
            Toolchain.RequireSubversion();

            bool ok;

            string[] solutions;

            if (options.Solutions.On)
            {
                solutions = options.Solutions.Items.FindFiles();
            }
            else
            {
                solutions = "*.sln".FindFiles();
            }

            if (!solutions.Any())
            {
                return(Prompt.PrintNothingToBeDone("Nenhuma solução detectada."));
            }

            var pack = new Library.PackDm.PackDm();

            pack.PackConf = options.ConfFile.Text;
            pack.PackInfo = options.PackFile.Text;

            var svn = new Svn();

            ok = pack.Fill();
            if (!ok)
            {
                return(Prompt.PrintCannotContinue());
            }

            ok = svn.Fill();
            if (!ok)
            {
                return(Prompt.PrintCannotContinue());
            }

            // Imprimindo informação de revisao do pack.info e do subverison
            // no console e no arquivo REVISION.txt
            VersionInfo version;
            {
                var revisionFilepath = Path.GetFullPath("REVISION.txt");

                var loader = new ProjectLoader();
                loader.PackConf = options.ConfFile.Text;
                loader.PackInfo = options.PackFile.Text;
                var ret = loader.LoadProjectHeader();
                if (!ret.Ok)
                {
                    return(Prompt.PrintCannotContinue());
                }

                var project = ret.Value;
                version = project.Version;

                // imprimindo no console e no arquivo
                Prompt.PrintInfo(version);
                File.WriteAllText(revisionFilepath, version);
            }

            var configuration = options.Configuration.Text ?? "Release|Any CPU";

            foreach (var solution in solutions)
            {
                var solutionFilename = Path.GetFileName(solution);
                var solutionFolder   = Path.GetDirectoryName(solution);

                ok = $"devenv.com {solution.Quote()} /Rebuild {configuration.Quote()}".Run();
                if (!ok)
                {
                    return(Prompt.PrintCannotContinue());
                }
            }

            // O packDm usa a máscara para substituir partes da versao
            var versionMask = $"*.*.*{version.FormattedPreRelease}";

            ok = pack.Pack(versionMask);
            if (!ok)
            {
                return(Prompt.PrintCannotContinue());
            }

            // Constrói a página HTML com informações de setup.
            // Falhas podem ser ignoradas.
            var title = Path.GetFileName(solutions.First()).Replace(".sln", "");

            MakeSetupPage(title, version);

            return(true);
        }