{"id":18769887,"url":"https://github.com/crystal-china/baked_file_system_mounter","last_synced_at":"2025-12-10T20:30:13.283Z","repository":{"id":50657251,"uuid":"519755488","full_name":"crystal-china/baked_file_system_mounter","owner":"crystal-china","description":"assemble files in assets folder into executable binary use `backed_file_system` at compile time, then mount it to new file system folder at runtime.","archived":false,"fork":false,"pushed_at":"2024-05-17T02:53:54.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-29T07:27:11.324Z","etag":null,"topics":["backed","executable-binary","pack","single-executable","static-files"],"latest_commit_sha":null,"homepage":"","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crystal-china.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-31T11:22:25.000Z","updated_at":"2024-02-21T17:51:02.000Z","dependencies_parsed_at":"2024-12-29T07:27:07.944Z","dependency_job_id":"942ada04-d811-4edf-970e-da4c55d96855","html_url":"https://github.com/crystal-china/baked_file_system_mounter","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-china%2Fbaked_file_system_mounter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-china%2Fbaked_file_system_mounter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-china%2Fbaked_file_system_mounter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-china%2Fbaked_file_system_mounter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crystal-china","download_url":"https://codeload.github.com/crystal-china/baked_file_system_mounter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239671421,"owners_count":19677875,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backed","executable-binary","pack","single-executable","static-files"],"created_at":"2024-11-07T19:17:13.429Z","updated_at":"2025-12-10T20:30:13.227Z","avatar_url":"https://github.com/crystal-china.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# baked_file_system_mounter\n\nassemble files inside current directories into executable binary use `backed_file_system` at compile time, then mount it on new file system at runtime. \n\nLet us assume there are assets folders like this:\n\n\n```sh\nPROJECT_ROOT/\n  src/assets/\n  └── materialize\n\t  ├── css\n\t  │   └── materialize.min.css\n\t  └── js\n\t\t  └── materialize.min.js\n```\n\nWhat we want is:\n\n1. Assemble those assets file into binary when build.\n\n2. When copying binary into `/public` directory (on target host), running it will extract assets, like this:\n\n```sh\nmy_app*\npublic/\n└── materialize\n    ├── css\n    │   └── materialize.min.css\n    └── js\n        └── materialize.min.js\n3 directories, 2 files\n```\n\nWith following configuration.\n\n```crystal\nrequire \"baked_file_system_mounter\"\n\nBakedFileSystemMounter.assemble(\n  {\n    \"src/assets\" =\u003e \"public\",\n  }\n)\n\n{% if flag?(:release) %}\n  BakedFileSystemStorage.mount\n{% end %}\n```\n\nThen, use can use those assets both in development(src/assets/materialize) and production(public/materialize), like this:\n\n```erb\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003clink rel=\"stylesheet\" href=\"/materialize/css/materialize.min.css\" /\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n      \u003c%= yield_content \"footer\" %\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     baked_file_system_mounter:\n       github: crystal-china/baked_file_system_mounter\n   ```\n\n2. Run `shards install`\n\n## Usage\n\nYou can passing a `Hash` as argument for mapping.\n\n```crystal\nrequire \"baked_file_system_mounter\"\n\n#\n# we assemble all files in `src/assets`,`db` into executable binary when we build,\nBakedFileSystemMounter.assemble(\n  {\n    \"src/assets\" =\u003e \"public\",\n    \"db\" =\u003e \"db\"\n  }\n)\n\nif APP_ENV == \"production\"\n  # we assemble the db into db folder too\n  # Then mount files in `src/assets` into `public` and files in `db` into `db`.\n  # folder will be created it if not exists.\n  BakedFileSystemStorage.mount\nend\n\n```\n\nYou can pass a Array as argument too.\n\n```crystal\nBakedFileSystemMounter.assemble([\"public\", \"db\"])\n\n# It's same as:\n\n# BakedFileSystemMounter.assemble(\n#   {\n#     \"public\" =\u003e \"public\",\n#     \"db\" =\u003e \"db\"\n#   }\n# )\n\nif APP_ENV == \"production\" \n  BakedFileSystemStorage.mount\nend\n\n```\n\nIt can be used to mount assets outside current directory, e.g. /tmp\n\n```crystal\nBakedFileSystemMounter.assemble(\n    {\n      \"sounds\" =\u003e \"/tmp/sounds\",\n    }\n)\n\nif APP_ENV == \"production\" \n  BakedFileSystemStorage.mount\nend\n```\n\n## Development\n\nTODO: Write development instructions here\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/crystal-china/baked_file_system_mounter/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Billy.Zheng](https://github.com/zw963) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrystal-china%2Fbaked_file_system_mounter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrystal-china%2Fbaked_file_system_mounter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrystal-china%2Fbaked_file_system_mounter/lists"}