示例#1
0
        private IList<TaskFile> GetSourceFiles(JSLintNetSettings settings)
        {
            var ignored = settings.NormalizeIgnore();
            var taskFiles = new List<TaskFile>();

            if (this.sourceFilesSet)
            {
                foreach (var item in this.SourceFiles)
                {
                    if (JSLint.CanLint(item.ItemSpec))
                    {
                        var taskFile = new TaskFile(this.SourceDirectory, item);

                        if (!taskFile.IsIgnored(ignored))
                        {
                            taskFiles.Add(taskFile);
                        }
                    }
                }

                return taskFiles;
            }

            var files = this.fileSystemWrapper.GetFiles(this.SourceDirectory, "*", SearchOption.AllDirectories);

            foreach (var file in files)
            {
                if (JSLint.CanLint(file))
                {
                    var taskFile = new TaskFile(this.SourceDirectory, file);

                    if (!taskFile.IsIgnored(ignored))
                    {
                        taskFiles.Add(taskFile);
                    }
                }
            }

            return taskFiles;
        }
            public void Spec05()
            {
                var instance = new JSLintNetSettings();

                var ignore = instance.Ignore;
                ignore.Add(@"path\to");
                ignore.Add(@"another\path\");
                ignore.Add(@"looks/like/a.file");

                var actual = instance.NormalizeIgnore();

                I.Expect(actual[0]).ToEndWith(@"\");
                I.Expect(actual[2]).ToEndWith(@"\");
            }
            public void Spec04()
            {
                var instance = new JSLintNetSettings();

                var ignore = instance.Ignore;
                ignore.Add(@"root\data.json");

                var actual = instance.NormalizeIgnore();

                I.Expect(actual[0]).ToBe(@"\root\data.json");
            }
            public void Spec03()
            {
                var instance = new JSLintNetSettings();

                var ignore = instance.Ignore;
                ignore.Add(@"path\to\file.js");

                var actual = instance.NormalizeIgnore();

                I.Expect(actual[0]).ToStartWith(@"\path\to\file.js");
            }
            public void Spec02()
            {
                var instance = new JSLintNetSettings();

                var ignore = instance.Ignore;
                ignore.Add(@"some\path");
                ignore.Add(@"\some\other\path");
                ignore.Add(@"other\path");

                var actual = instance.NormalizeIgnore();

                I.Expect(actual[0]).ToStartWith(@"\");
                I.Expect(actual[2]).ToStartWith(@"\");
            }
            public void Spec01()
            {
                var instance = new JSLintNetSettings();

                var ignore = instance.Ignore;
                ignore.Add(@"some/path");
                ignore.Add(@"/some/other/path");
                ignore.Add(@"other/path");

                var actual = instance.NormalizeIgnore();

                I.Expect(actual[0]).ToContain(@"some\path");
                I.Expect(actual[1]).ToContain(@"\some\other\path");
                I.Expect(actual[2]).ToContain(@"other\path");
            }