public void SetUp()
        {
            theFinder = MockRepository.GenerateStub<INuspecTemplateFinder>();
            
            theSolution = new Solution();
            theSolution.AddProject("Project1");
            theSolution.AddProject("Project2");

            d1 = new NuspecDependencyToken("DependencyA", "1.0.0.0", VersionConstraint.DefaultFixed);
            d2 = new NuspecDependencyToken("DependencyB", "1.0.0.0", VersionConstraint.DefaultFixed);

            g1 = new NuspecTemplate(new NugetSpec("Spec1", "Spec1.nuspec"), new[] { ProjectNuspec.For(theSolution.FindProject("Project1")) });
            g2 = new NuspecTemplate(new NugetSpec("Spec2", "Spec2.nuspec"), new[] { ProjectNuspec.For(theSolution.FindProject("Project2")) });

            theTemplates = new NuspecTemplateCollection(new[] { g1, g2 });

            src1 = MockRepository.GenerateStub<INuspecDependencySource>();
            src2 = MockRepository.GenerateStub<INuspecDependencySource>();

            theFinder.Stub(x => x.Templates(theSolution)).Return(theTemplates);

            src1.Stub(x => x.DetermineDependencies(new NuspecTemplateContext(g1, theTemplates, theSolution))).Return(new[] { d1 });
            src1.Stub(x => x.DetermineDependencies(new NuspecTemplateContext(g2, theTemplates, theSolution))).Return(new NuspecDependencyToken[0]);

            src2.Stub(x => x.DetermineDependencies(new NuspecTemplateContext(g1, theTemplates, theSolution))).Return(new NuspecDependencyToken[0]);
            src2.Stub(x => x.DetermineDependencies(new NuspecTemplateContext(g2, theTemplates, theSolution))).Return(new[] { d2 });

            theGenerator = new NuspecGenerator(theFinder, new[] { src1, src2 });
            thePlan = theGenerator.PlanFor(theSolution, new SemanticVersion("1.0.0.0"));
        }
        public void SetUp()
        {
            theScenario = SolutionScenario.Create(scenario =>
            {
                scenario.Solution("Test", test =>
                {
                    test.Publishes("MyProject");
                    test.Publishes("AnotherProject");

                    test.SolutionDependency("Bottles", "1.1.0.0", UpdateMode.Fixed);
                    test.SolutionDependency("FubuCore", "1.0.0.0", UpdateMode.Float);
                    test.SolutionDependency("FubuLocalization", "1.8.0.0", UpdateMode.Fixed);

                    test.LocalDependency("Bottles", "1.1.0.255");
                    test.LocalDependency("FubuCore", "1.0.1.244");
                    test.LocalDependency("FubuLocalization", "1.8.0.0");

                    test.ProjectDependency("MyProject", "Bottles");
                    test.ProjectDependency("MyProject", "FubuCore");
                    test.ProjectDependency("MyProject", "FubuLocalization");

                    test.ProjectDependency("AnotherProject", "FubuCore");
                });
            });

            theSolution = theScenario.Find("Test");
            theSolution.FindProject("AnotherProject").AddProjectReference(theSolution.FindProject("MyProject"));

            var templates = new NuspecTemplateFinder().Templates(theSolution);
            var current = templates.FindByProject("AnotherProject");

            theContext = new NuspecTemplateContext(current, templates, theSolution, new SemanticVersion("1.1.0.0"));
            theTokens = new ProjectDependenciesSource().DetermineDependencies(theContext);
        }
Esempio n. 3
0
        public ProjectNuspec ToSpec(Solution solution)
        {
            var project = solution.FindProject(PublishedBy);

            if (project == null)
            {
                throw new InvalidOperationException(PublishedBy + " is not a valid project name");
            }

            var target = solution.Specifications.SingleOrDefault(x => x.Matches(PackageId));

            if (target == null)
            {
                throw new InvalidOperationException("Solution is not configured to publish " + PackageId);
            }

            var spec = new ProjectNuspec(project, target);

            if (DependsOn.IsNotEmpty())
            {
                var dependencies = DependsOn.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                dependencies.Each(x =>
                {
                    var dependency = solution.Specifications.SingleOrDefault(s => s.Matches(x));
                    if (dependency == null)
                    {
                        throw new InvalidOperationException("Solution is not configured to publish " + x);
                    }

                    spec.AddDependency(dependency);
                });
            }

            return(spec);
        }
        public void SetUp()
        {
            theScenario = SolutionGraphScenario.Create(scenario =>
            {
                scenario.Solution("Test", test =>
                {
                    test.Publishes("Something");
                    test.Publishes("SomeProject");

                    test.SolutionDependency("Bottles", "1.1.0.0", UpdateMode.Fixed);
                    test.SolutionDependency("FubuCore", "1.0.0.0", UpdateMode.Float);
                    test.SolutionDependency("FubuLocalization", "1.8.0.0", UpdateMode.Fixed);

                    test.LocalDependency("Bottles", "1.1.0.255");
                    test.LocalDependency("FubuCore", "1.0.1.244");
                    test.LocalDependency("FubuLocalization", "1.8.0.0");

                    test.ProjectDependency("SomeProject", "Bottles");
                    test.ProjectDependency("SomeProject", "FubuCore");
                    test.ProjectDependency("SomeProject", "FubuLocalization");

                    test.ProjectDependency("JustToBeComplicated", "FubuMVC.Core");
                });
            });

            theSolution = theScenario.Find("Test");

            // Map Something.nuspec to the "JustToBeComplicated" project
            theSolution.Nuspecs.Add(new NuspecMap { File = "Something.nuspec", Project = "JustToBeComplicated"});

            var someProject = theSolution.FindProject("SomeProject");
            var justToBeComplicated = theSolution.FindProject("JustToBeComplicated");

            someProject.AddProjectReference(justToBeComplicated);

            theSolution.FindDependency("FubuLocalization").Constraint = "Current,NextMinor";

            RippleOperation
                .With(theSolution, false)
                .Execute<CreatePackagesInput, LocalNugetCommand>(input =>
                {
                    input.VersionFlag = "1.0.1.244";
                    input.UpdateDependenciesFlag = true;
                });
        }
Esempio n. 5
0
		private static IEnumerable<NugetPlanRequest> parseLine(Solution solution, string[] values)
		{
			var subject = values[0].Trim();
			var tokens = values[1].Split(',').Select(x => x.Trim());

			var project = solution.FindProject(subject);
			if (project != null)
			{
				return projectRequests(solution, project, tokens);
			}

			return nugetRequests(solution, subject, tokens);
		}
        public void installs_the_dependency()
        {
            RippleOperation
                .With(theSolution)
                .Execute<InstallInput, InstallCommand>(x =>
                {
                    x.Package = "FubuCore";
                    x.ProjectFlag = "Test";
                });

            theSolution = SolutionBuilder.ReadFrom(theScenario.DirectoryForSolution("Test"));

            theSolution.FindProject("Test").Dependencies.Has("FubuCore").ShouldBeTrue();
        }
Esempio n. 7
0
        private static IEnumerable <NugetPlanRequest> parseLine(Solution solution, string[] values)
        {
            var subject = values[0].Trim();
            var tokens  = values[1].Split(',').Select(x => x.Trim());

            var project = solution.FindProject(subject);

            if (project != null)
            {
                return(projectRequests(solution, project, tokens));
            }

            return(nugetRequests(solution, subject, tokens));
        }
Esempio n. 8
0
        public ProjectNuspec ToSpec(Solution solution)
        {
            var project = solution.FindProject(Project);
            if (project == null)
            {
                throw new ArgumentOutOfRangeException("Project", Project + " is not a valid project name");
            }

            var spec = solution.Specifications.SingleOrDefault(x => x.MatchesFilename(File));
            if (spec == null)
            {
                throw new ArgumentOutOfRangeException("File", File + " is not a valid nuspec file name");
            }

            return new ProjectNuspec(project, spec);
        }
Esempio n. 9
0
        public ProjectNuspec ToSpec(Solution solution)
        {
            var project = solution.FindProject(Project);

            if (project == null)
            {
                throw new ArgumentOutOfRangeException("Project", Project + " is not a valid project name");
            }

            var spec = solution.Specifications.SingleOrDefault(x => x.MatchesFilename(File));

            if (spec == null)
            {
                throw new ArgumentOutOfRangeException("File", File + " is not a valid nuspec file name");
            }

            return(new ProjectNuspec(project, spec));
        }