Esempio n. 1
0
        public static bool IsSpecification(AssetFile file)
        {
            if (file.MimeType != MimeType.Javascript)
            {
                return(false);
            }
            if (file.ContentFolder().IsEmpty())
            {
                return(false);
            }

            return(file.ContentFolder().Split('/').Contains("specs"));
        }
Esempio n. 2
0
        public Specification(AssetFile file)
        {
            _fullname = new Lazy <string>(() => Parent.FullName + "/" + _libraryName);

            File = file;

            string fileContentFolder = file.ContentFolder();

            if (fileContentFolder == null || fileContentFolder == "specs")
            {
                _contentFolder = null;
            }
            else
            {
                var list = fileContentFolder.Split('/').ToList();
                list.Remove("specs");

                _contentFolder = list.Join("/");
            }

            _libraryName = file.LibraryName();
            var libraryParts = _libraryName.Split('.').ToList();

            var index = libraryParts.IndexOf("spec");

            if (index > -1)
            {
                _subject = libraryParts.Take(index).Join(".");
            }
            else
            {
                _subject = libraryParts.Where(x => !_ignoredExtensions.Contains("." + x)).Join(".");
            }
        }
Esempio n. 3
0
        public bool DependsOn(AssetFile other)
        {
            if (!string.Equals(_contentFolder, other.ContentFolder(), StringComparison.InvariantCultureIgnoreCase))
            {
                return(false);
            }

            return(string.Equals(_subject, DetermineLibraryName(other), StringComparison.InvariantCultureIgnoreCase));
        }
Esempio n. 4
0
        public static string DetermineSpecContentFolder(AssetFile file)
        {
            var contentFolder = file.ContentFolder();
            var list          = contentFolder.Split('/').ToList();

            list.RemoveAll(x => x == "specs");

            return(list.Join("/"));
        }