Skip to content
Snippets Groups Projects
Commit f9f4c816 authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

Added License and empty dbml file

parent 688a1f12
No related branches found
No related tags found
No related merge requests found
Pipeline #82051 canceled
......@@ -37,6 +37,12 @@ func InitProject(name string, dbType string) {
// Create datasmith.yaml file from template
createConfigFile(slug, name, dbType)
// Create an empty database.dbml file
createDBMLFile(slug)
// Create LICENSE.md file from template
createLicenseFile(slug, name)
// TODO: copy base files
fmt.Printf("Initialized new project structure in '%s'\n", slug)
......@@ -92,6 +98,34 @@ func createConfigFile(projectDir, projectName, dbType string) {
}
}
// createDBMLFile creates an empty database.dbml file in the project directory
func createDBMLFile(projectDir string) {
dbmlFilePath := filepath.Join(projectDir, "database.dbml")
file, err := os.Create(dbmlFilePath)
if err != nil {
fmt.Printf("Error creating database.dbml file: %v\n", err)
return
}
defer file.Close()
fmt.Printf("Created file: %s/database.dbml\n", projectDir)
}
// createLicenseFile creates the LICENSE.md file from template
func createLicenseFile(projectDir, projectName string) {
data := map[string]interface{}{
"Name": projectName,
"Year": time.Now().Year(),
}
err := templates.CreateFileFromTemplate(projectDir, "", "LICENSE.md", "LICENSE.md", data)
if err != nil {
fmt.Printf("Error creating LICENSE.md file: %v\n", err)
} else {
fmt.Printf("Created file: %s/LICENSE.md\n", projectDir)
}
}
// Help returns the help information for the init command
func InitHelp() string {
return "init [name] [--type mysql|postgres] : Create a new project with the specified name and database type."
......
# MIT License
Copyright (c) {{ .Year }} {{ .Name }}
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment