Skip to content

Commit

Permalink
checkpoint: operations complete
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarnold committed Apr 22, 2013
1 parent 3949f63 commit 043dd68
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using FubuTestingSupport;
using System.Diagnostics;
using FubuCore.Descriptions;
using FubuTestingSupport;
using NUnit.Framework;
using ripple.Model;
using ripple.Nuget;
Expand Down Expand Up @@ -34,6 +36,7 @@ public void SetUp()
{
test.ProjectDependency("Test", "FubuCore");
test.LocalDependency("FubuCore", "1.2.0.0");
test.SolutionDependency("FubuCore", "1.2.0.0", UpdateMode.Fixed);
});
});

Expand Down Expand Up @@ -63,6 +66,7 @@ public void TearDown()
[Test]
public void installs_the_new_package_but_does_not_update_the_existing()
{
Debug.WriteLine(thePlan.ToDescriptionText());
thePlan.ShouldHaveTheSameElementsAs(
solutionInstallation("Bottles", "1.1.0.0", UpdateMode.Fixed),
projectInstallation("Test", "Bottles")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using System.Diagnostics;
using FubuCore.Descriptions;
using FubuTestingSupport;
using NUnit.Framework;
using ripple.Model;
using ripple.Nuget;

namespace ripple.Testing.Nuget.Operations
{
// This one will bite us in EVERY SINGLE repository so make sure it's always passing
[TestFixture]
public class updating_an_existing_dependency_with_transitive_dependencies_case_insensitive : NugetOperationContext
{
private SolutionGraphScenario theScenario;
private Solution theSolution;
private NugetPlan thePlan;
private NugetPlanBuilder theBuilder;

[SetUp]
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);
}

[TearDown]
public void TearDown()
{
theScenario.Cleanup();
FeedRegistry.Reset();
}

[Test]
public void verify_plan()
{
Debug.WriteLine(thePlan.ToDescriptionText());
thePlan.ShouldHaveTheSameElementsAs(
updateSolutionDependency("FubuTestingSupport", "1.2.0.0", UpdateMode.Float)
);
}
}
}
1 change: 1 addition & 0 deletions src/ripple.Testing/ripple.Testing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
<Compile Include="Nuget\Operations\NugetOperationContext.cs" />
<Compile Include="Nuget\Operations\update_an_existing_floated_dependency.cs" />
<Compile Include="Nuget\Operations\update_an_existing_floated_dependency_with_new_transitive_dependencies.cs" />
<Compile Include="Nuget\Operations\updating_an_existing_dependency_with_transitive_dependencies_case_insensitive.cs" />
<Compile Include="Nuget\Operations\updating_to_a_higher_version_of_an_existing_fixed_solution_dependency.cs" />
<Compile Include="Nuget\Operations\installing_a_new_fixed_solution_dependency.cs" />
<Compile Include="Nuget\Operations\installing_a_new_solution_dependency.cs" />
Expand Down
6 changes: 3 additions & 3 deletions src/ripple/Model/DependencyCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void Add(Dependency dependency)

public void Remove(string name)
{
var dependency = _dependencies.SingleOrDefault(x => x.Name == name);
var dependency = _dependencies.SingleOrDefault(x => x.Name.EqualsIgnoreCase(name));
if (dependency != null)
{
_dependencies.Remove(dependency);
Expand Down Expand Up @@ -82,15 +82,15 @@ public bool Has(string name)

public Dependency Find(string name)
{
var topLevel = _dependencies.SingleOrDefault(x => x.Name == name);
var topLevel = _dependencies.SingleOrDefault(x => x.Name.EqualsIgnoreCase(name));
if (topLevel != null)
{
return topLevel;
}

return _children
.SelectMany(x => x._dependencies)
.FirstOrDefault(x => x.Name == name);
.FirstOrDefault(x => x.Name.EqualsIgnoreCase(name));
}

public IEnumerator<Dependency> GetEnumerator()
Expand Down
3 changes: 2 additions & 1 deletion src/ripple/Nuget/NugetPlanBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ private NugetPlan buildPlan(NugetPlanRequest request, Dependency parent = null,

if (request.UpdatesCurrentDependency())
{
var shouldUpdate = (depth != 0 || request.Operation == OperationType.Update) && (request.ForceUpdates || target.IsFloat());
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));
Expand Down

0 comments on commit 043dd68

Please sign in to comment.