Example #1
0
        public SolutionFiles(IFileSystem fileSystem, ISolutionLoader loader)
        {
            resetDirectories(RippleFileSystem.FindSolutionDirectory());

            _fileSystem = fileSystem;
            _loader     = loader;
        }
Example #2
0
        public override bool Execute(GitIgnoreInput input)
        {
            var fileSystem = new FileSystem();

            var gitIgnoreFile = RippleFileSystem.FindSolutionDirectory().AppendPath(".gitignore");

            if (input.Line.IsNotEmpty())
            {
                ConsoleWriter.Write("Writing \"{0}\" to {1}", input.Line, gitIgnoreFile);

                fileSystem.AlterFlatFile(gitIgnoreFile, list => list.Fill(input.Line));

                ConsoleWriter.Line();
                ConsoleWriter.Line();
            }

            ConsoleWriter.PrintHorizontalLine();
            ConsoleWriter.Write(gitIgnoreFile);
            ConsoleWriter.PrintHorizontalLine();
            var text = fileSystem.ReadStringFromFile(gitIgnoreFile);

            ConsoleWriter.Write(text);
            ConsoleWriter.PrintHorizontalLine();

            return(true);
        }
Example #3
0
        public void finding_the_solution_dir_with_do_not_throw_argument_should_not_throw()
        {
            var nonSolutionDir = theCodeDir.AppendPath("not-a-solution-dir");

            fileSystem.CreateDirectory(nonSolutionDir);
            RippleFileSystem.StubCurrentDirectory(nonSolutionDir);

            RippleFileSystem.FindSolutionDirectory(false).ShouldBeNull();
        }
Example #4
0
        public SolutionFiles(IFileSystem fileSystem)
        {
            if (RippleFileSystem.IsSolutionDirectory())
            {
                resetDirectories(RippleFileSystem.FindSolutionDirectory());
            }

            _fileSystem = fileSystem;
            _findLoader = findLoader;
            _loader     = new Lazy <ISolutionLoader>(() => _findLoader());
        }
Example #5
0
        public override bool Execute(InitInput input)
        {
            var rippleConfigDirectory = RippleFileSystem.FindSolutionDirectory(false);

            if (rippleConfigDirectory.IsNotEmpty())
            {
                RippleAssert.Fail(ExistingSolution.ToFormat(rippleConfigDirectory));
                return(false);
            }

            var builder  = NewSolutionBuilder(input.ToSolution());
            var solution = builder.Build();

            solution.Save(true);

            return(true);
        }
Example #6
0
        public bool Matches(IFileSystem fileSystem, string directory)
        {
            if (!RippleFileSystem.IsSolutionDirectory(directory))
            {
                return(false);
            }

            var slnDir     = RippleFileSystem.FindSolutionDirectory(directory);
            var configFile = Path.Combine(slnDir, SolutionFiles.ConfigFile);

            if (!File.Exists(configFile))
            {
                return(false);
            }

            using (var stream = File.OpenRead(configFile))
            {
                return(stream.ReadAllText().Contains("<?xml"));
            }
        }
Example #7
0
        public override bool Execute(InitInput input)
        {
            var rippleConfigDirectory = RippleFileSystem.FindSolutionDirectory(false);

            if (rippleConfigDirectory.IsNotEmpty())
            {
                RippleAssert.Fail(ExistingSolution.ToFormat(rippleConfigDirectory));
                return(false);
            }

            SolutionFiles.AddLoader(new NuGetSolutionLoader());

            var builder  = Builder();
            var solution = builder.Build();

            solution.Save(true);

            new CleanCommand().Execute(new CleanInput());
            new RestoreCommand().Execute(new RestoreInput {
                FixReferencesFlag = true
            });

            return(true);
        }
Example #8
0
 public void finds_the_solution_dir()
 {
     RippleFileSystem.FindSolutionDirectory().ShouldEqual(theSolutionDir.ToFullPath());
 }
Example #9
0
 public static Solution ReadFromCurrentDirectory()
 {
     return(ReadFrom(RippleFileSystem.FindSolutionDirectory()));
 }