private Task<NugetResult> findDependenciesFor(Dependency dependency, UpdateMode mode, int depth, SearchLocation location, List<Dependency> dependencies) { var result = findLocal(dependency, location); return Task.Factory.StartNew(() => { if (result.Found) { processNuget(result.Nuget, dependency, mode, depth, location, dependencies); return result; } var search = NugetSearch.Find(_solution, dependency); search.ContinueWith(task => { if (!task.Result.Found) { return; } result.Import(task.Result); var nuget = task.Result.Nuget; processNuget(nuget, dependency, mode, depth, location, dependencies); }, TaskContinuationOptions.NotOnFaulted | TaskContinuationOptions.AttachedToParent); return result; }, TaskCreationOptions.AttachedToParent); }
public static bool IsUpdateFor(this IRemoteNuget nuget, Dependency dependency) { var version = dependency.SemanticVersion(); if (version == null) return false; return nuget.Version > version; }
public void project_level_dependency() { var dependency = new Dependency("FubuCore", "1.2.0.0", UpdateMode.Fixed); theRunner.AddProjectDependency("Project1", dependency); theProject.Dependencies.Find("FubuCore").ShouldEqual(dependency.AsFloat()); }
public NugetPlanRequest CopyFor(Dependency dependency) { var request = (NugetPlanRequest) MemberwiseClone(); request.Dependency = dependency; return request; }
public void make_float() { var dependency = new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed); dependency.Float(); dependency.IsFloat().ShouldBeTrue(); }
public void solution_level_dependency() { var dependency = new Dependency("FubuCore", "1.2.0.0", UpdateMode.Fixed); theRunner.AddSolutionDependency(dependency); theSolution.Dependencies.Find("FubuCore").ShouldEqual(dependency); }
public NugetResult Find(Solution solution, Dependency dependency) { var cache = FeedRegistry.CacheFor(solution); var nuget = cache.Find(dependency); return new NugetResult { Nuget = nuget }; }
private void theVersionIs(Dependency dependency, string version) { var task = theSolution.Restore(dependency); task.Wait(); task.Result.Nuget.Version.ShouldEqual(new SemanticVersion(version)); }
public void SetUp() { theSolution = new Solution(); theSolution.ClearFeeds(); theSolution.AddFeed(Feed.Fubu); theSolution.AddFeed(Feed.NuGetV2); theSolution.AddDependency(fubucore = new Dependency("FubuCore", "1.0.1.201")); var theProject = new Project("Test.csproj"); theSolution.AddProject(theProject); theProject.AddDependency(bottles = new Dependency("Bottles")); theProject.AddDependency(rhinomocks = new Dependency("RhinoMocks", "3.6.1", UpdateMode.Fixed)); theProject.AddDependency(structuremap = new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed)); FeedScenario.Create(scenario => { scenario.For(Feed.Fubu) .Add("Bottles", "1.0.2.2") .Add("FubuCore", "1.0.2.232") .Add("StructureMap", "2.6.4.71"); scenario.For(Feed.NuGetV2) .Add("RhinoMocks", "3.6.1") .Add("StructureMap", "2.6.3"); scenario.For(theSolution.Cache.ToFeed()); scenario.Online(); }); }
public virtual IRemoteNuget NugetFor(Solution solution, Dependency dependency) { IRemoteNuget nuget = null; var feeds = feedsFor(solution); foreach (var feed in feeds) { nuget = getLatestFromFloatingFeed(feed, dependency); if (nuget != null) break; if (dependency.IsFloat() || dependency.Version.IsEmpty()) { nuget = feed.FindLatest(dependency); if (nuget != null) break; } nuget = feed.Find(dependency); if (nuget != null) break; } if (nuget == null) { RippleAssert.Fail("Could not find " + dependency); } return remoteOrCached(solution, nuget); }
public static Task<NugetResult> Find(Solution solution, Dependency dependency) { var finders = Finders.Where(x => x.Matches(dependency)).ToArray(); var search = new NugetSearch(finders); return search.FindDependency(solution, dependency); }
public void UpdateDependency(Dependency dependency) { var existing = _solution.Dependencies.Find(dependency.Name); dependency.Mode = existing.Mode; _solution.UpdateDependency(dependency); }
public void persists_and_retrieves_the_solution() { var solution = new Solution { Name = "Test", BuildCommand = "rake", FastBuildCommand = "rake compile", Feeds = new[] { Feed.NuGetV2, Feed.NuGetV1 }, Nugets = new[] { new Dependency("FubuCore", "1.0.1.0") } }; var group = new DependencyGroup(); group.Dependencies.Add(new GroupedDependency("FubuCore")); solution.Groups.Add(group); var constrainedDependency = new Dependency("Bottles", "1.0.0.0") { VersionConstraint = VersionConstraint.DefaultFloat }; solution.AddDependency(constrainedDependency); solution.Nuspecs.Add(new NuspecMap { File = "Temp", Project = "Test"}); CheckXmlPersistence.For(solution); }
public void SetUp() { theSolution = new Solution(); theSolution.ClearFeeds(); theSolution.AddFeed(Feed.Fubu); theSolution.AddFeed(Feed.NuGetV2); theSolution.AddDependency(fubucore = new Dependency("FubuCore", "1.0.1.201")); var theProject = new Project("Test.csproj"); theSolution.AddProject(theProject); theProject.AddDependency(bottles = new Dependency("Bottles")); theProject.AddDependency(rhinomocks = new Dependency("RhinoMocks", "3.6.1", UpdateMode.Fixed)); theProject.AddDependency(structuremap = new Dependency("StructureMap", "2.6.3", UpdateMode.Fixed)); 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"), }); 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")); 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 equals_uses_semantic_version() { var dep1 = new Dependency("structuremap", "2.6.3"); var dep2 = new Dependency("structuremap", "2.6.3.0"); dep1.ShouldEqual(dep2); dep2.ShouldEqual(dep1); }
public void falls_back_to_default_constraint_for_float() { var dep = new Dependency("FubuCore", UpdateMode.Float); var solution = new Solution(); solution.AddDependency(dep); solution.ConstraintFor(dep).ShouldEqual(solution.NuspecSettings.Float); }
public void SetUp() { theDependency = new Dependency("Test"); theStep = new UpdateDependency(theDependency); theRunner = MockRepository.GenerateStub<INugetStepRunner>(); theStep.Execute(theRunner); }
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 finds_the_dependency_from_a_child_collection() { var projectDependency = new Dependency("Bottles"); var projectDependencies = new DependencyCollection(); projectDependencies.Add(projectDependency); theSolutionDependencies.AddChild(projectDependencies); theSolutionDependencies.Find("Bottles").ShouldEqual(projectDependency); }
public void updating_solution_level_dependencies() { var oldDependency = new Dependency("FubuCore", "1.2.0.0", UpdateMode.Fixed); theSolution.AddDependency(oldDependency); var newDependency = new Dependency("FubuCore", "1.3.0.0", UpdateMode.Fixed); theRunner.UpdateDependency(newDependency); theSolution.Dependencies.Find("FubuCore").ShouldEqual(newDependency); }
public void SetUp() { theDependency = new Dependency("Test"); theProject = "Project1"; theStep = new InstallProjectDependency(theProject, theDependency); theRunner = MockRepository.GenerateStub<INugetStepRunner>(); theStep.Execute(theRunner); }
public INugetFile Latest(Dependency query) { IEnumerable<INugetFile> files = Dependencies.Where(x => x.Name == query.Name).ToList(); if (query.Stability == NugetStability.ReleasedOnly) { files = files.Where(x => x.Version.SpecialVersion.IsEmpty()); } return files.OrderByDescending(x => x.Version).FirstOrDefault(); }
protected override IRemoteNuget findLatest(Dependency query) { var floatedResult = GetLatest().SingleOrDefault(x => query.MatchesName(x.Name)); if (floatedResult != null && query.Mode == UpdateMode.Fixed && floatedResult.IsUpdateFor(query)) { return null; } return floatedResult; }
public IRemoteNuget Find(Dependency query) { if (query.IsFloat() || query.Version.IsEmpty()) { return _nugets.FirstOrDefault(x => x.Name == query.Name); } var version = SemanticVersion.Parse(query.Version); return _nugets.FirstOrDefault(x => x.Name == query.Name && x.Version.Equals(version)); }
public void updating_a_solution_level_dependency_forces_a_restore() { var oldDependency = new Dependency("FubuCore", "1.2.0.0", UpdateMode.Fixed); theSolution.AddDependency(oldDependency); var newDependency = new Dependency("FubuCore", "1.3.0.0", UpdateMode.Fixed); theRunner.UpdateDependency(newDependency); theSolution.RestoreSettings.ShouldForce(new Dependency("FubuCore")).ShouldBeTrue(); }
public bool ShouldForce(Dependency dependency) { if (!_filters.Any()) { return _forceAll; } return _filters.Any(x => x(dependency)); }
private static Task restore(Dependency query, Solution solution, List<INugetFile> nugets) { return Task.Factory.StartNew(() => { var nuget = solution.Restore(query); RippleLog.Debug("Downloading " + nuget); nugets.Add(nuget.DownloadTo(solution, solution.PackagesDirectory())); }); }
public IRemoteNuget Find(Dependency query) { var feed = GetNugetFeed(); if (Mode == UpdateMode.Float || query.IsFloat()) { return feed.FindLatest(query); } return feed.Find(query); }
public IRemoteNuget Find(Dependency query) { SemanticVersion version; if (!SemanticVersion.TryParse(query.Version, out version)) { RippleLog.Debug("Could not find exact for " + query); return null; } return findMatching(nuget => nuget.Name == query.Name && nuget.Version == version); }
public void find_the_async_package() { var asyncTargetPack = new Dependency("Microsoft.CompilerServices.AsyncTargetingPack"); var solution = new Solution(); solution.AddDependency(asyncTargetPack); var task = NugetSearch.Find(solution, asyncTargetPack); task.Wait(); task.Result.Nuget.Version.ShouldEqual(new SemanticVersion("1.0.1")); }
public bool MatchesName(Dependency dependency) { return(MatchesName(dependency.Name)); }
public virtual IRemoteNuget NugetFor(Dependency dependency) { return(_nugetForCache[dependency]); }
public void AddDependency(Dependency dependency) { _dependencies.Add(dependency); }
public bool Matches(Dependency dependency, string assembly) { return(dependency.MatchesName(Package) && Assembly.Replace(".dll", "").EqualsIgnoreCase(assembly)); }