diff --git a/commands/add.go b/commands/add.go index f4b30e168b04a5c3f3e00197108834acf1ef5de8..59eea3168497698cb9ccd50d2d45b03d9b6271b4 100644 --- a/commands/add.go +++ b/commands/add.go @@ -23,7 +23,7 @@ func addTable(name string) { - Generate Test Data for the new table if wanted - Add Table to import-sql.sh - Add Description to the DBML file - - Add Description and mermaid to the README.md file + - Add Description and mermaid and DBML to the README.md file - Add Test to gitlab-ci.yml - Add to CHANGELOG.md - Bump version in datasmith.yaml diff --git a/commands/init.go b/commands/init.go index d61a45ce15577b606d4f3829ef7c418d1d341880..73859c25c2c5afccb0659908db96c27125842eb7 100644 --- a/commands/init.go +++ b/commands/init.go @@ -34,6 +34,9 @@ func InitProject(name string, dbType string) { // Create project directories createProjectDirs(slug) + // Create README.md file from template + createReadmeFile(slug, name, dbType) + // Create CHANGELOG.md file from template createChangelogFile(slug) @@ -79,12 +82,6 @@ func InitProject(name string, dbType string) { // Create k8s/deployment.template.yaml file from template based on dbType createK8sDeploymentFile(slug, dbType) - // TODO: copy base files from https://gitlab.ard.de/br/buzzboard/database/-/tree/develop?ref_type=heads - /* - - README.md - - Add Tests from segen des tages - */ - fmt.Printf("Initialized new project structure in '%s'\n", slug) fmt.Println("Initializing Git repository...") @@ -122,6 +119,21 @@ func createProjectDirs(projectName string) { } } +// createReadmeFile creates the README.md file from template +func createReadmeFile(projectDir, projectName, dbType string) { + data := map[string]interface{}{ + "Name": projectName, + "DbType": dbType, + } + + err := templates.CreateFileFromTemplate(projectDir, "", "README.md", "README.md", data) + if err != nil { + fmt.Printf("Error creating README.md file: %v\n", err) + } else { + fmt.Printf("Created file: %s/README.md\n", projectDir) + } +} + // createChangelogFile creates the CHANGELOG.md file from template func createChangelogFile(projectDir string) { data := map[string]interface{}{ diff --git a/templates/README.md.tmpl b/templates/README.md.tmpl new file mode 100644 index 0000000000000000000000000000000000000000..a5434deece43b2d7b16454b3c8528726b3d2a950 --- /dev/null +++ b/templates/README.md.tmpl @@ -0,0 +1,59 @@ +# Database :: {{ .Name }} + +The main {{ .DbType }} Database Structure. + +TODO: Describe your Database even more + +We are using SEMVER, so there is always a container with the latest version and one with the tag `latest` and one with `stable` + +[[_TOC_]] + +## Structure + +The database is structured in the following way: + +NO TABLES GIVEN + +```mermaid +erDiagram + +``` + +```dbml + +``` + +## Contributing + +We appreciate and welcome contributions from the community to enhance the features and overall quality of this project. Whether you're a developer, tester, or enthusiastic user, there are several ways [you can contribute](CONTRIBUTING.md). + +## License + +This Project is licensed under the [MIT License](LICENSE.md). Feel free to use, modify, and distribute it according to your needs. + +## Authors + +- **[Dominik Sigmund](https://gitlab.ard.de/dominik.sigmund)** - Lead Developer + +## Acknowledgments + +We appreciate the collaborative efforts that have contributed to the success of {{ .Name }} Database. We'd like to thank the following individuals and organizations for their support and contributions: + +- (none yet, but you could be the first!) + +## Support + +If you can't find a solution to your issue in the documentation, feel free to reach out to us for assistance. We offer support through the following channels: + +- **Email:** For non-urgent matters or if you prefer email communication, you can reach us at [devops@br.de](mailto:devops@br.de). Please provide detailed information about your issue so that we can assist you more effectively. + +## Important Note + +When seeking support, make sure to include the following information in your message: + +1. A detailed description of the issue you're facing. +2. Steps to reproduce the problem (if applicable). +3. Relevant configuration details. +4. Any error messages or logs related to the issue. + +This information will help us understand your situation better and provide a more accurate and timely response. \ No newline at end of file