Example #1
0
        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);
        }
Example #2
0
        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();
        }
Example #4
0
        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);
        }
Example #8
0
        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);
            });
        }
Example #9
0
        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));
        }
Example #10
0
 public Solution(SolutionInput si) : base(si)
 {
 }
Example #11
0
 public RippleOperation(Solution solution, SolutionInput input, IRippleStepRunner runner)
 {
     _solution = solution;
     _input    = input;
     _runner   = runner;
 }
Example #12
0
 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.");
        }
Example #14
0
 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());
 }
Example #15
0
 public void Execute(SolutionInput input, IRippleStepRunner runner)
 {
     DirectiveProcessor.ProcessDirectives(Solution);
 }
Example #16
0
 public Solution(SolutionInput si)
 {
     SetSolutionInput(si);
 }
Example #17
0
 public void SetSolutionInput(SolutionInput si)
 {
     _si = si;
 }
Example #18
0
 public void Execute(SolutionInput input, IRippleStepRunner runner)
 {
     Executed = true;
 }
Example #19
0
        public void Execute(SolutionInput input, IRippleStepRunner runner)
        {
            var attacher = new ReferenceAttacher(Solution);

            attacher.Attach();
        }
 public Solution_Part_Two(SolutionInput si) : base(si)
 {
 }