Пример #1
0
 public AssetFileBuilder(IAssetFileRegistration registration, string specificDirectory,
     PackageAssetDirectory directory, AssetFolder assetFolder)
 {
     _registration = registration;
     _specificDirectory = specificDirectory;
     _directory = directory;
     _assetFolder = assetFolder;
 }
Пример #2
0
 public AssetFileBuilder(IAssetFileRegistration registration, string specificDirectory,
                         PackageAssetDirectory directory, AssetFolder assetFolder)
 {
     _registration      = registration;
     _specificDirectory = specificDirectory;
     _directory         = directory;
     _assetFolder       = assetFolder;
 }
        public static HttpResponse GetAsset(this EndpointDriver endpoints, AssetFolder folder, string name, string etag = null)
        {
            var path = new AssetPath(name, folder);

            return endpoints.GetByInput(path, configure:request => {
                request.Headers.Add(HttpRequestHeader.IfNoneMatch, etag);
            });
        }
        public AssetFile(string name, AssetFolder folder) : this(name)
        {
            Folder = folder;

            if (_mimeType == null && folder != null)
            {
                _mimeType = folder.DefaultMimetype();
            }
        }
Пример #5
0
        public AssetFile(string name, AssetFolder folder) : this(name)
        {
            Folder = folder;

            if (_mimeType == null && folder != null)
            {
                _mimeType = folder.DefaultMimetype();
            }
        }
Пример #6
0
        public AssetPath(string package, string name, AssetFolder folder) : base(name)
        {
            if (package == null) throw new ArgumentNullException("package");
            if (name == null) throw new ArgumentNullException("name");

            Name = name;
            Package = package;
            Folder = folder;
        }
Пример #7
0
        public AssetFile(string name, AssetFolder? folder)
            : this(name)
        {
            Folder = folder;

            if (_mimeType == null && folder.HasValue)
            {
                _mimeType = MimeType.ForFolder(folder.Value);
            }
        }
Пример #8
0
        public void ReadAssetType(PackageAssetDirectory directory, string contentFolder, AssetFolder assetFolder)
        {
            var specificFolder = contentFolder.AppendPath(assetFolder.ToString());
            if (_system.DirectoryExists(specificFolder))
            {
                _log.Trace(LoadingAssetTypeForPackageAt.ToFormat(specificFolder));
                var builder = new AssetFileBuilder(_registration, specificFolder, directory, assetFolder);

                _system.FindFiles(specificFolder, FileSet.Everything()).Each(builder.CreateAssetFile);
            }
        }
        public AssetPath(string package, string name, AssetFolder folder) : base(name)
        {
            if (package == null)
            {
                throw new ArgumentNullException("package");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            Name    = name;
            Package = package;
            Folder  = folder;
        }
        public void SetUp()
        {
            FubuMvcPackageFacility.PhysicalRootPath = Environment.CurrentDirectory;

            packageDirectory = ".".ToFullPath();
            _packages = new List<IPackageInfo>();

            AssetFolderIs = AssetFolder.scripts;
            writeFile("a.js");
            writeFile("b.js");
            writeFile("folder1/c.js");
            writeFile("folder2/d.js");

            AssetFolderIs = AssetFolder.styles;
            writeFile("main.css");
            writeFile("page.css");
            writeFile("folder1/a.css");

            startPackage("pak1");
            AssetFolderIs = AssetFolder.scripts;
            writeFile("e.js");
            writeFile("f.js");

            startPackage("pak2");
            AssetFolderIs = AssetFolder.styles;
            writeFile("a.css");
            writeFile("b.css");
            writeFile("c.css");

            startPackage("pak3");
            AssetFolderIs = AssetFolder.scripts;
            writeFile("a.js");

            _theFileGraph = new AssetFileGraph();
            var activator = new AssetFileGraphBuilderActivator(_theFileGraph,new AssetLogsCache());
            theLog = new PackageLog();
            activator.Activate(_packages, theLog);

            Debug.WriteLine(theLog.FullTraceText());
        }
Пример #11
0
        private void readPath(string path)
        {
            if (!path.Contains("/"))
            {
                Name = path;
                return;
            }

            foreach (AssetFolder type in AssetFolder.AllFolders())
            {
                var prefix = type + "/";

                if (path.StartsWith(prefix))
                {
                    Folder = type;
                    Name = path.Substring(prefix.Length);
                    return;
                }
            }

            Name = path;
        }
        private void readPath(string path)
        {
            if (!path.Contains("/"))
            {
                Name = path;
                return;
            }

            foreach (AssetFolder type in AssetFolder.AllFolders())
            {
                var prefix = type + "/";

                if (path.StartsWith(prefix))
                {
                    Folder = type;
                    Name   = path.Substring(prefix.Length);
                    return;
                }
            }

            Name = path;
        }
        public void SetUp()
        {
            packageDirectory = ".".ToFullPath();
            _packages = new List<IPackageInfo>();

            AssetFolderIs = AssetFolder.scripts;
            writeFile("a.js");
            writeFile("b.js");
            writeFile("folder1/c.js");
            writeFile("folder2/d.js");

            AssetFolderIs = AssetFolder.styles;
            writeFile("main.css");
            writeFile("page.css");
            writeFile("folder1/a.css");

            startPackage("pak1");
            AssetFolderIs = AssetFolder.scripts;
            writeFile("e.js");
            writeFile("f.js");

            startPackage("pak2");
            AssetFolderIs = AssetFolder.styles;
            writeFile("a.css");
            writeFile("b.css");
            writeFile("c.css");

            startPackage("pak3");
            AssetFolderIs = AssetFolder.scripts;
            writeFile("a.js");

            thePipeline = new AssetPipeline();
            var activator = new AssetPipelineBuilderActivator(thePipeline,new AssetLogsCache());
            theLog = new PackageLog();
            activator.Activate(_packages, theLog);

            Debug.WriteLine(theLog.FullTraceText());
        }
Пример #14
0
 public IEnumerable <AssetFile> FilesForAssetType(AssetFolder folder)
 {
     return(_files[folder]);
 }
Пример #15
0
 private IEnumerable <AssetFile> matchingType(AssetFolder folder, string name)
 {
     return(_files[folder].Where(x => x.Name.EqualsIgnoreCase(name)));
 }
Пример #16
0
 private IEnumerable<AssetFile> matchingType(AssetFolder folder, string name)
 {
     return _files[folder].Where(x => x.Name == name);
 }
Пример #17
0
 public IEnumerable<AssetFile> FilesForAssetType(AssetFolder folder)
 {
     return _files[folder];
 }
Пример #18
0
 /// <summary>
 /// Resolve the url for a named asset
 /// </summary>
 /// <param name="folder"></param>
 /// <param name="name"></param>
 /// <returns></returns>
 public string UrlForAsset(AssetFolder folder, string name)
 {
     var relativeUrl = DetermineRelativeAssetUrl(folder, name);
     return _httpRequest.ToFullUrl(relativeUrl);
 }
Пример #19
0
 // TODO -- move the unit tests
 public static string DetermineRelativeAssetUrl(AssetFolder folder, string name)
 {
     return "{0}/{1}/{2}".ToFormat(AssetsUrlFolder, folder, name);
 }
Пример #20
0
 protected bool Equals(AssetFolder other)
 {
     return(string.Equals(_name, other._name));
 }
Пример #21
0
 private IEnumerable<AssetFile> matchingType(AssetFolder folder, string name)
 {
     return _files[folder].Where(x => x.Name.EqualsIgnoreCase(name));           
 }
Пример #22
0
 public static string DetermineAssetUrl(AssetFolder? folder, string name)
 {
     var url = "{0}/{1}/{2}".ToFormat(AssetsUrlFolder, folder, name);
     return url.ToAbsoluteUrl();
 }
Пример #23
0
 public static MimeType ForFolder(AssetFolder folder)
 {
     return _mimeTypes.GetAll().FirstOrDefault(x => x.Folder().Equals(folder));
 }
 public AssetPath(string path, AssetFolder folder) : base(path)
 {
     Folder = folder;
 }
 private void writePackageFile(AssetFolder assetFolder, params string[] names)
 {
     var path = PackageDirectory.ToFullPath().AppendPath("content", assetFolder.ToString()).AppendPath(names);
     system.WriteStringToFile(path, "something");
 }
Пример #26
0
 public MimeType Folder(AssetFolder folder)
 {
     _folder = folder;
     return this;
 }
Пример #27
0
 public AssetPath(string path, AssetFolder folder) : base(path)
 {
     Folder = folder;
 }
        public void ReadAssetType(PackageAssetDirectory directory, string contentFolder, AssetFolder assetFolder)
        {
            var specificFolder = contentFolder.AppendPath(assetFolder.ToString());

            if (_system.DirectoryExists(specificFolder))
            {
                _log.Trace(LoadingAssetTypeForPackageAt.ToFormat(specificFolder));
                var builder = new AssetFileBuilder(_registration, specificFolder, directory, assetFolder);

                _system.FindFiles(specificFolder, FileSet.Everything()).Each(builder.CreateAssetFile);
            }
        }
Пример #29
0
 protected bool Equals(AssetFolder other)
 {
     return string.Equals(_name, other._name);
 }