Ejemplo n.º 1
0
        Install(Queue <string> args)
        {
            if (args.Any())
            {
                throw new UserException("Too many arguments");
            }

            var repository = WhereAmI();

            if (repository == null)
            {
                throw new UserException("Not in a repository");
            }

            if (!repository.HasDotNuGitLock())
            {
                Trace.TraceError("No .nugit.lock file present, 'nugit update' to create it");
                throw new UserException("No .nugit.lock file present");
            }

            DependencyTraverser.Restore(repository, true);
            var dependencies = repository.ReadDotNuGitLock();

            Installer.Install(repository, dependencies);

            return(0);
        }
Ejemplo n.º 2
0
        Restore(Queue <string> args)
        {
            var exact = false;

            while (args.Any())
            {
                var arg = args.Dequeue();
                switch (arg)
                {
                case "--exact":
                    exact = true;
                    break;

                default:
                    throw new UserException($"Unexpected argument '{arg}'");
                }
            }

            var repository = WhereAmI();

            if (repository == null)
            {
                throw new UserException("Not in a repository");
            }

            if (!repository.HasDotNuGitLock())
            {
                Trace.TraceError("No .nugit.lock file present, 'nugit update' to create it");
                throw new UserException("No .nugit.lock file present");
            }

            DependencyTraverser.Restore(repository, exact);

            return(0);
        }