Пример #1
0
        public void Create()
        {
            var nuget = new NugetPacker(WorkingDirectory);

            nuget.Version = new Version(new VersionManager().GetVersion(WorkingDirectory));

            var pkgDir = WorkingDirectory
                         + Path.DirectorySeparatorChar
                         + "pkg";

            var specFile = pkgDir
                           + Path.DirectorySeparatorChar
                           + "csAnt.nuspec";

            // TODO: Perform packaging in temporary directory instead of main project
            nuget.PackageFile(specFile);

            var pkgFile = FileNavigator.GetNewestFile(
                pkgDir
                + Path.DirectorySeparatorChar
                + "csAnt"
                );

            var pkgToFile = FeedPath
                            + Path.DirectorySeparatorChar
                            + Path.GetFileName(pkgFile);

            DirectoryChecker.EnsureDirectoryExists(Path.GetDirectoryName(pkgToFile));

            File.Copy(pkgFile, pkgToFile, true);

            GrabRequiredPackages(WorkingDirectory, FeedPath);
        }
        public void PrepareProjectPackages()
        {
            var packager = new NugetPacker();

            packager.PackAll(TestSourceDirectory);
            //Executor.Execute("CyclePackage", "csAnt");

            // TODO: Remove if not needed

            /*Console.WriteLine("");
            *  Console.WriteLine("Status: " + Status);
            *  Console.WriteLine("");*/
        }
Пример #3
0
    public override bool Run(string[] args)
    {
        var packageName = "";

        if (Arguments.KeylessArguments.Length > 0)
        {
            packageName = Arguments.KeylessArguments[0];
        }

        var packer = new NugetPacker();

        if (CurrentNode.Properties.ContainsKey("Status"))
        {
            packer.Status = CurrentNode.Properties["Status"];
        }

        if (CurrentNode.Properties.ContainsKey("Version"))
        {
            packer.Version = new Version(CurrentNode.Properties["Version"]);
        }

        if (CurrentNode.Properties.ContainsKey("Branch"))
        {
            packer.Branch = CurrentNode.Properties["Branch"];
        }

        if (String.IsNullOrEmpty(packageName))
        {
            packer.PackAll(CurrentDirectory);
        }
        else
        {
            packer.Pack(CurrentDirectory, packageName);
        }

        RaiseEvent("Package");

        return(true);
    }
        public void Test_Pack()
        {
            // TODO: Turn this test into a unit test

            new FilesGrabber(
                OriginalDirectory,
                WorkingDirectory
                ).GrabOriginalFiles();

            var packageName = "csAnt";

            var version = "0.0.1";

            // TODO: Remove dependency on existing .nuspec file by creating a mock one
            var filePath = WorkingDirectory
                           + Path.DirectorySeparatorChar
                           + "pkg"
                           + Path.DirectorySeparatorChar
                           + packageName + ".nuspec";

            var packer = new NugetPacker();

            packer.Version = new Version(version);
            packer.Status  = "beta";
            packer.PackageFile(filePath);

            var pkgFilePath = Path.GetDirectoryName(filePath)
                              + Path.DirectorySeparatorChar
                              + packageName
                              + Path.DirectorySeparatorChar
                              + packageName + "." + version + "-" + packer.Status
                              + ".nupkg";

            Console.WriteLine("Expected package file:");
            Console.WriteLine(pkgFilePath);

            Assert.IsTrue(File.Exists(pkgFilePath), "Package file not found.");
        }
Пример #5
0
 public MockNugetPackageCreator()
 {
     Packer = new NugetPacker();
 }