{"id":21595186,"url":"https://github.com/euank/include-repo","last_synced_at":"2025-04-11T00:06:18.707Z","repository":{"id":57634517,"uuid":"146672586","full_name":"euank/include-repo","owner":"euank","description":"A rust crate to help with AGPL compliance! It implements the `include_repo!` macro","archived":false,"fork":false,"pushed_at":"2022-06-15T07:01:12.000Z","size":26,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T20:51:09.410Z","etag":null,"topics":["agpl","macros","rust-crate"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/euank.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}},"created_at":"2018-08-30T00:07:06.000Z","updated_at":"2022-11-20T02:30:43.000Z","dependencies_parsed_at":"2022-09-16T04:12:11.562Z","dependency_job_id":null,"html_url":"https://github.com/euank/include-repo","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2Finclude-repo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2Finclude-repo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2Finclude-repo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euank%2Finclude-repo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/euank","download_url":"https://codeload.github.com/euank/include-repo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247847614,"owners_count":21006100,"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":["agpl","macros","rust-crate"],"created_at":"2024-11-24T17:33:38.832Z","updated_at":"2025-04-11T00:06:18.688Z","avatar_url":"https://github.com/euank.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# include-repo\n\nThe `include_repo` rust crate provides a macro which embeds all files in the\nproject's git repository into the final executable. It does not embed git\nhistory nor metadata, but rather includes a tarball much like\n[`git archive`](https://git-scm.com/docs/git-archive) would produce.\n\nWhy might you want this? Well, the primary use-case I can think of (and in fact\nwhat I built it for) is to provide an\n[AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html) compliance endpoint.\n\nProviding the source code for your software is trivial if the source code is\nbuilt into the binary.\n\n## Usage\n\nThis crate is easy to use. Simply include the following in your code somewhere:\n\n```rust\nuse include_repo::include_repo;\n\nconst SOURCE_CODE: \u0026[u8] = include_repo!();\n// Expands to:\n// const SOURCE_CODE: \u0026[u8] = [128, 80, ...];\n// The bag of bytes is a tarball, so serve it with a .tar extension please!\n```\n\nIf you don't wish to include quite every file, that's also possible. For\nexample, if you don't want to include contents in your 'img' and 'third\\_party'\nfolders, that can be done like so:\n\n```rust\nuse include_repo::include_repo;\n\nconst SOURCE_CODE: \u0026[u8] = include_repo!(\".\", \":!/img/\", \":!/third_party\");\n// Any valid pathspec (see\n// https://git-scm.com/docs/gitglossary#gitglossary-aiddefpathspecapathspec) may\n// be used. Pathspecs *must* be string literals. Any number may be provided to\n// the macro.\n// The \".\" portion is optional on newer versions of git, but for backwards\n// compatibility it's best to add it if all other pathspecs are exclusions.\n```\n\nIf you want the tarball to be gzipped, use the `include_repo_gz!` macro instead. If you don't already have gzip decompression included in your binary, you may find it easier to shell out to `tar -xzv -f -` when the source is requested, or provide a `.tar.gz` file to users.\n\n## Assumptions\n\nThe following assumptions must be true for this crate to work correctly:\n\n* You use `git` for version control and have a modern version of `git` in your `PATH`\n* You want to provide your source code as a tarball (optionally gzipped), not a zip or something\n* You want your code embedded as a giant const in your binary (not e.g. a static file on disk)\n* You don't mind a proc macro running 'git' as part of your build\n\n# License\n\nThis code is conveniently available under the AGPL.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuank%2Finclude-repo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feuank%2Finclude-repo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuank%2Finclude-repo/lists"}