Exemple #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);
        }
Exemple #2
0
        public Version GetLatestPackageVersion(string packageName)
        {
            var dir = PathConverter.ToAbsolute("pkg/" + packageName);

            var version = new Version(0, 0, 0, 0);

            if (Directory.Exists(dir))
            {
                var latestFilePath = FileNavigator.GetNewestFile(dir);

                if (!String.IsNullOrEmpty(latestFilePath))
                {
                    version = GetVersionFromPackageFileName(latestFilePath);
                }
            }

            return(version);
        }
 public string GetNewestFile(string directory)
 {
     return(FileNavigator.GetNewestFile(directory));
 }