diff --git a/.gitignore b/.gitignore index 356b760..ea597dd 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ ripple_exe *.gem Gemfile.lock src/ripple.Docs/pak-WebContent.zip +*.orig diff --git a/ripple.config b/ripple.config index 32f7064..49b16d3 100644 --- a/ripple.config +++ b/ripple.config @@ -15,7 +15,7 @@ - + diff --git a/src/ripple.Testing/Commands/InitInputTester.cs b/src/ripple.Testing/Commands/InitInputTester.cs index f6855b8..038d59e 100644 --- a/src/ripple.Testing/Commands/InitInputTester.cs +++ b/src/ripple.Testing/Commands/InitInputTester.cs @@ -1,99 +1,73 @@ -using FubuTestingSupport; -using NUnit.Framework; -using ripple.Commands; -using ripple.Model; - -namespace ripple.Testing.Commands -{ - [TestFixture] - public class InitInputTester - { - private InitInput theInput; - - [SetUp] - public void SetUp() - { - theInput = new InitInput(); - } - - private Solution theSolution { get { return theInput.ToSolution(); } } - - [Test] - public void sets_the_name() - { - theInput.Name = "Test"; - theSolution.Name.ShouldEqual(theInput.Name); - } - - [Test] - public void default_src_folder() - { - theSolution.SourceFolder.ShouldEqual("src"); - } - - [Test] - public void custom_src_folder() - { - theInput.SourceFolderFlag = "source"; - theSolution.SourceFolder.ShouldEqual(theInput.SourceFolderFlag); - } - - [Test] - public void default_nuspec_folder() - { - theSolution.NugetSpecFolder.ShouldEqual("packaging/nuget"); - } - - [Test] - public void custom_nuspec_folder() - { - theInput.NuspecFolderFlag = "nuspecs"; - theSolution.NugetSpecFolder.ShouldEqual(theInput.NuspecFolderFlag); - } - - [Test] - public void default_build_command() - { - theSolution.BuildCommand.ShouldEqual("rake"); - } - - [Test] - public void custom_build_command() - { - theInput.BuildCommandFlag = "psake"; - theSolution.BuildCommand.ShouldEqual(theInput.BuildCommandFlag); - } - - [Test] - public void default_fast_build_command() - { - theSolution.FastBuildCommand.ShouldEqual("rake compile"); - } - - [Test] - public void custom_fast_build_command() - { - theInput.FastBuildCommandFlag = "psake compile"; - theSolution.FastBuildCommand.ShouldEqual(theInput.FastBuildCommandFlag); - } - - [Test] - public void default_feeds() - { - theSolution.Feeds.ShouldHaveTheSameElementsAs(Feed.Fubu, Feed.NuGetV2); - } - - [Test] - public void custom_feeds() - { - theInput.FeedsFlag = "test1#test2"; - theSolution.Feeds.ShouldHaveTheSameElementsAs(new Feed("test1"), new Feed("test2")); - } - - [Test] - public void default_cache() - { - theSolution.NugetCacheDirectory.ShouldBeNull(); - } - } +using FubuTestingSupport; +using NUnit.Framework; +using ripple.Commands; +using ripple.Model; + +namespace ripple.Testing.Commands +{ + [TestFixture] + public class InitInputTester + { + private InitInput theInput; + + [SetUp] + public void SetUp() + { + theInput = new InitInput(); + } + + private Solution theSolution { get { return theInput.ToSolution(); } } + + [Test] + public void sets_the_name() + { + theInput.Name = "Test"; + theSolution.Name.ShouldEqual(theInput.Name); + } + + [Test] + public void default_src_folder() + { + theSolution.SourceFolder.ShouldEqual("src"); + } + + [Test] + public void custom_src_folder() + { + theInput.SourceFolderFlag = "source"; + theSolution.SourceFolder.ShouldEqual(theInput.SourceFolderFlag); + } + + [Test] + public void default_nuspec_folder() + { + theSolution.NugetSpecFolder.ShouldEqual("packaging/nuget"); + } + + [Test] + public void custom_nuspec_folder() + { + theInput.NuspecFolderFlag = "nuspecs"; + theSolution.NugetSpecFolder.ShouldEqual(theInput.NuspecFolderFlag); + } + + [Test] + public void default_feeds() + { + theSolution.Feeds.ShouldHaveTheSameElementsAs(Feed.Fubu, Feed.NuGetV2); + } + + [Test] + public void custom_feeds() + { + theInput.FeedsFlag = "test1#test2"; + theSolution.Feeds.ShouldHaveTheSameElementsAs(new Feed("test1"), new Feed("test2")); + } + + [Test] + public void default_cache() + { + theSolution.NugetCacheDirectory.ShouldBeNull(); + } + } } \ No newline at end of file diff --git a/src/ripple.Testing/Commands/UpdateInputTester.cs b/src/ripple.Testing/Commands/UpdateInputTester.cs index eb0a160..d615e64 100644 --- a/src/ripple.Testing/Commands/UpdateInputTester.cs +++ b/src/ripple.Testing/Commands/UpdateInputTester.cs @@ -78,10 +78,10 @@ public void requests_for_entire_solution() public void requests_for_a_single_dependency_in_a_group() { var group = new DependencyGroup(); - group.Dependencies.Add(new GroupedDependency("FubuCore")); - group.Dependencies.Add(new GroupedDependency("FubuLocalization")); + group.Add(new GroupedDependency("FubuCore")); + group.Add(new GroupedDependency("FubuLocalization")); - theSolution.Groups.Add(group); + theSolution.AddGroup(group); theInput.NugetFlag = "FubuCore"; var requests = theInput.Requests(theSolution).ToArray(); @@ -97,14 +97,14 @@ public void requests_for_a_single_dependency_in_a_group() public void requests_for_a_single_dependency_in_multiple_groups() { var g1 = new DependencyGroup(); - g1.Dependencies.Add(new GroupedDependency("FubuCore")); - g1.Dependencies.Add(new GroupedDependency("FubuLocalization")); - theSolution.Groups.Add(g1); + g1.Add(new GroupedDependency("FubuCore")); + g1.Add(new GroupedDependency("FubuLocalization")); + theSolution.AddGroup(g1); var g2 = new DependencyGroup(); - g2.Dependencies.Add(new GroupedDependency("FubuLocalization")); - g2.Dependencies.Add(new GroupedDependency("Bottles")); - theSolution.Groups.Add(g2); + g2.Add(new GroupedDependency("FubuLocalization")); + g2.Add(new GroupedDependency("Bottles")); + theSolution.AddGroup(g2); theInput.NugetFlag = "FubuCore"; diff --git a/src/ripple.Testing/Commands/finding_nuspecs_by_convention_and_mapping.cs b/src/ripple.Testing/Commands/finding_nuspecs_by_convention_and_mapping.cs index bf2ecac..f81a1f2 100644 --- a/src/ripple.Testing/Commands/finding_nuspecs_by_convention_and_mapping.cs +++ b/src/ripple.Testing/Commands/finding_nuspecs_by_convention_and_mapping.cs @@ -30,8 +30,8 @@ public void SetUp() }); }); - theSolution = theScenario.Find("Test"); - theSolution.Nuspecs.Add(new NuspecMap { File = "SomethingElse.nuspec", Project = "Something"}); + theSolution = theScenario.Find("Test"); + theSolution.AddNuspec(new NuspecMap { File = "SomethingElse.nuspec", Project = "Something" }); theInput = new CreatePackagesInput { diff --git a/src/ripple.Testing/Integration/update_dependencies_while_creating_local_nugets.cs b/src/ripple.Testing/Integration/update_dependencies_while_creating_local_nugets.cs index 2d771dc..6b3b57e 100644 --- a/src/ripple.Testing/Integration/update_dependencies_while_creating_local_nugets.cs +++ b/src/ripple.Testing/Integration/update_dependencies_while_creating_local_nugets.cs @@ -43,7 +43,7 @@ public void SetUp() theSolution = theScenario.Find("Test"); // Map Something.nuspec to the "JustToBeComplicated" project - theSolution.Nuspecs.Add(new NuspecMap { File = "Something.nuspec", Project = "JustToBeComplicated" }); + theSolution.AddNuspec(new NuspecMap { File = "Something.nuspec", Project = "JustToBeComplicated" }); var someProject = theSolution.FindProject("SomeProject"); var justToBeComplicated = theSolution.FindProject("JustToBeComplicated"); diff --git a/src/ripple.Testing/Model/DependencyGroupTester.cs b/src/ripple.Testing/Model/DependencyGroupTester.cs index 8b63021..9c3a41c 100644 --- a/src/ripple.Testing/Model/DependencyGroupTester.cs +++ b/src/ripple.Testing/Model/DependencyGroupTester.cs @@ -1,37 +1,37 @@ -using FubuTestingSupport; -using NUnit.Framework; -using ripple.Model; - -namespace ripple.Testing.Model -{ - [TestFixture] - public class DependencyGroupTester - { - [Test] - public void has_dependency_positive() - { - var group = new DependencyGroup(); - group.Dependencies.Add(new GroupedDependency("FubuCore")); - - group.Has("FubuCore").ShouldBeTrue(); - } - - [Test] - public void has_dependency_case_insensitive() - { - var group = new DependencyGroup(); - group.Dependencies.Add(new GroupedDependency("FubuCore")); - - group.Has("fubuCore").ShouldBeTrue(); - } - - [Test] - public void has_dependency_negative() - { - var group = new DependencyGroup(); - group.Dependencies.Add(new GroupedDependency("FubuCore")); - - group.Has("Bottles").ShouldBeFalse(); - } - } +using FubuTestingSupport; +using NUnit.Framework; +using ripple.Model; + +namespace ripple.Testing.Model +{ + [TestFixture] + public class DependencyGroupTester + { + [Test] + public void has_dependency_positive() + { + var group = new DependencyGroup(); + group.Add(new GroupedDependency("FubuCore")); + + group.Has("FubuCore").ShouldBeTrue(); + } + + [Test] + public void has_dependency_case_insensitive() + { + var group = new DependencyGroup(); + group.Add(new GroupedDependency("FubuCore")); + + group.Has("fubuCore").ShouldBeTrue(); + } + + [Test] + public void has_dependency_negative() + { + var group = new DependencyGroup(); + group.Add(new GroupedDependency("FubuCore")); + + group.Has("Bottles").ShouldBeFalse(); + } + } } \ No newline at end of file diff --git a/src/ripple.Testing/Model/SolutionPersistence.cs b/src/ripple.Testing/Model/SolutionPersistence.cs index 57d6be7..e7c682d 100644 --- a/src/ripple.Testing/Model/SolutionPersistence.cs +++ b/src/ripple.Testing/Model/SolutionPersistence.cs @@ -1,36 +1,34 @@ -using NUnit.Framework; -using ripple.Model; - -namespace ripple.Testing.Model -{ - [TestFixture] - public class SolutionPersistence - { - [Test] - 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); - } - } +using NUnit.Framework; +using ripple.Model; + +namespace ripple.Testing.Model +{ + [TestFixture] + public class SolutionPersistence + { + [Test] + public void persists_and_retrieves_the_solution() + { + var solution = new Solution + { + Name = "Test", + Feeds = new[] { Feed.NuGetV2, Feed.NuGetV1 }, + Nugets = new[] { new Dependency("FubuCore", "1.0.1.0") } + }; + + var group = new DependencyGroup(); + group.Add(new GroupedDependency("FubuCore")); + solution.AddGroup(group); + + var constrainedDependency = new Dependency("Bottles", "1.0.0.0") + { + VersionConstraint = VersionConstraint.DefaultFloat + }; + solution.AddDependency(constrainedDependency); + + solution.AddNuspec(new NuspecMap { File = "Temp", Project = "Test" }); + + CheckXmlPersistence.For(solution); + } + } } \ No newline at end of file diff --git a/src/ripple.Testing/Model/Xml/XmlSolutionLoaderTester.cs b/src/ripple.Testing/Model/Xml/XmlSolutionLoaderTester.cs index 7d9efe1..09ff930 100644 --- a/src/ripple.Testing/Model/Xml/XmlSolutionLoaderTester.cs +++ b/src/ripple.Testing/Model/Xml/XmlSolutionLoaderTester.cs @@ -94,7 +94,7 @@ public void groups() group.Has("Dependency1").ShouldBeTrue(); group.Has("Dependency2").ShouldBeTrue(); - group.Dependencies.ShouldHaveCount(2); + group.GroupedDependencies.ShouldHaveCount(2); } [Test] diff --git a/src/ripple.Testing/Model/can_read_a_solution_file.cs b/src/ripple.Testing/Model/can_read_a_solution_file.cs new file mode 100644 index 0000000..f398eba --- /dev/null +++ b/src/ripple.Testing/Model/can_read_a_solution_file.cs @@ -0,0 +1,70 @@ +using System.Linq; +using FubuTestingSupport; +using NUnit.Framework; +using ripple.Model; + +namespace ripple.Testing.Model +{ + [TestFixture] + public class can_read_the_objectblock + { + private string blockText = @"name: 'ripple' +nugetSpecFolder: 'packaging/nuget' +sourceFolder: 'src' +nuspecSettings: fixed: 'Current,NextMajor' + float: 'Current' + +feed 'http://build.fubu-project.org/guestAuth/app/nuget/v1/FeedService.svc', mode: 'Float', stability: 'ReleasedOnly' +feed 'http://nuget.org/api/v2', mode: 'Fixed', stability: 'ReleasedOnly' +feed 'http://packages.nuget.org/v1/FeedService.svc', mode: 'Fixed', stability: 'ReleasedOnly' + +nuget 'Bottles', version: '2.0.0.550', mode: 'Float' +nuget 'FubuCore', version: '1.1.0.242', mode: 'Float' +nuget 'FubuObjectBlocks', version: '0.1.0.5', mode: 'Float' +nuget 'Nuget.Core', version: '2.5', mode: 'Fixed' +nuget 'NUnit', version: '2.5.10.11092', mode: 'Fixed' +nuget 'RhinoMocks', version: '3.6.1', mode: 'Fixed' +nuget 'structuremap', version: '2.6.3', mode: 'Fixed' +nuget 'structuremap.automocking', version: '2.6.3', mode: 'Fixed' + +group 'Test', dependencies: 'Dep1,Dep2,Dep3' + +nuspec 'Test.nuspec', project: 'MyProject'"; + + private Solution theSolution; + + [SetUp] + public void SetUp() + { + var reader = SolutionLoader.Reader(); + theSolution = Solution.Empty(); + + reader.Read(theSolution, blockText); + } + + + [Test] + public void verify_the_solution() + { + theSolution.Name.ShouldEqual("ripple"); + theSolution.NugetSpecFolder.ShouldEqual("packaging/nuget"); + theSolution.SourceFolder.ShouldEqual("src"); + + theSolution.NuspecSettings.Fixed.ShouldEqual(VersionConstraint.DefaultFixed); + theSolution.NuspecSettings.Float.ShouldEqual(VersionConstraint.DefaultFloat); + + theSolution.Feeds.ShouldHaveTheSameElementsAs(Feed.Fubu, Feed.NuGetV2, Feed.NuGetV1); + + theSolution.Dependencies.ShouldHaveTheSameDependenciesAs("Bottles", "FubuCore", "FubuObjectBlocks", "Nuget.Core", "NUnit", "RhinoMocks", "structuremap", "structuremap.automocking"); + + var group = theSolution.Groups.Single(); + group.Name.ShouldEqual("Test"); + group.GroupedDependencies.Select(x => x.Name).ShouldHaveTheSameElementsAs("Dep1", "Dep2", "Dep3"); + + var nuspec = theSolution.Nuspecs.Single(); + nuspec.File.ShouldEqual("Test.nuspec"); + nuspec.Project.ShouldEqual("MyProject"); + } + + } +} \ No newline at end of file diff --git a/src/ripple.Testing/SolutionScenario.cs b/src/ripple.Testing/SolutionScenario.cs index f27a048..bce901b 100644 --- a/src/ripple.Testing/SolutionScenario.cs +++ b/src/ripple.Testing/SolutionScenario.cs @@ -287,9 +287,9 @@ public void GroupDependencies(params string[] dependencies) Modify(solution => { var group = new DependencyGroup(); - dependencies.Each(x => group.Dependencies.Add(new GroupedDependency(x))); + dependencies.Each(x => group.Add(new GroupedDependency(x))); - solution.Groups.Add(group); + solution.AddGroup(group); }); } } diff --git a/src/ripple.Testing/SolutionTester.cs b/src/ripple.Testing/SolutionTester.cs index 901b18f..51e1d46 100644 --- a/src/ripple.Testing/SolutionTester.cs +++ b/src/ripple.Testing/SolutionTester.cs @@ -10,118 +10,6 @@ namespace ripple.Testing [TestFixture] public class SolutionTester { - [Test] - [Platform(Exclude = "Unix,Linux,MacOsX")] - public void create_process_info_for_full_build() - { - var solution = new Solution - { - SourceFolder = "src", - BuildCommand = "rake", - FastBuildCommand = "rake compile", - Directory = "directory1".ToFullPath() - }; - - var processInfo = solution.CreateBuildProcess(false); - - processInfo.WorkingDirectory.ShouldEqual("directory1".ToFullPath()); - processInfo.FileName.ShouldEqual(Runner.Rake.Path); - processInfo.Arguments.ShouldBeEmpty(); - } - - [Test] - [Platform(Exclude = "Unix,Linux,MacOsX")] - public void create_process_for_fast_build() - { - var solution = new Solution - { - SourceFolder = "src", - BuildCommand = "rake", - FastBuildCommand = "rake compile", - Directory = "directory1".ToFullPath() - }; - - var processInfo = solution.CreateBuildProcess(true); - - processInfo.WorkingDirectory.ShouldEqual("directory1".ToFullPath()); - processInfo.FileName.ShouldEqual(Runner.Rake.Path); - processInfo.Arguments.ShouldEqual("compile"); - } - - [Test] - public void create_process_for_fast_build_not_rake() - { - var solution = new Solution - { - SourceFolder = "src", - BuildCommand = "msbuild", - FastBuildCommand = "msbuild compile", - Directory = "directory1".ToFullPath() - }; - - var processInfo = solution.CreateBuildProcess(true); - - processInfo.WorkingDirectory.ShouldEqual("directory1".ToFullPath()); - processInfo.FileName.ShouldEqual("msbuild"); - processInfo.Arguments.ShouldEqual("compile"); - } - - [Test] - public void create_process_for_full_build_not_rake() - { - var solution = new Solution - { - SourceFolder = "src", - BuildCommand = "msbuild", - FastBuildCommand = "msbuild compile", - Directory = "directory1".ToFullPath() - }; - - var processInfo = solution.CreateBuildProcess(false); - - processInfo.WorkingDirectory.ShouldEqual("directory1".ToFullPath()); - processInfo.FileName.ShouldEqual("msbuild"); - processInfo.Arguments.ShouldBeEmpty(); - } - - [Test] - [Platform(Exclude = "Win")] - public void create_process_info_for_full_build_on_unix() - { - var solution = new Solution - { - SourceFolder = "src", - BuildCommand = "rake", - FastBuildCommand = "rake compile", - Directory = "directory1".ToFullPath() - }; - - var processInfo = solution.CreateBuildProcess(false); - - processInfo.WorkingDirectory.ShouldEqual("directory1".ToFullPath()); - processInfo.FileName.ShouldEqual("/bin/bash"); - processInfo.Arguments.ShouldEqual("\"" + Runner.Rake.Path + "\""); - } - - [Test] - [Platform(Exclude = "Win")] - public void create_process_for_fast_build_on_unix() - { - var solution = new Solution - { - SourceFolder = "src", - BuildCommand = "rake", - FastBuildCommand = "rake compile", - Directory = "directory1".ToFullPath() - }; - - var processInfo = solution.CreateBuildProcess(true); - - processInfo.WorkingDirectory.ShouldEqual("directory1".ToFullPath()); - processInfo.FileName.ShouldEqual("/bin/bash"); - processInfo.Arguments.ShouldEqual("\""+ Runner.Rake.Path + "\" compile"); - } - [Test] public void get_nuget_directory() { diff --git a/src/ripple.Testing/ripple.Testing.csproj b/src/ripple.Testing/ripple.Testing.csproj index abcc88b..5688223 100644 --- a/src/ripple.Testing/ripple.Testing.csproj +++ b/src/ripple.Testing/ripple.Testing.csproj @@ -125,6 +125,7 @@ + @@ -265,4 +266,4 @@ --> - + \ No newline at end of file diff --git a/src/ripple/Commands/BatchInstallCommand.cs b/src/ripple/Commands/BatchInstallCommand.cs index 1a01609..e401b1e 100644 --- a/src/ripple/Commands/BatchInstallCommand.cs +++ b/src/ripple/Commands/BatchInstallCommand.cs @@ -70,6 +70,11 @@ private static BatchOperation readFromCommandLine(Solution solution) return operation; } + + public override void ApplyTo(Solution solution) + { + solution.RequestSave(); + } } [CommandDescription("Provides a mechanism for installing multiple nugets to your solution", Name = "batch-install")] diff --git a/src/ripple/Commands/FixCommand.cs b/src/ripple/Commands/FixCommand.cs index c7a2cd2..e51f852 100644 --- a/src/ripple/Commands/FixCommand.cs +++ b/src/ripple/Commands/FixCommand.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Linq; -using System.Threading; using FubuCore.CommandLine; using ripple.Model; using ripple.Nuget; @@ -8,34 +7,39 @@ namespace ripple.Commands { - public class FixInput : RippleInput, INugetOperationContext - { - public IEnumerable Requests(Solution solution) - { - return solution - .Dependencies - .Select(dependency => new NugetPlanRequest - { - ForceUpdates = false, - Operation = OperationType.Install, - Batched = true, - Dependency = dependency - }); - } - } + public class FixInput : RippleInput, INugetOperationContext + { + public override void ApplyTo(Solution solution) + { + solution.RequestSave(); + } - [CommandDescription("Analyzes solution and project dependencies and fixes missing dependencies and references")] - public class FixCommand : FubuCommand - { - public override bool Execute(FixInput input) - { - return RippleOperation - .For(input) - .Step() - .Step() - .Step() - .Step() - .Execute(); - } - } + public IEnumerable Requests(Solution solution) + { + return solution + .Dependencies + .Select(dependency => new NugetPlanRequest + { + ForceUpdates = false, + Operation = OperationType.Install, + Batched = true, + Dependency = dependency + }); + } + } + + [CommandDescription("Analyzes solution and project dependencies and fixes missing dependencies and references")] + public class FixCommand : FubuCommand + { + public override bool Execute(FixInput input) + { + return RippleOperation + .For(input) + .Step() + .Step() + .Step() + .Step() + .Execute(); + } + } } \ No newline at end of file diff --git a/src/ripple/Commands/FloatCommand.cs b/src/ripple/Commands/FloatCommand.cs index 26a76b7..6c813de 100644 --- a/src/ripple/Commands/FloatCommand.cs +++ b/src/ripple/Commands/FloatCommand.cs @@ -17,6 +17,11 @@ public class FloatInput : NugetInput [Description("The minimum version required")] [FlagAlias("min-version", 'm')] public string MinVersionFlag { get; set; } + + public override void ApplyTo(Solution solution) + { + solution.RequestSave(); + } } [CommandDescription("Allows a nuget to 'float' and be automatically updated from the Update command")] @@ -25,7 +30,7 @@ public class FloatCommand : FubuCommand public override bool Execute(FloatInput input) { return RippleOperation - .For(input) + .For(input) .Step() .Execute(); } @@ -35,6 +40,11 @@ public class LockInput : NugetInput { [Description("The version to lock to")] public string Version { get; set; } + + public override void ApplyTo(Solution solution) + { + solution.RequestSave(); + } } [CommandDescription("Locks a nuget to prevent it from being automatically updated from the Update command")] diff --git a/src/ripple/Commands/InitInput.cs b/src/ripple/Commands/InitInput.cs index 2d07a61..0cdd45a 100644 --- a/src/ripple/Commands/InitInput.cs +++ b/src/ripple/Commands/InitInput.cs @@ -36,8 +36,6 @@ public Solution ToSolution() SourceFolderFlag.IfNotEmpty(x => solution.SourceFolder = x); NuspecFolderFlag.IfNotEmpty(x => solution.NugetSpecFolder = x); - BuildCommandFlag.IfNotEmpty(x => solution.BuildCommand = x); - FastBuildCommandFlag.IfNotEmpty(x => solution.FastBuildCommand = x); FeedsFlag.IfNotEmpty(x => { diff --git a/src/ripple/Commands/InstallCommand.cs b/src/ripple/Commands/InstallCommand.cs index ec5686d..3e11ec9 100644 --- a/src/ripple/Commands/InstallCommand.cs +++ b/src/ripple/Commands/InstallCommand.cs @@ -1,118 +1,123 @@ -using System.Collections.Generic; -using System.ComponentModel; -using FubuCore; -using FubuCore.CommandLine; -using ripple.Model; -using ripple.Nuget; -using ripple.Steps; - -namespace ripple.Commands -{ - public class InstallInput : RippleInput, INugetOperationContext - { - public InstallInput() - { - ModeFlag = UpdateMode.Float; - VersionFlag = string.Empty; - } - - [Description("The NuGet to install")] - public string Package { get; set; } - - [Description("Version of the package")] - [FlagAlias("version", 'v')] - public string VersionFlag { get; set; } - - [Description("The update mode of the package")] - [FlagAlias("ModeFlag", 'm')] - public UpdateMode ModeFlag { get; set; } - - [Description("Project to install to")] - [FlagAlias("project", 'p')] - public string ProjectFlag { get; set; } - - [Description("Forces updates of transitive updates")] - [FlagAlias("force-updates", 'f')] - public bool ForceUpdatesFlag { get; set; } - - [Description("Only show what would be installed")] - public bool PreviewFlag { get; set; } - - [Description("Override the feed-level stability configuration")] - [FlagAlias("stability", 's')] - public NugetStability? StabilityFlag { get; set; } - - public Dependency Dependency - { - get - { - return new Dependency(Package, VersionFlag, ModeFlag) { NugetStability = StabilityFlag }; - } - } - - public override string DescribePlan(Solution solution) - { - return "Install {0} to Solution {1}".ToFormat(Package, solution.Name); - } - - public IEnumerable Requests(Solution solution) - { - yield return new NugetPlanRequest - { - Dependency = Dependency, - ForceUpdates = ForceUpdatesFlag, - Operation = OperationType.Install, - Project = ProjectFlag - }; - } - } - - public class InstallCommand : FubuCommand - { - public override bool Execute(InstallInput input) - { - var solution = Solution.For(input); - - if (input.ProjectFlag.IsNotEmpty()) - { - var project = solution.FindProject(input.ProjectFlag); - if (project == null) - { - RippleAssert.Fail("Project " + input.ProjectFlag + " does not exist"); - return false; - } - - if (project.Dependencies.Has(input.Package)) - { - RippleAssert.Fail(input.Package + " already exists in Project " + input.ProjectFlag); - return false; - } - } - else if(solution.Dependencies.Has(input.Package)) - { - RippleAssert.Fail(input.Package + " already exists in solution"); - return false; - } - - if (input.PreviewFlag) - { - preview(input, solution); - return true; - } - - return RippleOperation - .For(input) - .Step() - .Step() - .Step() - .Step() - .Execute(); - } - - private void preview(InstallInput input, Solution solution) - { - var plan = NugetOperation.PlanFor(input, solution); - RippleLog.InfoMessage(plan); - } - } +using System.Collections.Generic; +using System.ComponentModel; +using FubuCore; +using FubuCore.CommandLine; +using ripple.Model; +using ripple.Nuget; +using ripple.Steps; + +namespace ripple.Commands +{ + public class InstallInput : RippleInput, INugetOperationContext + { + public InstallInput() + { + ModeFlag = UpdateMode.Float; + VersionFlag = string.Empty; + } + + [Description("The NuGet to install")] + public string Package { get; set; } + + [Description("Version of the package")] + [FlagAlias("version", 'v')] + public string VersionFlag { get; set; } + + [Description("The update mode of the package")] + [FlagAlias("ModeFlag", 'm')] + public UpdateMode ModeFlag { get; set; } + + [Description("Project to install to")] + [FlagAlias("project", 'p')] + public string ProjectFlag { get; set; } + + [Description("Forces updates of transitive updates")] + [FlagAlias("force-updates", 'f')] + public bool ForceUpdatesFlag { get; set; } + + [Description("Only show what would be installed")] + public bool PreviewFlag { get; set; } + + [Description("Override the feed-level stability configuration")] + [FlagAlias("stability", 's')] + public NugetStability? StabilityFlag { get; set; } + + public Dependency Dependency + { + get + { + return new Dependency(Package, VersionFlag, ModeFlag) { NugetStability = StabilityFlag }; + } + } + + public override void ApplyTo(Solution solution) + { + solution.RequestSave(); + } + + public override string DescribePlan(Solution solution) + { + return "Install {0} to Solution {1}".ToFormat(Package, solution.Name); + } + + public IEnumerable Requests(Solution solution) + { + yield return new NugetPlanRequest + { + Dependency = Dependency, + ForceUpdates = ForceUpdatesFlag, + Operation = OperationType.Install, + Project = ProjectFlag + }; + } + } + + public class InstallCommand : FubuCommand + { + public override bool Execute(InstallInput input) + { + var solution = Solution.For(input); + + if (input.ProjectFlag.IsNotEmpty()) + { + var project = solution.FindProject(input.ProjectFlag); + if (project == null) + { + RippleAssert.Fail("Project " + input.ProjectFlag + " does not exist"); + return false; + } + + if (project.Dependencies.Has(input.Package)) + { + RippleAssert.Fail(input.Package + " already exists in Project " + input.ProjectFlag); + return false; + } + } + else if (solution.Dependencies.Has(input.Package)) + { + RippleAssert.Fail(input.Package + " already exists in solution"); + return false; + } + + if (input.PreviewFlag) + { + preview(input, solution); + return true; + } + + return RippleOperation + .For(input) + .Step() + .Step() + .Step() + .Step() + .Execute(); + } + + private void preview(InstallInput input, Solution solution) + { + var plan = NugetOperation.PlanFor(input, solution); + RippleLog.InfoMessage(plan); + } + } } \ No newline at end of file diff --git a/src/ripple/Commands/RemoveCommand.cs b/src/ripple/Commands/RemoveCommand.cs index 2b531d2..83e2356 100644 --- a/src/ripple/Commands/RemoveCommand.cs +++ b/src/ripple/Commands/RemoveCommand.cs @@ -1,6 +1,7 @@ using System.ComponentModel; using FubuCore; using FubuCore.CommandLine; +using ripple.Model; using ripple.Steps; namespace ripple.Commands @@ -13,6 +14,11 @@ public class RemoveInput : SolutionInput [Description("Project to remove from")] [FlagAlias("project", 'p')] public string ProjectFlag { get; set; } + + public override void ApplyTo(Solution solution) + { + solution.RequestSave(); + } } [CommandDescription("Removes a nuget from the solution")] @@ -23,7 +29,7 @@ public override bool Execute(RemoveInput input) RippleLog.Info("Trying to remove {0}".ToFormat(input.Nuget)); return RippleOperation - .For(input) + .For(input) .Step() .ForceSave() .Execute(); diff --git a/src/ripple/Commands/UpdateCommand.cs b/src/ripple/Commands/UpdateCommand.cs index 384209f..1833bba 100644 --- a/src/ripple/Commands/UpdateCommand.cs +++ b/src/ripple/Commands/UpdateCommand.cs @@ -40,6 +40,11 @@ public override string DescribePlan(Solution solution) return "Updating dependencies for solution {0}".ToFormat(solution.Name); } + public override void ApplyTo(Solution solution) + { + solution.RequestSave(); + } + public IEnumerable Requests(Solution solution) { if (NugetFlag.IsNotEmpty()) @@ -76,7 +81,7 @@ private void gatherDependencies(List requests, Solution soluti var dependencies = solution .Groups .Where(group => group.Has(name)) - .SelectMany(group => group.Dependencies.Select(x => x.Name)) + .SelectMany(group => group.GroupedDependencies.Select(x => x.Name)) .Distinct(); var newItems = new List(); diff --git a/src/ripple/Model/Binding/VersionConstraintConverter.cs b/src/ripple/Model/Binding/VersionConstraintConverter.cs new file mode 100644 index 0000000..aa9eb6d --- /dev/null +++ b/src/ripple/Model/Binding/VersionConstraintConverter.cs @@ -0,0 +1,41 @@ +using System.Reflection; +using FubuCore; +using FubuCore.Binding; +using FubuCore.Reflection; + +namespace ripple.Model.Binding +{ + public class VersionConstraintConverter : StatelessConverter + { + public override bool Matches(PropertyInfo property) + { + return property.PropertyType == typeof (VersionConstraint); + } + + public override object Convert(IPropertyContext context) + { + var data = context.RawValueFromRequest == null ? null : context.RawValueFromRequest.RawValue as string; + return data.IsEmpty() ? null : VersionConstraint.Parse(data); + } + } + + public class GroupedDependencyConverter : StatelessConverter + { + public override bool Matches(PropertyInfo property) + { + var accessor = ReflectionHelper.GetAccessor(x => x.GroupedDependencies); + return accessor.Equals(new SingleProperty(property)); + } + + public override object Convert(IPropertyContext context) + { + var data = context.RawValueFromRequest == null ? null : context.RawValueFromRequest.RawValue as string; + if (data.IsEmpty()) + { + return new GroupedDependency[0]; + } + + return GroupedDependency.Parse(data); + } + } +} \ No newline at end of file diff --git a/src/ripple/Model/DependencyGroup.cs b/src/ripple/Model/DependencyGroup.cs index 156aac2..e4f7ca2 100644 --- a/src/ripple/Model/DependencyGroup.cs +++ b/src/ripple/Model/DependencyGroup.cs @@ -1,38 +1,66 @@ -using System.Collections.Generic; -using System.Linq; -using System.Xml.Serialization; -using FubuCore; - -namespace ripple.Model -{ - public class GroupedDependency - { - public GroupedDependency() - { - } - - public GroupedDependency(string name) - { - Name = name; - } - - [XmlAttribute] - public string Name { get; set; } - } - - public class DependencyGroup - { - public DependencyGroup() - { - Dependencies = new List(); - } - - [XmlElement("Dependency")] - public List Dependencies { get; set; } - - public bool Has(string name) - { - return Dependencies.Any(x => x.Name.EqualsIgnoreCase(name)); - } - } +using System; +using System.Collections.Generic; +using System.Linq; +using FubuCore; + +namespace ripple.Model +{ + public class DependencyGroup + { + private readonly IList _dependencies = new List(); + + public string Name { get; set; } + + public string Dependencies + { + get { return GroupedDependencies.OrderBy(x => x.Name).Select(x => x.Name).Join(","); } + set { GroupedDependencies = GroupedDependency.Parse(value); } + } + + public IEnumerable GroupedDependencies + { + get { return _dependencies; } + set + { + _dependencies.Clear(); + _dependencies.AddRange(value); + } + } + + public void Add(string name) + { + Add(new GroupedDependency(name)); + } + + public void Add(GroupedDependency dependency) + { + _dependencies.Add(dependency); + } + + public bool Has(string name) + { + return GroupedDependencies.Any(x => x.Name.EqualsIgnoreCase(name)); + } + } + + public class GroupedDependency + { + public GroupedDependency() + { + } + + public GroupedDependency(string name) + { + Name = name; + } + + public string Name { get; set; } + + public static IEnumerable Parse(string input) + { + return input + .Split(new[] {","}, StringSplitOptions.RemoveEmptyEntries) + .Select(name => new GroupedDependency(name)); + } + } } \ No newline at end of file diff --git a/src/ripple/Model/DependencyList.cs b/src/ripple/Model/DependencyList.cs new file mode 100644 index 0000000..53e513c --- /dev/null +++ b/src/ripple/Model/DependencyList.cs @@ -0,0 +1,76 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using FubuCore; + +namespace ripple.Model +{ + public class DependencyList : IList + { + private readonly IList _inner = new List(); + + public IEnumerator GetEnumerator() + { + return _inner.OrderBy(x => x.Name).GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(Dependency item) + { + _inner.Fill(item); + } + + public void Clear() + { + _inner.Clear(); + } + + public bool Contains(Dependency item) + { + return _inner.Contains(item); + } + + public void CopyTo(Dependency[] array, int arrayIndex) + { + _inner.CopyTo(array, arrayIndex); + } + + public bool Remove(Dependency item) + { + return _inner.Remove(item); + } + + public int Count { get { return _inner.Count; } } + public bool IsReadOnly { get { return _inner.IsReadOnly; } } + + public int IndexOf(Dependency item) + { + return _inner.IndexOf(item); + } + + public void Insert(int index, Dependency item) + { + _inner.Insert(index, item); + } + + public void RemoveAt(int index) + { + _inner.RemoveAt(index); + } + + public Dependency this[int index] + { + get { return _inner[index]; } + set { _inner[index] = value; } + } + + public override string ToString() + { + return "Count: {0}".ToFormat(Count); + } + } +} \ No newline at end of file diff --git a/src/ripple/Model/NuspecSettings.cs b/src/ripple/Model/NuspecSettings.cs index 8f1cca8..36b57b7 100644 --- a/src/ripple/Model/NuspecSettings.cs +++ b/src/ripple/Model/NuspecSettings.cs @@ -1,19 +1,23 @@ -namespace ripple.Model -{ - public class NuspecSettings - { - public NuspecSettings() - { - Float = VersionConstraint.DefaultFloat; - Fixed = VersionConstraint.DefaultFixed; - } - - public VersionConstraint Float { get; set; } - public VersionConstraint Fixed { get; set; } - - public VersionConstraint ConstraintFor(UpdateMode mode) - { - return mode == UpdateMode.Fixed ? Fixed : Float; - } - } +using FubuObjectBlocks; + +namespace ripple.Model +{ + public class NuspecSettings + { + public NuspecSettings() + { + Float = VersionConstraint.DefaultFloat; + Fixed = VersionConstraint.DefaultFixed; + } + + [ImplicitValue] + public VersionConstraint Float { get; set; } + [ImplicitValue] + public VersionConstraint Fixed { get; set; } + + public VersionConstraint ConstraintFor(UpdateMode mode) + { + return mode == UpdateMode.Fixed ? Fixed : Float; + } + } } \ No newline at end of file diff --git a/src/ripple/Model/ReferenceSettings.cs b/src/ripple/Model/ReferenceSettings.cs index 6065141..29abf56 100644 --- a/src/ripple/Model/ReferenceSettings.cs +++ b/src/ripple/Model/ReferenceSettings.cs @@ -1,16 +1,13 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Xml.Serialization; namespace ripple.Model { public class ReferenceSettings { private readonly IList _ignores = new List(); - - [XmlArray("IgnoreAssemblies"), XmlArrayItem("Ignore")] - public IgnoreAssemblyReference[] IgnoredAssemblies + + public IEnumerable IgnoredAssemblies { get { return _ignores.ToArray(); } set diff --git a/src/ripple/Model/RippleBlockRegistry.cs b/src/ripple/Model/RippleBlockRegistry.cs new file mode 100644 index 0000000..f23712a --- /dev/null +++ b/src/ripple/Model/RippleBlockRegistry.cs @@ -0,0 +1,14 @@ +using FubuObjectBlocks; + +namespace ripple.Model +{ + public class RippleBlockRegistry : BlockRegistry + { + public RippleBlockRegistry() + { + RegisterSettings(); + RegisterSettings(); + RegisterSettings(); + } + } +} \ No newline at end of file diff --git a/src/ripple/Model/Solution.cs b/src/ripple/Model/Solution.cs index 8a6ed3e..5ec155c 100644 --- a/src/ripple/Model/Solution.cs +++ b/src/ripple/Model/Solution.cs @@ -6,12 +6,10 @@ using System.Threading.Tasks; using System.Xml.Serialization; using FubuCore; -using FubuCore.CommandLine; using FubuCore.Descriptions; using FubuCore.Logging; using ripple.Commands; using ripple.Nuget; -using ripple.Runners; namespace ripple.Model { @@ -23,16 +21,18 @@ public interface ISolution IEnumerable AllNugetDependencyNames(); } - [XmlType("ripple")] public class Solution : DescribesItself, LogTopic, ISolution { private readonly IList _projects = new List(); private readonly IList _feeds = new List(); - private readonly IList _configuredDependencies = new List(); + private readonly IList _configuredDependencies = new DependencyList(); + private readonly IList _groups = new List(); + private readonly IList _nuspecMaps = new List(); private Lazy> _missing; private Lazy> _specifications; private Lazy _dependencies; private readonly IList _nugetDependencies = new List(); + private bool _requiresSave; private string _path; private string _cacheLocalPath; @@ -40,8 +40,6 @@ public Solution() { NugetSpecFolder = "packaging/nuget"; SourceFolder = "src"; - BuildCommand = "rake"; - FastBuildCommand = "rake compile"; Mode = SolutionMode.Ripple; Groups = new List(); Nuspecs = new List(); @@ -62,12 +60,6 @@ public Solution() Reset(); } - public string Name { get; set; } - public string NugetSpecFolder { get; set; } - public string SourceFolder { get; set; } - public string BuildCommand { get; set; } - public string FastBuildCommand { get; set; } - public string NugetCacheDirectory { get { return _cacheLocalPath; } @@ -105,9 +97,9 @@ public string DefaultFixedConstraint } } - public Feed[] Feeds + public IEnumerable Feeds { - get { return _feeds.ToArray(); } + get { return _feeds; } set { _feeds.Clear(); @@ -115,9 +107,9 @@ public Feed[] Feeds } } - public Dependency[] Nugets + public IEnumerable Nugets { - get { return _configuredDependencies.OrderBy(x => x.Name).ToArray(); } + get { return _configuredDependencies; } set { _configuredDependencies.Clear(); @@ -126,33 +118,29 @@ public Dependency[] Nugets } } - [XmlArray("Groups")] - [XmlArrayItem("Group")] - public List Groups { get; set; } - - [XmlElement("References")] - public ReferenceSettings References { get; set; } - - [XmlArray("Nuspecs")] - [XmlArrayItem("Nuspec")] - public List Nuspecs { get; set; } - - [XmlIgnore] - public DependencyCollection Dependencies + public IEnumerable Groups + { + get { return _groups; } + set { - get { return _dependencies.Value; } + _groups.Clear(); + _groups.AddRange(value); + } } - [XmlIgnore] - public IEnumerable Specifications + public IEnumerable Nuspecs + { + get { return _nuspecMaps; } + set { - get { return _specifications.Value; } + _nuspecMaps.Clear(); + _nuspecMaps.AddRange(value); + } } - [XmlIgnore] - public Project[] Projects + public IEnumerable Projects { - get { return _projects.ToArray(); } + get { return _projects; } set { _projects.Clear(); @@ -160,26 +148,6 @@ public Project[] Projects } } - [XmlIgnore] - public string Directory { get; set; } - [XmlIgnore] - public SolutionMode Mode { get; set; } - [XmlIgnore] - public INugetStorage Storage { get; private set; } - [XmlIgnore] - public IFeedService FeedService { get; private set; } - [XmlIgnore] - public INugetCache Cache { get; private set; } - [XmlIgnore] - public IPublishingService Publisher { get; private set; } - [XmlIgnore] - public INugetPlanBuilder Builder { get; private set; } - [XmlIgnore] - public RestoreSettings RestoreSettings { get; private set; } - [XmlIgnore] - public NuspecSettings NuspecSettings { get; private set; } - - [XmlIgnore] public string Path { get { return _path; } @@ -193,6 +161,22 @@ public string Path } } + public string Name { get; set; } + public string NugetSpecFolder { get; set; } + public string SourceFolder { get; set; } + public ReferenceSettings References { get; set; } + public DependencyCollection Dependencies { get { return _dependencies.Value; } } + public IEnumerable Specifications { get { return _specifications.Value; } } + public string Directory { get; set; } + public SolutionMode Mode { get; set; } + public INugetStorage Storage { get; private set; } + public IFeedService FeedService { get; private set; } + public INugetCache Cache { get; private set; } + public IPublishingService Publisher { get; private set; } + public INugetPlanBuilder Builder { get; private set; } + public RestoreSettings RestoreSettings { get; private set; } + public NuspecSettings NuspecSettings { get; private set; } + private void resetDependencies() { _dependencies = new Lazy(combineDependencies); @@ -229,6 +213,11 @@ public void AddProject(Project project) _projects.Fill(project); } + public void AddGroup(DependencyGroup group) + { + _groups.Add(group); + } + public Project AddProject(string name) { var project = new Project(name); @@ -479,6 +468,11 @@ public string NugetFolderFor(string nugetName) return nuget.NugetFolder(this); } + public void AddNuspec(NuspecMap map) + { + _nuspecMaps.Add(map); + } + public void AddNugetSpec(NugetSpec spec) { _specifications.Value.Add(spec); @@ -524,34 +518,24 @@ public VersionConstraint ConstraintFor(Dependency dependency) return NuspecSettings.ConstraintFor(dependency.Mode); } - public void Save(bool force = false) + public void RequestSave() { - Storage.Write(this); - Projects.Where(x => force || x.HasChanges()).Each(Storage.Write); + _requiresSave = true; } - public ProcessStartInfo CreateBuildProcess(bool fast) + public bool RequiresSave() { - var cmdLine = fast ? FastBuildCommand : BuildCommand; - var commands = StringTokenizer.Tokenize(cmdLine); + return _requiresSave; + } - var fileName = commands.First(); - ProcessStartInfo info; - var arguments = commands.Skip(1).Join(" "); - if (fileName == "rake") + public void Save(bool force = false) { - info = Runner.Rake.Info(arguments); - } - else + if (RequiresSave() || force) { - info = new ProcessStartInfo(fileName) - { - Arguments = arguments - }; + Storage.Write(this); } - info.WorkingDirectory = Directory; - return info; + Projects.Where(x => force || x.HasChanges()).Each(Storage.Write); } public override string ToString() @@ -582,4 +566,4 @@ public static Solution For(RippleInput input) return SolutionBuilder.ReadFromCurrentDirectory(); } } -} \ No newline at end of file +} diff --git a/src/ripple/Model/SolutionBlockSettings.cs b/src/ripple/Model/SolutionBlockSettings.cs new file mode 100644 index 0000000..8cddbfe --- /dev/null +++ b/src/ripple/Model/SolutionBlockSettings.cs @@ -0,0 +1,68 @@ +using System.Linq; +using FubuObjectBlocks; + +namespace ripple.Model +{ + public class SolutionBlockSettings : ObjectBlockSettings + { + public SolutionBlockSettings() + { + Collection(x => x.Feeds) + .ExpressAs("feed") + .ImplicitValue(x => x.Url); + + Collection(x => x.Nugets) + .ExpressAs("nuget") + .ImplicitValue(x => x.Name); + + Collection(x => x.Groups) + .ExpressAs("group") + .ImplicitValue(x => x.Name); + + Collection(x => x.Nuspecs) + .ExpressAs("nuspec") + .ImplicitValue(x => x.File); + + Ignore(x => x.Directory); + Ignore(x => x.Mode); + Ignore(x => x.Storage); + Ignore(x => x.FeedService); + Ignore(x => x.Cache); + Ignore(x => x.Publisher); + Ignore(x => x.Builder); + Ignore(x => x.Path); + Ignore(x => x.Dependencies); + Ignore(x => x.Specifications); + Ignore(x => x.Projects); + Ignore(x => x.DefaultFloatConstraint); + Ignore(x => x.DefaultFixedConstraint); + Ignore(x => x.RestoreSettings); + + Ignore(x => x.Nuspecs); + + Ignore(x => x.References) + .When(settings => !settings.IgnoredAssemblies.Any()); + + Ignore(x => x.Groups) + .When(groups => !groups.Any()); + } + } + + public class ReferenceBlockSettings : ObjectBlockSettings + { + public ReferenceBlockSettings() + { + Collection(x => x.IgnoredAssemblies) + .ExpressAs("ignore") + .ImplicitValue(x => x.Assembly); + } + } + + public class DependencyGroupBlockSettings : ObjectBlockSettings + { + public DependencyGroupBlockSettings() + { + Ignore(x => x.GroupedDependencies); + } + } +} \ No newline at end of file diff --git a/src/ripple/Model/SolutionFiles.cs b/src/ripple/Model/SolutionFiles.cs index b441992..b791ab6 100644 --- a/src/ripple/Model/SolutionFiles.cs +++ b/src/ripple/Model/SolutionFiles.cs @@ -23,6 +23,7 @@ public static void Reset() { Loaders.Clear(); + AddLoader(new SolutionLoader()); AddLoader(new XmlSolutionLoader()); AddLoader(new NuGetSolutionLoader()); } diff --git a/src/ripple/Model/SolutionLoader.cs b/src/ripple/Model/SolutionLoader.cs index ebf34b5..fd47723 100644 --- a/src/ripple/Model/SolutionLoader.cs +++ b/src/ripple/Model/SolutionLoader.cs @@ -1,6 +1,9 @@ using System.IO; using FubuCore; +using FubuCore.Binding; +using FubuCore.Binding.InMemory; using FubuObjectBlocks; +using ripple.Model.Binding; using ripple.Model.Conditions; namespace ripple.Model @@ -22,7 +25,7 @@ public IDirectoryCondition Condition public Solution LoadFrom(IFileSystem fileSystem, string file) { - var reader = ObjectBlockReader.Basic(x => x.RegisterSettings()); + var reader = Reader(); return reader.Read(File.ReadAllText(file)); } @@ -30,19 +33,19 @@ public void SolutionLoaded(Solution solution) { // no-op } - } - public class SolutionBlockSettings : ObjectBlockSettings - { - public SolutionBlockSettings() + public static IObjectBlockReader Reader() { - Collection(x => x.Feeds) - .ExpressAs("feed") - .ImplicitValue(x => x.Url); + var registry = new BindingRegistry(); + registry.Add(new VersionConstraintConverter()); + registry.Add(new GroupedDependencyConverter()); + + var services = new InMemoryServiceLocator(); + var resolver = new ObjectResolver(services, registry, new NulloBindingLogger()); + + services.Add(resolver); - Collection(x => x.Dependencies) - .ExpressAs("nuget") - .ImplicitValue(x => x.Name); + return new ObjectBlockReader(new ObjectBlockParser(), resolver, services, new RippleBlockRegistry()); } } } \ No newline at end of file diff --git a/src/ripple/Model/Xml/XmlSolutionLoader.cs b/src/ripple/Model/Xml/XmlSolutionLoader.cs index 14070a0..068d121 100644 --- a/src/ripple/Model/Xml/XmlSolutionLoader.cs +++ b/src/ripple/Model/Xml/XmlSolutionLoader.cs @@ -84,7 +84,7 @@ private void groups(XElement document, Solution solution) dependencies.Add(dep); } - group.Dependencies = dependencies; + group.GroupedDependencies = dependencies; dependencyGroups.Add(group); } @@ -141,7 +141,7 @@ private static void fillProperties(XElement element, object target) public void SolutionLoaded(Solution solution) { - // no-op + solution.RequestSave(); } } } \ No newline at end of file diff --git a/src/ripple/Nuget/INugetStorage.cs b/src/ripple/Nuget/INugetStorage.cs index 9bfe8cd..005608e 100644 --- a/src/ripple/Nuget/INugetStorage.cs +++ b/src/ripple/Nuget/INugetStorage.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using System.Linq; +using System.Linq; using FubuCore; using FubuObjectBlocks; using ripple.Model; @@ -51,7 +51,7 @@ public void Clean(Solution solution, CleanMode mode) public void Write(Solution solution) { - var writer = ObjectBlockWriter.Basic(x => x.RegisterSettings()); + var writer = ObjectBlockWriter.Basic(new RippleBlockRegistry()); var content = writer.Write(solution); _fileSystem.WriteStringToFile(solution.Path, content); diff --git a/src/ripple/ripple.csproj b/src/ripple/ripple.csproj index 416cc3a..745c275 100644 --- a/src/ripple/ripple.csproj +++ b/src/ripple/ripple.csproj @@ -66,9 +66,13 @@ + + + +