public void SetUp()
        {
            FeedScenario.Create(scenario => scenario.For(Feed.Fubu).Add("FubuCore", "1.0.0.1"));
            FeedScenario.Create(scenario =>
            {
                scenario.For(Feed.NuGetV2)
                        .Add("TopShelf", "1.1.0.0")
                        .Add("log4net", "1.0.0.5")
                        .Add("log4net", "1.0.1.1")
                        .ConfigureRepository(nuget =>
                        {
                            nuget.ConfigurePackage("TopShelf", "1.1.0.0", topshelf => topshelf.DependsOn("log4net"));
                        });
            });

            theScenario = SolutionGraphScenario.Create(scenario => scenario.Solution("Test"));
            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("TopShelf", "1.1.0.0", UpdateMode.Fixed),
                Operation = OperationType.Install,
                Project = "Test"
            };

            thePlan = theBuilder.PlanFor(request);
        }
        public void SetUp()
        {
            theScenario = SolutionGraphScenario.Create(scenario => scenario.Solution("Test"));

            theSolution = theScenario.Find("Test");

            var cache = theSolution.Cache.ToFeed();

            FeedScenario.Create(scenario =>
            {
                scenario.For(cache).Add("FubuCore", "1.0.0.1");
                scenario.Offline();
            });

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("FubuCore", "1.0.0.1", UpdateMode.Fixed),
                Operation = OperationType.Install,
                Project = "Test"
            };

            thePlan = theBuilder.PlanFor(request);
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario =>
                {
                    scenario.For(Feed.Fubu)
                            .Add("FubuCore", "1.1.0.0")
                            .Add("FubuCore", "1.2.0.0");
                });

            theScenario = SolutionScenario.Create(scenario =>
                {
                    scenario.Solution("Test", sln =>
                        {
                            sln.LocalDependency("FubuCore", "1.1.0.0");

                            sln.ProjectDependency("Test1", "FubuCore");
                        });
                });

            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
                {
                    Solution = theSolution,
                    Dependency = new Dependency("FubuCore"),
                    Operation = OperationType.Update,
                    ForceUpdates = false
                };

            thePlan = theBuilder.PlanFor(request);
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario => scenario.For(Feed.Fubu).Add("fubu", "1.2.0.0"));

            theScenario = SolutionGraphScenario.Create(scenario =>
            {
                scenario.Solution("Test", test =>
                {
                    test.SolutionDependency("fubu", "1.0.0.1", UpdateMode.Fixed);
                    test.LocalDependency("fubu", "1.0.0.1");
                });
            });

            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("fubu"),
                Operation = OperationType.Update,
                ForceUpdates = false
            };

            thePlan = theBuilder.PlanFor(request);
        }
        public void SetUp()
        {
            theScenario = SolutionGraphScenario.Create(scenario =>
            {
                scenario.Solution("Test", sln =>
                {
                    sln.LocalDependency("FubuCore", "1.1.0.0");

                    sln.ProjectDependency("Test1", "FubuCore");
                });
            });

            theSolution = theScenario.Find("Test");

            FeedScenario.Create(scenario =>
            {
                scenario.For(theSolution.Cache.ToFeed())
                        .Add("FubuCore", "1.1.0.0")
                        .Add("FubuCore", "1.2.0.0");

                scenario.Offline();
            });

            theBuilder = new NugetPlanBuilder();

            theRequest = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("FubuCore"),
                Operation = OperationType.Update,
                ForceUpdates = false
            };
        }
示例#6
0
        private NugetPlan buildPlan(NugetPlanRequest request, Dependency parent = null, int depth = 0)
        {
            var plan = new NugetPlan();
            var target = request.Dependency;
            var solution = request.Solution;

            var key = target.Copy();
            if (key.IsFloat())
            {
                key = target.AsFloat();
            }

            if (_planCache.Has(key))
            {
                return _planCache[key];
            }

            _planCache.Fill(key, plan);

            RippleLog.Info("* Analyzing " + target);

            if (target.Version.IsEmpty())
            {
                var remote = solution.FeedService.NugetFor(solution, target);
                target.Version = remote.Version.ToString();
            }

            if (request.UpdatesCurrentDependency())
            {
                var configured = solution.Dependencies.Find(target.Name);
                var shouldUpdate = (depth != 0 || request.Operation == OperationType.Update) && (request.ForceUpdates || configured.IsFloat());
                if (shouldUpdate)
                {
                    plan.AddStep(new UpdateDependency(target));
                }
                else
                {
                    RippleLog.Info("Warning: This operation requires {0} to be updated to {1} but it is marked as fixed. Use the force option to correct this.".ToFormat(target.Name, target.Version));
                }
            }
            else if(!solution.Dependencies.Has(target.Name))
            {
                plan.AddStep(new InstallSolutionDependency(target));
            }

            projectInstallations(plan, parent, request);

            var nugetDependencies = solution.FeedService.DependenciesFor(solution, target, target.Mode);
            nugetDependencies.Each(x =>
            {
                var childPlan = buildPlan(request.CopyFor(x), target, depth + 1);
                plan.Import(childPlan);
            });

            return plan;
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario =>
            {
                scenario.For(Feed.Fubu)
                        .Add("Serenity", "1.1.0.0")
                        .Add("Serenity", "1.2.0.0")
                        .ConfigureRepository(fubu =>
                        {
                            fubu.ConfigurePackage("Serenity", "1.1.0.0", serenity => serenity.DependsOn("WebDriver", "1.1.0.0"));
                            fubu.ConfigurePackage("Serenity", "1.2.0.0", serenity =>
                            {
                                serenity.DependsOn("WebDriver", "1.2.0.0");
                                serenity.DependsOn("Something");
                                serenity.DependsOn("SomethingElse", "0.9.9.9");
                            });
                        });

                scenario.For(Feed.NuGetV2)
                        .Add("Something", "1.0.0.5")
                        .Add("SomethingElse", "0.9.9.9")
                        .Add("WebDriver", "1.1.0.0")
                        .Add("WebDriver", "1.2.0.0");
            });

            theScenario = SolutionGraphScenario.Create(scenario =>
            {
                scenario.Solution("Test", sln =>
                {
                    sln.SolutionDependency("WebDriver", "1.1.0.0", UpdateMode.Fixed);
                    sln.SolutionDependency("Serenity", "1.1.0.0", UpdateMode.Float);

                    sln.LocalDependency("Serenity", "1.1.0.0");

                    sln.ProjectDependency("Test1", "Serenity");
                    sln.ProjectDependency("Test1", "WebDriver");

                    sln.ProjectDependency("Test2", "Serenity");
                    sln.ProjectDependency("Test2", "WebDriver");
                });
            });

            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("Serenity"),
                Operation = OperationType.Update,
                ForceUpdates = true
            };

            thePlan = theBuilder.PlanFor(request);
        }
        public void copying_the_request_sets_the_parent()
        {
            var request = new NugetPlanRequest
            {
                Dependency = new Dependency("FubuCore"),
                ForceUpdates = true,
                Operation = OperationType.Update,
            };

            request.CopyFor(new Dependency("Bottles")).Parent.ShouldEqual(request);
        }
        public void copying_the_request_marks_as_transitive()
        {
            var request = new NugetPlanRequest
            {
                Dependency = new Dependency("FubuCore"),
                ForceUpdates = true,
                Operation = OperationType.Update,
            };

            request.CopyFor(new Dependency("Bottles")).IsTransitive().ShouldBeTrue();
        }
        public void is_transitive()
        {
            var request = new NugetPlanRequest
            {
                Dependency = new Dependency("FubuCore"),
                ForceUpdates = true,
                Operation = OperationType.Update,
            };

            request.IsTransitive().ShouldBeFalse();
        }
示例#11
0
        private NugetPlan buildPlan(NugetPlanRequest request, Dependency parent = null)
        {
            var plan     = new NugetPlan();
            var target   = request.Dependency;
            var solution = request.Solution;

            var key = target.Copy();

            if (key.IsFloat())
            {
                key = target.AsFloat();
            }

            if (_planCache.Has(key))
            {
                return(_planCache[key]);
            }

            _planCache.Fill(key, plan);

            RippleLog.Info("* Analyzing " + target);

            if (target.Version.IsEmpty())
            {
                var remote = solution.FeedService.NugetFor(target);
                target.Version = remote.Version.ToString();
            }

            if (request.UpdatesCurrentDependency())
            {
                updateDependency(plan, request);
            }
            else if (!solution.Dependencies.Has(target.Name))
            {
                plan.AddStep(new InstallSolutionDependency(target));
            }

            projectInstallations(plan, parent, request);

            var nugetDependencies = solution.FeedService.DependenciesFor(target, target.Mode);

            nugetDependencies.Each(x =>
            {
                var childPlan = buildPlan(request.CopyFor(x), target);
                plan.Import(childPlan);
            });

            return(plan);
        }
示例#12
0
        private void updateDependency(NugetPlan plan, NugetPlanRequest request)
        {
            var target   = request.Dependency;
            var solution = request.Solution;

            var configured = solution.Dependencies.Find(target.Name);

            if (!request.ShouldUpdate(configured))
            {
                RippleLog.Info("Warning: This operation requires {0} to be updated to {1} but it is marked as fixed. Use the force option to correct this.".ToFormat(target.Name, target.Version));
                return;
            }

            plan.AddStep(new UpdateDependency(target));
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario =>
            {
                scenario.For(Feed.Fubu)
                        .Add("FubuTestingSupport", "1.1.0.0")
                        .Add("FubuTestingSupport", "1.2.0.0")
                        .Add("StructureMap", "2.6.4") // this just makes the test flow easier
                        .ConfigureRepository(fubu =>
                        {
                            fubu.ConfigurePackage("FubuTestingSupport", "1.2.0.0", support =>
                            {
                                support.DependsOn("StructureMap").Min("2.6.4");
                            });
                        });

                scenario.For(Feed.NuGetV2)
                    .Add("structuremap", "2.6.3");
            });

            theScenario = SolutionGraphScenario.Create(scenario =>
            {
                scenario.Solution("Test", sln =>
                {
                    sln.LocalDependency("FubuTestingSupport", "1.1.0.0");
                    sln.LocalDependency("structuremap", "2.6.3");

                    sln.SolutionDependency("structuremap", "2.6.3", UpdateMode.Fixed);

                    sln.ProjectDependency("Test1", "FubuTestingSupport");
                    sln.ProjectDependency("Test1", "structuremap");
                });
            });

            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("FubuTestingSupport"),
                Operation = OperationType.Update,
                ForceUpdates = false
            };

            thePlan = theBuilder.PlanFor(request);
        }
示例#14
0
        private NugetPlan buildPlan(NugetPlanRequest request, Dependency parent = null)
        {
            var plan = new NugetPlan();
            var target = request.Dependency;
            var solution = request.Solution;

            var key = target.Copy();
            if (key.IsFloat())
            {
                key = target.AsFloat();
            }

            if (_planCache.Has(key))
            {
                return _planCache[key];
            }

            _planCache.Fill(key, plan);

            RippleLog.Info("* Analyzing " + target);

            if (target.Version.IsEmpty())
            {
                var remote = solution.FeedService.NugetFor(target);
                target.Version = remote.Version.ToString();
            }

            if (request.UpdatesCurrentDependency())
            {
                updateDependency(plan, request);
            }
            else if(!solution.Dependencies.Has(target.Name))
            {
                plan.AddStep(new InstallSolutionDependency(target));
            }

            projectInstallations(plan, parent, request);

            var nugetDependencies = solution.FeedService.DependenciesFor(target, target.Mode);
            nugetDependencies.Each(x =>
            {
                var childPlan = buildPlan(request.CopyFor(x), target);
                plan.Import(childPlan);
            });

            return plan;
        }
示例#15
0
        public void copy_for_dependency()
        {
            var solution = new Solution();
            var request = new NugetPlanRequest
            {
                Dependency = new Dependency("FubuCore"),
                ForceUpdates = true,
                Operation = OperationType.Update,
                Solution = solution
            };

            var copied = request.CopyFor(new Dependency("Bottles"));
            copied.Dependency.Name.ShouldEqual("Bottles");
            copied.ForceUpdates.ShouldEqual(request.ForceUpdates);
            copied.Operation.ShouldEqual(request.Operation);
            copied.Solution.ShouldEqual(request.Solution);
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario =>
            {
                scenario.For(Feed.Fubu)
                        .Add("FubuMVC.Katana", "1.0.0.1")
                        .Add("FubuMVC.Core", "1.0.1.1")
                        .Add("FubuMVC.Core", "1.1.0.2")
                        .Add("FubuMVC.OwinHost", "1.2.0.0")
                        .Add("FubuMVC.OwinHost", "1.3.0.0")
                        .ConfigureRepository(teamcity =>
                        {
                            teamcity.ConfigurePackage("FubuMVC.Katana", "1.0.0.1", katana =>
                            {
                                katana.DependsOn("FubuMVC.Core");
                                katana.DependsOn("FubuMVC.OwinHost");
                            });

                            teamcity.ConfigurePackage("FubuMVC.OwinHost", "1.2.0.0", owin => owin.DependsOn("FubuMVC.Core"));
                            teamcity.ConfigurePackage("FubuMVC.OwinHost", "1.3.0.0", owin =>
	                        {
		                        owin.DependsOn("FubuMVC.Core");
		                        owin.DependsOn("FixedNuget");
	                        });
                        });

	            scenario.For(Feed.NuGetV2)
	                    .Add("FixedNuget", "1.0.0.0");
            });

            theScenario = SolutionScenario.Create(scenario => scenario.Solution("Test"));
            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("FubuMVC.Katana", UpdateMode.Float),
                Operation = OperationType.Install,
                Project = "Test"
            };

            thePlan = theBuilder.PlanFor(request);
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario => scenario.For(Feed.NuGetV2).Add("fubu", "1.2.0.0"));

            theScenario = SolutionScenario.Create(scenario => scenario.Solution("Test"));
            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("fubu", "1.2.0.0", UpdateMode.Fixed),
                Operation = OperationType.Install
            };

            thePlan = theBuilder.PlanFor(request);
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario => scenario.For(Feed.Fubu).Add("FubuCore", "1.0.0.1"));

            theScenario = SolutionScenario.Create(scenario => scenario.Solution("Test"));

            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("FubuCore", "1.0.0.1", UpdateMode.Fixed),
                Operation = OperationType.Install,
                Project = "Test"
            };

            thePlan = theBuilder.PlanFor(request);
        }
示例#19
0
        private void projectInstallations(NugetPlan plan, Dependency parent, NugetPlanRequest request)
        {
            var target   = request.Dependency;
            var solution = request.Solution;

            if (request.InstallToProject())
            {
                var project = solution.FindProject(request.Project);
                installToProject(plan, project, target);
            }

            if (parent == null)
            {
                return;
            }

            var projects = solution.Projects.Where(x => x.Dependencies.Has(parent.Name));

            projects.Each(project => installToProject(plan, project, target));
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario =>
                {
                    scenario.For(Feed.NuGetV2)
                            .Add("FubuCore", "1.2.0.0")
                            .Add("FubuCore", "1.3.0.0")
                            .Add("Bottles", "1.1.0.0")
                            .ConfigureRepository(nuget =>
                                {
                                    nuget.ConfigurePackage("Bottles", "1.1.0.0", bottles => bottles.DependsOn("FubuCore").Min("1.3.0.0"));
                                });
                });

            theScenario = SolutionScenario.Create(scenario =>
                {
                    scenario.Solution("Test", test =>
                        {
                            test.ProjectDependency("Test", "FubuCore");
                            test.LocalDependency("FubuCore", "1.2.0.0");
                            test.SolutionDependency("FubuCore", "1.2.0.0", UpdateMode.Fixed);
                        });
                });

            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
                {
                    Solution = theSolution,
                    Dependency = new Dependency("Bottles", "1.1.0.0", UpdateMode.Fixed),
                    Operation = OperationType.Install,
                    ForceUpdates = false,
                    Project = "Test"
                };

            thePlan = theBuilder.PlanFor(request);
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario =>
            {
                scenario.For(Feed.NuGetV2)
                    // Omitting this effectively says "FubuCore" doesn't exist in the feed
                    // so we force it to use the local version instead
                    //.Add("FubuCore", "1.2.0.0")
                    .Add("Bottles", "1.1.0.0")
                    .ConfigureRepository(nuget =>
                    {
                        nuget.ConfigurePackage("Bottles", "1.1.0.0", bottles => bottles.DependsOn("FubuCore", "1.2.0.0"));
                    });
            });

            theScenario = SolutionScenario.Create(scenario =>
            {
                scenario.Solution("Test", test =>
                {
                    test.SolutionDependency("FubuCore", "1.2.0.0", UpdateMode.Float);
                    test.ProjectDependency("Test", "FubuCore");
                    test.LocalDependency("FubuCore", "1.2.0.0");
                });
            });

            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
            {
                Solution = theSolution,
                Dependency = new Dependency("Bottles", "1.1.0.0", UpdateMode.Fixed),
                Operation = OperationType.Install,
                Project = "Test"
            };

            thePlan = theBuilder.PlanFor(request);
        }
示例#22
0
        public void SetUp()
        {
            thePlanBuilder = MockRepository.GenerateStub<INugetPlanBuilder>();

            var r1 = new NugetPlanRequest { Dependency = new Dependency("d1")};
            var r2 = new NugetPlanRequest { Dependency = new Dependency("d2") };
            var r3 = new NugetPlanRequest { Dependency = new Dependency("d3") };

            s1 = MockRepository.GenerateStub<INugetStep>();
            s2 = MockRepository.GenerateStub<INugetStep>();
            s3 = MockRepository.GenerateStub<INugetStep>();

            thePlanBuilder.Stub(x => x.PlanFor(r1)).Return(new NugetPlan(s1));
            thePlanBuilder.Stub(x => x.PlanFor(r2)).Return(new NugetPlan(s2));
            thePlanBuilder.Stub(x => x.PlanFor(r3)).Return(new NugetPlan(s3));
            
            theSolution = new Solution();
            theSolution.UseBuilder(thePlanBuilder);
            theSolution.UseStorage(new StubNugetStorage());

            var input = new StubNugetOperationContext(r1, r2, r3);
            new NugetOperation { Solution = theSolution}.Execute(input, null);
        }
        public void SetUp()
        {
            FeedScenario.Create(scenario =>
            {
                scenario.For(Feed.NuGetV2)
                        .Add("FubuCore", "1.2.0.0-alpha");
            });

            theScenario = SolutionScenario.Create(scenario => scenario.Solution("Test"));

            theSolution = theScenario.Find("Test");

            theBuilder = new NugetPlanBuilder();

            var request = new NugetPlanRequest
                {
                    Solution = theSolution,
                    Dependency = new Dependency("FubuCore", "1.2.0.0", UpdateMode.Fixed) { NugetStability = NugetStability.Anything },
                    Operation = OperationType.Install,
                    Project = "Test"
                };

            thePlan = theBuilder.PlanFor(request);
        }
        public void should_update_forced_transitive_install()
        {
            var request = new NugetPlanRequest
            {
                Dependency = new Dependency("FubuCore"),
                ForceUpdates = true,
                Operation = OperationType.Install,
            };

            request.CopyFor(new Dependency("Bottles", "1.0.0.0", UpdateMode.Fixed)).ShouldUpdate(new Dependency("Bottles")).ShouldBeTrue();
        }
        public void should_update_forced_update()
        {
            var request = new NugetPlanRequest
            {
                Dependency = new Dependency("FubuCore"),
                ForceUpdates = true,
                Operation = OperationType.Update,
            };

            request.ShouldUpdate(new Dependency("FubuCore", "1.0.0.0", UpdateMode.Fixed)).ShouldBeTrue();
        }
示例#26
0
 public NugetPlan PlanFor(NugetPlanRequest request)
 {
     return(buildPlan(request));
 }
示例#27
0
        private void projectInstallations(NugetPlan plan, Dependency parent, NugetPlanRequest request)
        {
            var target = request.Dependency;
            var solution = request.Solution;

            if (request.InstallToProject())
            {
                var project = solution.FindProject(request.Project);
                installToProject(plan, project, target);
            }

            if (parent == null) return;

            var projects = solution.Projects.Where(x => x.Dependencies.Has(parent.Name));
            projects.Each(project => installToProject(plan, project, target));
        }
示例#28
0
 protected bool Equals(NugetPlanRequest other)
 {
     return Equals(Solution, other.Solution) && Equals(Dependency, other.Dependency) && Operation == other.Operation;
 }
        public void original_dependency_recursive()
        {
            var request = new NugetPlanRequest
            {
                Dependency = new Dependency("FubuCore"),
                ForceUpdates = false,
                Operation = OperationType.Install,
            };

            request.CopyFor(new Dependency("Bottles"))
                   .CopyFor(new Dependency("Something"))
                   .Origin()
                   .ShouldEqual(request.Dependency);
        }
        public void should_not_force_update_for_the_original_dependency_when_batched()
        {
            var request = new NugetPlanRequest
            {
                Dependency = new Dependency("FubuCore"),
                ForceUpdates = false,
                Batched = true,
                Operation = OperationType.Install,
            };

            request.CopyFor(new Dependency("Bottles"))
                   .CopyFor(new Dependency("Something"))
                   .ShouldForce(request.Dependency)
                   .ShouldBeFalse();
        }
示例#31
0
        private void updateDependency(NugetPlan plan, NugetPlanRequest request)
        {
            var target = request.Dependency;
            var solution = request.Solution;

            var configured = solution.Dependencies.Find(target.Name);

            if (!request.ShouldUpdate(configured))
            {
                RippleLog.Info("Warning: This operation requires {0} to be updated to {1} but it is marked as fixed. Use the force option to correct this.".ToFormat(target.Name, target.Version));
                return;
            }

            plan.AddStep(new UpdateDependency(target));
        }
示例#32
0
 public NugetPlan PlanFor(NugetPlanRequest request)
 {
     return buildPlan(request);
 }
示例#33
0
        private NugetPlan buildPlan(NugetPlanRequest request, Dependency parent = null)
        {
            var plan     = new NugetPlan();
            var target   = request.Dependency;
            var solution = request.Solution;

            var dependencyKey = target.Copy();

            if (dependencyKey.IsFloat())
            {
                dependencyKey = target.AsFloat();
            }

            var key = new PlanKey(dependencyKey, request.Project);

            if (_planCache.Has(key))
            {
                return(_planCache[key]);
            }

            _planCache.Fill(key, plan);

            RippleLog.Info("* Analyzing " + target);

            if (target.Version.IsEmpty())
            {
                string version = null;
                var    local   = solution.LocalDependencies();

                if (request.Operation == OperationType.Install && solution.LocalDependencies().Has(target))
                {
                    var localNuget = local.Get(target);
                    version = localNuget.Version.ToString();
                }
                else
                {
                    if (!RippleEnvironment.Connected())
                    {
                        RippleAssert.Fail("Cannot update in offline mode");
                    }

                    var task = solution.FeedService.NugetFor(target);
                    task.Wait();

                    if (!task.Result.Found)
                    {
                        RippleAssert.Fail("Could not find " + request.Dependency);
                    }
                    var remote = task.Result.Nuget;
                    version = remote.Version.ToString();
                }

                target.Version = version;
            }

            if (request.UpdatesCurrentDependency())
            {
                updateDependency(plan, request);
            }
            else if (!solution.Dependencies.Has(target.Name))
            {
                plan.AddStep(new InstallSolutionDependency(target));
            }

            projectInstallations(plan, parent, request);

            var location = request.Operation == OperationType.Install ? SearchLocation.Local : SearchLocation.Remote;

            var nugetDependencies = solution.FeedService.DependenciesFor(target, target.Mode, location);

            nugetDependencies.Each(x =>
            {
                var transitiveDep = request.CopyFor(x);
                var childPlan     = buildPlan(transitiveDep, target);
                plan.Import(childPlan);
            });

            return(plan);
        }
示例#34
0
        private NugetPlan buildPlan(NugetPlanRequest request, Dependency parent = null)
        {
            var plan = new NugetPlan();
            var target = request.Dependency;
            var solution = request.Solution;

            var dependencyKey = target.Copy();
            if (dependencyKey.IsFloat())
            {
                dependencyKey = target.AsFloat();
            }

            var key = new PlanKey(dependencyKey, request.Project);
            if (_planCache.Has(key))
            {
                return _planCache[key];
            }

            _planCache.Fill(key, plan);

            RippleLog.Info("* Analyzing " + target);

            if (target.Version.IsEmpty())
            {
                string version = null;
                var local = solution.LocalDependencies();

                if (request.Operation == OperationType.Install && solution.LocalDependencies().Has(target))
                {
                    var localNuget = local.Get(target);
                    version = localNuget.Version.ToString();
                }
                else
                {
                    if (!RippleEnvironment.Connected())
                    {
                        RippleAssert.Fail("Cannot update in offline mode");
                    }

                    var task = solution.FeedService.NugetFor(target);
                    task.Wait();

                    if (!task.Result.Found)
                    {
                        RippleAssert.Fail("Could not find " + request.Dependency);
                    }
                    var remote = task.Result.Nuget;
                    version = remote.Version.ToString();
                }

                target.Version = version;
            }

            if (request.UpdatesCurrentDependency())
            {
                updateDependency(plan, request);
            }
            else if (!solution.Dependencies.Has(target.Name))
            {
                plan.AddStep(new InstallSolutionDependency(target));
            }

            projectInstallations(plan, parent, request);

            var location = request.Operation == OperationType.Install ? SearchLocation.Local : SearchLocation.Remote;

            var nugetDependencies = solution.FeedService.DependenciesFor(target, target.Mode, location);
            nugetDependencies.Each(x =>
            {
                var transitiveDep = request.CopyFor(x);
                var childPlan = buildPlan(transitiveDep, target);
                plan.Import(childPlan);
            });

            return plan;
        }
        public void original_dependency()
        {
            var request = new NugetPlanRequest
            {
                Dependency = new Dependency("FubuCore"),
                ForceUpdates = false,
                Operation = OperationType.Install,
            };

            request.Origin().ShouldEqual(request.Dependency);
        }
示例#36
0
 protected bool Equals(NugetPlanRequest other)
 {
     return(Equals(Solution, other.Solution) && Equals(Dependency, other.Dependency) && Operation == other.Operation);
 }