public void Push(PushArgs args)
        {
            DirectoryInfo destinationDir = new DirectoryInfo(args.Destination);

            if (!destinationDir.Exists)
            {
                Console.WriteLine("The destination folder does not exist.");
                Environment.Exit(1);
            }

            FileInfo nupkg = new FileInfo(args.Nupkg);
            if (!nupkg.Exists)
            {
                Console.WriteLine("The given nupkg does not exist.");
                Environment.Exit(1);
            }

            Config config = new Config("http://localhost:8000/", destinationDir.FullName);

            Queue<BuildStep> steps = new Queue<BuildStep>();

            Queue<string> nupkgs = new Queue<string>();
            nupkgs.Enqueue(nupkg.FullName);

            // start the cursor before any operators take place
            CollectorCursor cursor = new CollectorCursor(DateTime.UtcNow);

            steps.Enqueue(new CopyPackagesStep(config, nupkgs));
            steps.Enqueue(new CatalogStep(config, nupkgs));
            steps.Enqueue(new ResolverStep(config, cursor));

            while (steps.Count > 0)
            {
                BuildStep step = steps.Dequeue();

                RunStep(step);

                step.Dispose();
            }
        }
        public void Create(CreateArgs args)
        {
            DirectoryInfo destinationDir = new DirectoryInfo(args.Destination);

            if (destinationDir.Exists && destinationDir.EnumerateFiles().Any())
            {
                if (args.Force)
                {
                    destinationDir.Delete(true);
                }
                else
                {
                    Console.WriteLine("The destination folder already has files. Use -F to force.");
                    Environment.Exit(1);
                }
            }

            destinationDir.Create();

            Config config = new Config("http://localhost:8000/", destinationDir.FullName);

            Queue<BuildStep> steps = new Queue<BuildStep>();

            Queue<string> nupkgs = new Queue<string>(Directory.GetFiles(args.Input, "*.nupkg"));

            steps.Enqueue(new CopyPackagesStep(config, nupkgs));
            steps.Enqueue(new CatalogStep(config, nupkgs));
            steps.Enqueue(new ResolverStep(config));
            steps.Enqueue(new InterceptStep(config));

            while(steps.Count > 0)
            {
                BuildStep step = steps.Dequeue();

                RunStep(step);

                step.Dispose();
            }
        }
        public InterceptStep(Config config)
            : base(config, "CreateIntercept")
        {

        }
 public CatalogStep(Config config, IEnumerable<string> nupkgs, int batchSize=1000)
     : base(config, "CreateCatalog")
 {
     _nupkgs = new Queue<string>(nupkgs);
     _batchSize = batchSize;
 }
 protected BuildStep(Config config, string stepName)
 {
     Name = stepName;
     Config = config;
 }
 public ResolverStep(Config config, CollectorCursor cursor)
     : base(config, "PackageRegistrations")
 {
     _cursor = cursor;
 }
        public ResolverStep(Config config)
            : this(config, new CollectorCursor(DateTime.MinValue))
        {

        }
 public CopyPackagesStep(Config config, IEnumerable<string> nupkgs)
     : base(config, "CopyPackages")
 {
     _nupkgs = new Queue<string>(nupkgs);
 }