{"id":22199544,"url":"https://github.com/lkubb/salt-formula-copier","last_synced_at":"2025-03-24T23:44:58.738Z","repository":{"id":261111046,"uuid":"883283897","full_name":"lkubb/salt-formula-copier","owner":"lkubb","description":"A Copier template for Salt formulae. Based on mapstack/TOFS patterns. Supports different formula flavors.","archived":false,"fork":false,"pushed_at":"2025-02-27T10:59:46.000Z","size":229,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-27T14:53:26.902Z","etag":null,"topics":["copier-template","salt","salt-formula","saltstack","saltstack-formula"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lkubb.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":"2024-11-04T17:36:57.000Z","updated_at":"2025-02-27T10:59:49.000Z","dependencies_parsed_at":"2024-11-04T19:30:53.665Z","dependency_job_id":"7809f93e-386d-46b2-b858-3edfd90e7fc4","html_url":"https://github.com/lkubb/salt-formula-copier","commit_stats":null,"previous_names":["lkubb/salt-formula-copier"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkubb%2Fsalt-formula-copier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkubb%2Fsalt-formula-copier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkubb%2Fsalt-formula-copier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lkubb%2Fsalt-formula-copier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lkubb","download_url":"https://codeload.github.com/lkubb/salt-formula-copier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245372219,"owners_count":20604489,"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":["copier-template","salt","salt-formula","saltstack","saltstack-formula"],"created_at":"2024-12-02T15:15:03.995Z","updated_at":"2025-03-24T23:44:58.719Z","avatar_url":"https://github.com/lkubb.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Create \u0026 Maintain Salt Formulae\n\nA [Copier][copier-repo] template that initializes a project structure for developing [Salt][salt-repo] formulae.\n\nIt's an opinionated variant of the [official template-formula][template-formula] and began its life as a [Cookiecutter/Cruft template][cruft-template].\n\n## Migration from previous template\n### `salt-template-formula`\nTemplate version `0.0.1` is identical to the last Cruft template.\nExpect this template to diverge significantly from the `template-formula` in future releases.\n\nYou can use the following command inside the project root to migrate to this template (requires `jq`):\n\n```bash\njq '.context.cookiecutter |\n    with_entries(select(.key | test(\"^[^_]\"))) |\n    with_entries(.key |=\n        if . == \"name\" then \"service_name\"\n        elif . == \"abbr\" then \"service_abbr\"\n        elif . == \"git_username\" then \"author\"\n        else . end) |\n    with_entries(if .key == \"needs_repo\" then .value = .value == \"y\" else . end)\n' .cruft.json \u003e tmp_copier_answers \u0026\u0026 \\\ncopier copy --trust --vcs-ref=0.0.1 https://github.com/lkubb/salt-formula-copier --data-file=tmp_copier_answers --skip \\* . \u0026\u0026 \\\ngit add --intent-to-add .copier-answers.yml \u0026\u0026 \\\ngit clean -ffd \u0026\u0026 \\\nrm -f .cruft.json \u0026\u0026 \\\ngit commit --no-verify -am \"Migrate to Copier template\"; rm -f tmp_copier_answers\n```\n\nYou should then immediately update (at least to version `0.0.8`, which excludes `.copier-answers.yml` from pre-commit YAML linting, but leaves everything else as before, and fixes two template bugs). Choose `general` as the template flavor when updating.\n\n```bash\ncopier update --trust --skip-answered  # --vcs-ref=0.0.7\n```\n\n### `salt-template-formula-compose`\nFor projects generated from the [compose template-formula][cruft-compose], you can follow similar steps as documented for `salt-template-formula`.\nUse the following command:\n\n```bash\njq '.context.cookiecutter |\n    with_entries(select(.key | test(\"^[^_]\"))) |\n    with_entries(.key |=\n        if . == \"name\" then \"service_name\"\n        elif . == \"abbr\" then \"service_abbr\"\n        elif . == \"git_username\" then \"author\"\n        else . end)\n' .cruft.json \u003e tmp_copier_answers \u0026\u0026 \\\ncopier copy --trust --vcs-ref=0.0.3 https://github.com/lkubb/salt-formula-copier --data flavor=compose --data-file=tmp_copier_answers --skip \\* . \u0026\u0026 \\\ngit add --intent-to-add .copier-answers.yml \u0026\u0026 \\\ngit clean -ffd \u0026\u0026 \\\nrm -f .cruft.json \u0026\u0026 \\\necho \"flavor_recorded: compose\" \u003e\u003e .copier-answers.yml \u0026\u0026 \\\ngit commit --no-verify -am \"Migrate to Copier template\"; rm -f tmp_copier_answers\n```\n\nBecause of a bug in versions \u003c0.0.7, updating from here needs a workaround. Ensure the repo state is completely clean with no untracked files/uncommitted changes before running:\n\n```bash\ncopier update --trust --skip-answered --vcs-ref=0.0.7 \u0026\u0026 \\\ngit add .copier-answers.yml  .pre-commit-config \u0026\u0026 \\\ngit commit -m \"Update to template version 0.0.7\" \u0026\u0026 \\\ngit reset --hard HEAD \u0026\u0026 git clean -ffd\n```\n\n### `salt-tool-template-formula`\nFor projects generated from the [tool template-formula][cruft-tool], you can follow similar steps as documented for `salt-template-formula`.\nUse the following command:\n\n```bash\njq '.context.cookiecutter |\n    with_entries(select(.key | test(\"^[^_]\"))) |\n    with_entries(.key |=\n        if . == \"name\" then \"service_name\"\n        elif . == \"abbr\" then \"service_abbr\"\n        elif . == \"git_username\" then \"author\"\n        elif . == \"modstate\" then \"extmods\"\n        elif . == \"usersettings\" then \"user_settings\"\n        else . end) |\n    with_entries(. |=\n        if .key == \"needs_repo\" then .value = .value == \"y\"\n        elif .key == \"extmods\" then .value = if .value == \"y\" then [\"execution\", \"state\"] else [] end\n        elif .key == \"has_service\" then .value = .value == \"y\"\n        elif .key == \"mac_library\" then .value = .value == \"y\"\n        elif .key == \"mac_cask\" then .value = .value == \"y\"\n        elif .key == \"has_xdg\" then .value = .value == \"y\"\n        elif .key == \"needs_xdg_help\" then .value = .value == \"y\"\n        elif .key == \"has_conffile_only\" then .value = .value == \"y\"\n        elif .key == \"has_configsync\" then .value = .value == \"y\"\n        elif .key == \"has_config_template\" then .value = .value == \"y\"\n        elif .key == \"has_completions\" then .value = .value == \"y\"\n        elif .key == \"has_tests\" then .value = .value == \"y\"\n        else . end)\n' .cruft.json \u003e tmp_copier_answers \u0026\u0026 \\\ncopier copy --trust --vcs-ref=0.0.5 https://github.com/lkubb/salt-formula-copier --data flavor=app --data-file=tmp_copier_answers --skip \\* . \u0026\u0026 \\\ngit add --intent-to-add .copier-answers.yml \u0026\u0026 \\\ngit clean -ffd \u0026\u0026 \\\nrm -f .cruft.json \u0026\u0026 \\\necho \"flavor_recorded: app\" \u003e\u003e .copier-answers.yml \u0026\u0026 \\\ngit commit --no-verify -am \"Migrate to Copier template\"; rm -f tmp_copier_answers\n```\n\nBecause of a bug in versions \u003c0.0.7, updating from here needs a workaround. Ensure the repo state is completely clean with no untracked files/uncommitted changes before running:\n\n```bash\ncopier update --trust --skip-answered --vcs-ref=0.0.7 \u0026\u0026 \\\ngit add .copier-answers.yml .pre-commit-config docs/index.rst \u0026\u0026 \\\ngit commit -m \"Update to template version 0.0.7\" \u0026\u0026 \\\ngit reset --hard HEAD \u0026\u0026 git clean -ffd\n```\n\n## Acknowledgement\nThis project is heavily based on the excellent work done in [saltstackformulas/template-formula][template-formula].\n\n## References\n* [Copier docs][copier-docs]\n\n[copier-repo]: https://github.com/copier-org/copier\n[salt-repo]: https://github.com/saltstack/salt\n[copier-docs]: https://copier.readthedocs.io/en/stable/\n[template-formula]: https://github.com/saltstack-formulas/template-formula\n[cruft-template]: https://github.com/lkubb/salt-template-formula\n[cruft-compose]: https://github.com/lkubb/salt-template-formula-compose\n[cruft-tool]: https://github.com/lkubb/salt-tool-template-formula\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkubb%2Fsalt-formula-copier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flkubb%2Fsalt-formula-copier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flkubb%2Fsalt-formula-copier/lists"}