{"id":18559022,"url":"https://github.com/linux-china/tgm","last_synced_at":"2025-04-10T02:30:36.353Z","repository":{"id":57669651,"uuid":"290302600","full_name":"linux-china/tgm","owner":"linux-china","description":"Project Template generator management","archived":false,"fork":false,"pushed_at":"2024-10-08T03:31:05.000Z","size":152,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-02T02:51:14.858Z","etag":null,"topics":["generator","rust","template"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/linux-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":"2020-08-25T19:16:34.000Z","updated_at":"2024-10-08T03:31:09.000Z","dependencies_parsed_at":"2024-11-06T21:44:52.220Z","dependency_job_id":null,"html_url":"https://github.com/linux-china/tgm","commit_stats":{"total_commits":211,"total_committers":1,"mean_commits":211.0,"dds":0.0,"last_synced_commit":"aa6d5966c14b8afcc4371d9dbc661cd86a98623c"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Ftgm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Ftgm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Ftgm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linux-china%2Ftgm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linux-china","download_url":"https://codeload.github.com/linux-china/tgm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144155,"owners_count":21054876,"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":["generator","rust","template"],"created_at":"2024-11-06T21:41:51.940Z","updated_at":"2025-04-10T02:30:35.842Z","avatar_url":"https://github.com/linux-china.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"tgm - Template Generator Manager\n================================\n![Build Status](https://img.shields.io/github/workflow/status/linux-china/tgm/Rust)\n[![tgm Crate](https://img.shields.io/crates/v/tgm)](https://crates.io/crates/tgm)\n[![dependency status](https://deps.rs/crate/tgm/0.10.0/status.svg)](https://deps.rs/crate/tgm/0.10.0)\n\nGenerate project structure from git template repository, \nand ignited by [MicroServices Service Template Pattern](https://microservices.io/patterns/service-template.html)\n\nWhy tgm?\n\n* Manage all template repositories\n* Create app from template quickly\n* Prompt for template variables\n\n# Template repository\nPlease add template.json file in your template repository, code as following：\n\n```json\n{\n  \"name\": \"spring-boot-java\",\n  \"repository\": \"https://github.com/linux-china/spring-boot-java-template\",\n  \"description\": \"Spring Boot App Java\",\n  \"post_create\": \"mvn -DskipTests compile\",\n  \"variables\": [\n    {\n      \"name\": \"groupId\",\n      \"description\": \"Maven groupId\"\n    },\n    {\n      \"name\": \"artifactId\",\n      \"description\": \"Maven artifactId\"\n    }\n  ],\n  \"files\": [\n    \"pom.xml\",\"src/main/resources/application.properties\"\n  ]\n}\n```\n\n**Attention:** You can add regex pattern validation for variable's value like following:\n\n```json\n    {\n      \"name\": \"email\",\n      \"description\": \"author email\",\n      \"pattern\": \"[\\\\w-\\\\.]+@([\\\\w-]+\\\\.)+[\\\\w-]{2,4}\"\n    }\n```\n\nIn the resource files, such as pom.xml, use template variable as following:\n\n```xml\n\u003cproject\u003e\n  \u003cgroupId\u003e@groupId@\u003c/groupId\u003e\n  \u003cartifactId\u003e@artifactId@\u003c/artifactId\u003e\n\u003c/project\u003e\n```\n\n*default global variables:*\n\n* current_year: current year, such as 2020\n* current_date: current date, format like 08/30/2020\n* os_name: linux, macos, ios, freebsd, dragonfly, netbsd, openbsd, solaris, android, windows\n* os_family: unix, windows\n* os_arch: x86_64, arm\n\n# Install \u0026 Usage\n\n```\n$ cargo install tgm\n$ tgm add linux-china/spring-boot-java-template\n$ tgm list\n$ tgm create spring-boot-java spring-app-demo\n```\n\n# tgm commands:\n\n* list: list local templates\n* list --remote:  list templates from https://github.com/tgm-templates/\n* add: add new template from GitHub template repository or manual\n\n```\n$ tgm add --name spring-boot-java --repo https://github.com/linux-china/spring-boot-java-template.git --desc \"Spring Boot Java template\"\n```\n\n* import template from GitHub's repository\n\n```\n$ tgm import linux-china/spring-boot-kotlin-template\n$ tgm import https://github.com/linux-china/spring-boot-java-template\n```\n\n* remove: remove template\n\n```\n$ tgm remove spring-boot-java\n```\n\n* create: create app from template\n\n```\n$ tgm create spring-boot-java spring-demo1 \n```\n\n# Shell completion\n\n### oh-my-zsh\n\n```\n$ tgm complete --oh_my_zsh\n```\n\ntgm will add tgm to plugins in ~/.zshrc.\n\n### bash\n\n```\n$ tgm complete --bash \u003e tgm-completion.bash\n$ source ./tgm-completion.bash \n```\n\n# References\n\n* Command line utilities: https://lib.rs/command-line-utilities\n* Command-line apps in Rust: https://www.rust-lang.org/what/cli\n* Serde: framework for serializing and deserializing Rust data structures https://serde.rs/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Ftgm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinux-china%2Ftgm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinux-china%2Ftgm/lists"}