From 87fedc49e286687ace4f79c41e9e9bc60ef299a0 Mon Sep 17 00:00:00 2001 From: Mr Dung Date: Mon, 22 Feb 2021 19:15:19 +0700 Subject: [PATCH] refs update feature --- README.md | 7 +++++++ cmd/init.go | 5 ++--- config/yaml.go | 30 ------------------------------ templates/config.tmpl | 28 ++++++++++++++++++++++++++++ 4 files changed, 37 insertions(+), 33 deletions(-) delete mode 100644 config/yaml.go create mode 100644 templates/config.tmpl diff --git a/README.md b/README.md index 144c9a9..99f9fb1 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,13 @@ *Note: [init](docs/images/init.gif?raw=true) | [ping](docs/images/ping.gif?raw=true)* +## Features +- Deployment from local into remote +- Deployment on remote +- Run command for multiple remote +- Rsync multiple cluster +- Notify to chatwork, slack +- UI for deployment ## Run with docker for development ```sh diff --git a/cmd/init.go b/cmd/init.go index 2ca6498..12b52b3 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "github.com/AlecAivazis/survey/v2" - "github.com/dung13890/deploy-tool/config" "github.com/fatih/color" "github.com/urfave/cli/v2" "log" @@ -92,11 +91,11 @@ func (a *answers) createFile(filename string) (err error) { return } // Parse template to template yml - t, err := template.New("index").Parse(config.SourceYaml) + t, err := template.ParseFiles(filepath.Join(dir, "templates", "config.tmpl")) if err != nil { return } - t.Execute(f, a) + t.ExecuteTemplate(f, "config", a) return nil } diff --git a/config/yaml.go b/config/yaml.go deleted file mode 100644 index c75005c..0000000 --- a/config/yaml.go +++ /dev/null @@ -1,30 +0,0 @@ -package config - -var SourceYaml = `server: - address: "{{ .Ip }}" - user: "ec2-user" - port: 22 - dir: "/data/sites" - project: "{{ .Project }}" -repository: - url: "{{ .Repo }}" - branch: "master" - # tag: "1.0.2" -shared: - folders: - - "vendor" - - "node_modules" - files: - - ".env" -tasks: - - "echo 'Hello!!'" -cluster: - hosts: - # - "127.0.0.1" - rsync: - excludes: - - ".env" - - "*.log" - cmds: - - "uname -a" -` diff --git a/templates/config.tmpl b/templates/config.tmpl new file mode 100644 index 0000000..6bd83bd --- /dev/null +++ b/templates/config.tmpl @@ -0,0 +1,28 @@ +{{define "config"}}server: + address: "{{ .Ip }}" + user: "ec2-user" + port: 22 + dir: "/data/sites" + project: "{{ .Project }}" +repository: + url: "{{ .Repo }}" + branch: "master" + # tag: "1.0.2" +shared: + folders: + - "vendor" + - "node_modules" + files: + - ".env" +tasks: + - "echo 'Hello!!'" +cluster: + hosts: + # - "127.0.0.1" + rsync: + excludes: + - ".env" + - "*.log" + cmds: + - "uname -a" +{{end}}