public void SetUp() { theSolution = new Solution(); theSolution.ClearFeeds(); theSolution.AddFeed(Feed.Fubu); theSolution.AddFeed(Feed.NuGetV2); theSolution.AddDependency(bottles = new Dependency("Bottles")); theSolution.AddDependency(fubucore = new Dependency("FubuCore", "1.0.1.201")); theSolution.AddDependency(rhinomocks = new Dependency("RhinoMocks", "3.6.1", UpdateMode.Fixed)); theSolution.AddDependency(structuremap = new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed)); RippleEnvironment.StubConnection(true); theFubuFeed = MockRepository.GenerateStub <IFloatingFeed>(); theFubuFeed.Stub(x => x.GetLatest()).Return(new IRemoteNuget[] { new StubNuget("Bottles", "1.0.2.2"), new StubNuget("FubuCore", "1.0.2.232"), new StubNuget("StructureMap", "2.6.4.71"), }); theFubuFeed.Stub(x => x.IsOnline()).Return(true); theNugetFeed = MockRepository.GenerateStub <INugetFeed>(); theNugetFeed.Stub(x => x.Find(rhinomocks)).Return(new StubNuget("RhinoMocks", "3.6.1")); theNugetFeed.Stub(x => x.Find(structuremap)).Return(new StubNuget("StructureMap", "2.6.3")); theNugetFeed.Stub(x => x.IsOnline()).Return(true); theFeedProvider = MockRepository.GenerateStub <IFeedProvider>(); theFeedProvider.Stub(x => x.For(Feed.Fubu)).Return(theFubuFeed); theFeedProvider.Stub(x => x.For(Feed.NuGetV2)).Return(theNugetFeed); FeedRegistry.Stub(theFeedProvider); }
public void offline_just_returns_the_cache() { RippleEnvironment.StubConnection(false); var cachedFeed = theCacheFeed.GetNugetFeed(); theConnectivity.FeedsFor(theSolution).ShouldHaveTheSameElementsAs(cachedFeed); }
public void online_returns_the_cache_first_and_the_feed() { RippleEnvironment.StubConnection(true); var testFeed = theFeed.GetNugetFeed(); var cachedFeed = theCacheFeed.GetNugetFeed(); theConnectivity.FeedsFor(theSolution).ShouldHaveTheSameElementsAs(cachedFeed, testFeed); }
public IEnumerable <INugetFeed> FeedsFor(Solution solution) { var feeds = solution.Feeds.Select(x => x.GetNugetFeed()); if (!RippleEnvironment.Connected() || AllOffline(feeds)) { var cache = solution.Cache.ToFeed(); return(new[] { cache.GetNugetFeed() }); } return(feeds); }
public IEnumerable <INugetFeed> FeedsFor(Solution solution) { yield return(solution.Cache.ToFeed().GetNugetFeed()); var solutionFeeds = solution.Feeds.Select(x => x.GetNugetFeed()).ToArray(); if (RippleEnvironment.Connected() && !AllOffline(solutionFeeds)) { foreach (var feed in solutionFeeds) { yield return(feed); } } }
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 TearDown() { RippleEnvironment.Live(); FeedRegistry.Reset(); }
public void Online() { RippleEnvironment.StubConnection(true); }
public void Offline() { RippleEnvironment.StubConnection(false); }
public void TearDown() { RippleEnvironment.Live(); }