Exemplo n.º 1
0
        public override void Retrieve(string packageName, Version version, string status)
        {
            Console.WriteLine("");
            Console.WriteLine("Nuget path:");
            Console.WriteLine("  " + NugetPath);
            Console.WriteLine("");
            Console.WriteLine("Nuget feed path:");
            Console.WriteLine("  " + NugetSourcePath);
            Console.WriteLine("");
            Console.WriteLine("Version: " + version.ToString());
            Console.WriteLine("Status: " + (!String.IsNullOrEmpty(status) ? status : "Release (not specified, using default)"));
            Console.WriteLine("");

            InstallNuget();

            // TODO: Move this to a config file
            var outputDir = DestinationPath
                            + Path.DirectorySeparatorChar
                            + "lib";

            var outputCsAntDir = outputDir
                                 + Path.DirectorySeparatorChar
                                 + "csAnt";

            var arguments = new List <string>();

            arguments.Add("install");
            arguments.Add(packageName);
            arguments.Add(String.Format("-OutputDirectory \"{0}\"", outputDir));
            arguments.Add(String.Format("-Source \"{0}\"", NugetSourcePath));
            arguments.Add("-NoCache"); // TODO: Is this required? It slows down setup and tests, but ensures the latest version of packages are accessible

            // If a status is specified then allow prereleases to access the one with that status
            if (!String.IsNullOrEmpty(status))
            {
                arguments.Add("-Pre");
            }

            AddVersionArgument(packageName, version, status, arguments);

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

            // TODO: Move the executor to a property
            NugetExecutor.Execute(
                arguments.ToArray()
                );
        }
Exemplo n.º 2
0
        public InstallerNugetPackageRetriever(string destinationPath)
        {
            if (!String.IsNullOrEmpty(destinationPath))
            {
                DestinationPath = destinationPath;
            }
            else
            {
                DestinationPath = Environment.CurrentDirectory;
            }

            NugetSourcePath = "https://www.myget.org/F/softwaremonkeys/";
            NugetChecker    = new NugetChecker();
            NugetExecutor   = new NugetExecutor();
            Versioner       = new NugetVersioner(NugetSourcePath);
        }
Exemplo n.º 3
0
        public InstallerNugetPackageRetriever(string nugetSourcePath, string destinationPath)
        {
            if (!String.IsNullOrEmpty(destinationPath))
            {
                DestinationPath = destinationPath;
            }
            else
            {
                DestinationPath = Environment.CurrentDirectory;
            }

            if (!String.IsNullOrEmpty(nugetSourcePath))
            {
                NugetSourcePath = nugetSourcePath;
            }

            NugetChecker  = new NugetChecker();
            NugetExecutor = new NugetExecutor();
            Versioner     = new NugetVersioner(nugetSourcePath);
        }
Exemplo n.º 4
0
    public override bool Run(string[] args)
    {
        var id                = args[0];
        var version           = "0.0.0.0";
        var status            = "";
        var sourcePath        = "https://www.myget.org/F/softwaremonkeys/";
        var defaultSourcePath = "https://go.microsoft.com/fwlink/?LinkID=206669";

        if (Arguments.ContainsAny("v", "version"))
        {
            version = Arguments["v", "version"];
        }

        if (Arguments.ContainsAny("source"))
        {
            sourcePath = Arguments["source"];
        }

        if (Arguments.ContainsAny("status"))
        {
            status = Arguments["status"];
        }

        Console.WriteLine("");
        Console.WriteLine("Updating library...");
        Console.WriteLine("");
        Console.WriteLine("Specified version: " + (!String.IsNullOrEmpty(version) ? version : "[Latest]"));
        Console.WriteLine("");
        Console.WriteLine("Status: " + (!String.IsNullOrEmpty(status) ? status : "[Stable Release]"));
        Console.WriteLine("");
        Console.WriteLine("Source: " + sourcePath);
        Console.WriteLine("");

        var versioner = new NugetVersioner();

        versioner.NugetSourcePath = sourcePath;
        var foundVersion = versioner.GetVersion(id, new Version(version), status);

        Console.WriteLine("Found version: " + (foundVersion != null && foundVersion > new Version(0, 0, 0, 0) ? foundVersion.ToString() : "[Latest]"));
        Console.WriteLine("");

        var executor = new NugetExecutor();

        var list = new List <string>();

        list.Add("install");
        list.Add(id);
        list.Add("-Source " + sourcePath);
        list.Add("-Source " + defaultSourcePath);
        list.Add("-OutputDirectory lib"); // TODO: Make this configurable
        list.Add("-NoCache");

        if (foundVersion != null &&
            foundVersion > new Version(0, 0, 0, 0))
        {
            list.Add("-Version " + foundVersion);
            list.Add("-Pre");
        }

        executor.Execute(
            list.ToArray()
            );

        ExecuteScript("SetLibVersion", id, foundVersion.ToString());

        new FileCopier(
            ToAbsolute("lib"),
            ToAbsolute("pkg")
            ).Copy(
            "*.nupkg",
            "!" + CurrentNode.Name
            );

        return(!IsError);
    }