{"id":17680879,"url":"https://github.com/devnote-dev/license","last_synced_at":"2025-07-16T05:34:52.389Z","repository":{"id":186013113,"uuid":"674478985","full_name":"devnote-dev/license","owner":"devnote-dev","description":"A simple license management library","archived":false,"fork":false,"pushed_at":"2023-10-25T23:43:27.000Z","size":67,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T19:13:24.416Z","etag":null,"topics":[],"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/devnote-dev.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":"2023-08-04T03:50:20.000Z","updated_at":"2023-08-04T07:03:46.000Z","dependencies_parsed_at":"2023-10-15T17:26:17.414Z","dependency_job_id":"64a498c9-4727-4101-91ad-92d10a27f6a1","html_url":"https://github.com/devnote-dev/license","commit_stats":null,"previous_names":["devnote-dev/license"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/devnote-dev/license","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Flicense","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Flicense/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Flicense/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Flicense/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devnote-dev","download_url":"https://codeload.github.com/devnote-dev/license/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devnote-dev%2Flicense/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265484892,"owners_count":23774413,"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":[],"created_at":"2024-10-24T09:09:33.086Z","updated_at":"2025-07-16T05:34:52.335Z","avatar_url":"https://github.com/devnote-dev.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# license\n\nA simple shard for using and managing licenses in your Crystal project. All licenses have been made available via the [choosealicense.com repository](https://github.com/github/choosealicense.com) by GitHub and is freely available under the MIT license.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     license:\n       github: devnote-dev/license\n   ```\n\n2. Run `shards install`\n\n\u003e **Warning**\n\u003e This shard only works with Crystal version 1.9.0 and above. This is due to how enum members are parsed from certain string formats.\n\n## Usage\n\nLicenses are loaded at compile time depending on the methods you use. [Click here](/src/licenses/) for the full list of available licenses.\n\nA single license can be loaded using the `License.load` method:\n\n```crystal\nrequire \"license\"\n\nlicense = License.load \"mit\" # case-insensitive!\n```\n\nThis will return a license instance which contains the license contents as well as metadata about the license such as the title, SPDX identifier, description and more. See [license.cr](/src/license.cr) for available methods.\n\nMultiple licenses can be loaded using the same method, which will return an array of the license instances:\n\n```crystal\nlicenses = License.load \"bsd-2-clause\", \"bsd-3-clause\"\n# =\u003e [#\u003cLicense:0x...\u003e, #\u003cLicense:0x...\u003e]\n```\n\n\u003e **Warning**\n\u003e Unknown licenses will cause a compilation error.\n\nYou can also get all available licenses at runtime by using the `License.init` method then access them via `License.licenses`:\n\n```crystal\nLicense.init # loads everything at compile time\nLicense.licenses # =\u003e [#\u003cLicense:0x...\u003e, ...]\n```\n\nIf you wish to do this yourself then you can use the `License.load_all` macro method which will return an array of all available licenses.\n\n### Rendering\n\nLicenses can be rendered at compile time or at runtime via the `License.render` macro or `License#render` instance method.\n\n```crystal\n# via macro\nLicense.render \"mpl-2.0\", year: 2023, author: \"devnote-dev\"\n# =\u003e \"Mozilla Public License Version 2.0 ...\"\n\n# via instance method\nlicense = License.load \"mpl-2.0\"\nlicense.render year: 2023, author: \"devnote-dev\"\n# =\u003e \"Mozilla Public License Version 2.0 ...\"\n```\n\nKeep in mind that the `render` macro method can also raise a compile time error like the other macro methods if the license is not found.\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/devnote-dev/license/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- [Devonte W](https://github.com/devnote-dev) - creator and maintainer\n\nThis repository is managed under the MIT license.\n\n© 2023 devnote-dev\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevnote-dev%2Flicense","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevnote-dev%2Flicense","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevnote-dev%2Flicense/lists"}