Ejemplo n.º 1
0
        public Result VerifyLinks()
        {
            var readmeLines = readmeFile.GetAllText().Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            var allLinks    = linkDetector.DetectLinks(readmeLines);

            return(ruleRunner.VerifyLinks(allLinks));
        }
        public string GetAllText()
        {
            if (text == null)
            {
                text = inneReadmeFile.GetAllText();
                text = RemoveCodeSamples(text);
            }

            return(text);
        }
Ejemplo n.º 3
0
        public LinkVerifierService(string repositoryPath, string readmeRelativePath = null)
        {
            var repository = new FileRepository(repositoryPath);

            readmeRelativePath = readmeRelativePath ?? README_DEFAILT_PATH;
            var readmeFilePath = Path.Combine(repository.GetRepositoryPath(), readmeRelativePath);

            readmeFile = new CodeSampleRemoverReadmeFile(new ReadmeFile(readmeFilePath, readmeRelativePath));
            var rules = new List <ILinkRule>
            {
                new RepositoryLinkRule(repository, readmeFile),
                new ReadmeFileLinkRules(readmeFile.GetAllText())
            };

            if (Utils.IsInternetConnected())
            {
                rules.Add(new InternetLinkRule());
            }

            ruleRunner = new RuleRunner(rules);
        }