static void Main(string[] args) { _AddSolution("Day1.Solution"); _AddSolution("Day2.Solution"); _AddSolution("Day2.Solution_Part_Two"); bool exit = false; SolutionInput solutionInput = new SolutionInput(@"SolutionData"); do { Console.WriteLine("Choose Solution (0 - {0}): ", _solutions.Count - 1); string input = Console.ReadLine(); int numeric = Int32.Parse(input); if (numeric == -1) { exit = true; } else { Type solutionType = _solutions[numeric]; Type[] constructorTypes = new Type[] { Type.GetType("AdventCalendar2019.Input.SolutionInput") }; ConstructorInfo constructor = solutionType.GetConstructor(constructorTypes); Solution s = (Solution)constructor.Invoke(new object[] { solutionInput }); s.Run(); } } while (!exit); }
public void Execute(SolutionInput input, IRippleStepRunner runner) { var feeds = Solution.Feeds.ToArray(); if (input is IOverrideFeeds) { var overrides = input.As <IOverrideFeeds>().Feeds(); if (overrides.Any()) { Solution.ClearFeeds(); Solution.AddFeeds(overrides); } } var missing = Solution.MissingNugets().ToList(); var nugets = new List <INugetFile>(); if (missing.Any()) { var tasks = missing.Select(x => restore(x, Solution, nugets)).ToArray(); Task.WaitAll(tasks); } Solution.ClearFeeds(); Solution.AddFeeds(feeds); runner.Set(new DownloadedNugets(nugets)); }
public void ShouldBeEmptyWhenNull() { var input = new SolutionInput { SuppliedInput = null }; input.Validate(new MockFileSystem()).ShouldBeNull(); }
public void Execute(SolutionInput input, IRippleStepRunner runner) { var nugetRunner = new NugetStepRunner(Solution); var aggregatePlan = PlanFor(input.As <INugetOperationContext>(), Solution); RippleLog.InfoMessage(aggregatePlan); aggregatePlan.Execute(nugetRunner); }
public void ShouldThrowWhenPathIsNoSolutionFile() { var input = new SolutionInput { SuppliedInput = "/c/root/bla/solution.csproj" }; var ex = Should.Throw <InputException>(() => { input.Validate(new MockFileSystem()); }); ex.Message.ShouldBe("Given path is not a solution file: /c/root/bla/solution.csproj"); }
public void ShouldThrowWhenNotExists() { var input = new SolutionInput { SuppliedInput = "/c/root/bla/solution.sln" }; var ex = Should.Throw <InputException>(() => { input.Validate(new MockFileSystem()); }); ex.Message.ShouldBe("Given path does not exist: /c/root/bla/solution.sln"); }
public void ShouldReturnSolutionPathIfExists() { var path = "/c/root/bla/solution.sln"; var fileSystem = new MockFileSystem(); fileSystem.AddDirectory("/c/root/bla"); fileSystem.AddFile(path, new MockFileData("")); var input = new SolutionInput { SuppliedInput = path }; input.Validate(fileSystem).ShouldBe(path); }
public void Execute(SolutionInput input, IRippleStepRunner runner) { var missing = runner.Get <DownloadedNugets>(); if (missing.Any()) { Solution.AssertNoLockedFiles(); } missing.Each(nuget => { var dir = Solution.PackagesDirectory(); RippleLog.Debug("Exploding " + nuget.ToString()); nuget.ExplodeTo(dir); }); }
public static RippleOperation For <T>(SolutionInput input, Solution solution) { var target = _target ?? solution; var description = input.DescribePlan(solution); if (description.IsNotEmpty()) { RippleLog.Info(description); } input.Apply(target); var runner = new RippleStepRunner(new FileSystem()); return(new RippleOperation(target, input, runner)); }
public Solution(SolutionInput si) : base(si) { }
public RippleOperation(Solution solution, SolutionInput input, IRippleStepRunner runner) { _solution = solution; _input = input; _runner = runner; }
public void Execute(SolutionInput input, IRippleStepRunner runner) { execute((T)input, runner); }
public void ShouldHaveHelpText() { var target = new SolutionInput(); target.HelpText.ShouldBe(@"Full path to your solution file. Required on dotnet framework."); }
public static Solution For(SolutionInput input) { // TODO -- Need to allow a specific solution // TODO -- Need to be smarter about the current directory maybe return(SolutionBuilder.ReadFromCurrentDirectory()); }
public void Execute(SolutionInput input, IRippleStepRunner runner) { DirectiveProcessor.ProcessDirectives(Solution); }
public Solution(SolutionInput si) { SetSolutionInput(si); }
public void SetSolutionInput(SolutionInput si) { _si = si; }
public void Execute(SolutionInput input, IRippleStepRunner runner) { Executed = true; }
public void Execute(SolutionInput input, IRippleStepRunner runner) { var attacher = new ReferenceAttacher(Solution); attacher.Attach(); }
public Solution_Part_Two(SolutionInput si) : base(si) { }