Skip to content

Commit 28dcc8b

Browse files
author
Vic Shóstak
authored
Merge pull request #20 from create-go-app/dev
Dev -> v1.6.0
2 parents b1c44b7 + db23842 commit 28dcc8b

File tree

9 files changed

+18
-109
lines changed

9 files changed

+18
-109
lines changed

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ checksum:
6868
name_template: "checksums.txt"
6969

7070
snapshot:
71-
name_template: "{{.Tag}}"
71+
name_template: "{{ .Tag }}"
7272

7373
changelog:
7474
sort: asc

Dockerfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
1+
# This Dockerfile used ONLY with GoReleaser project (`task release [TAG...]`).
2+
# Please DO NOT use it for build a normal Docker image for Create Go App CLI!
3+
14
FROM alpine:3.12
25

36
LABEL maintainer="Vic Shóstak <[email protected]>"
47

5-
# Copy Create Go App binary.
8+
# Copy Create Go App CLI binary.
69
COPY cgapp /cgapp
710

8-
# Install git, npm.
11+
# Install git, npm (with nodejs).
912
RUN apk add --no-cache git npm
1013

11-
# Install frontend CLIs.
12-
RUN npm i -g -s create-react-app preact-cli @vue/cli degit @angular/cli
14+
# Install frontend CLIs (globally and in silent mode).
15+
RUN npm i -g -s \
16+
create-react-app \
17+
preact-cli \
18+
@vue/cli \
19+
@angular/cli \
20+
degit
1321

1422
# Set entry point.
1523
ENTRYPOINT ["/cgapp"]

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</h1>
55
<p align="center">Create a new production-ready project with <b>backend</b> (Golang), <b>frontend</b> (JavaScript, TypeScript)<br/>and <b>deploy automation</b> (Ansible, Docker) by running one CLI command.<br/><br/>Focus on <b>writing</b> code and <b>thinking</b> of business-logic! The CLI will take care of the rest.</p>
66

7-
<p align="center"><a href="https://github.com/create-go-app/cli/releases" target="_blank"><img src="https://img.shields.io/badge/version-v1.5.2-blue?style=for-the-badge&logo=none" alt="cli version" /></a>&nbsp;<a href="https://pkg.go.dev/github.com/create-go-app/cli?tab=doc" target="_blank"><img src="https://img.shields.io/badge/Go-1.11+-00ADD8?style=for-the-badge&logo=go" alt="go version" /></a>&nbsp;<a href="https://gocover.io/github.com/create-go-app/cli/pkg/cgapp" target="_blank"><img src="https://img.shields.io/badge/Go_Cover-94%25-success?style=for-the-badge&logo=none" alt="go cover" /></a>&nbsp;<a href="https://goreportcard.com/report/github.com/create-go-app/cli" target="_blank"><img src="https://img.shields.io/badge/Go_report-A+-success?style=for-the-badge&logo=none" alt="go report" /></a>&nbsp;<img src="https://img.shields.io/badge/license-apache_2.0-red?style=for-the-badge&logo=none" alt="license" /></p>
7+
<p align="center"><a href="https://github.com/create-go-app/cli/releases" target="_blank"><img src="https://img.shields.io/badge/version-v1.6.0-blue?style=for-the-badge&logo=none" alt="cli version" /></a>&nbsp;<a href="https://pkg.go.dev/github.com/create-go-app/cli?tab=doc" target="_blank"><img src="https://img.shields.io/badge/Go-1.11+-00ADD8?style=for-the-badge&logo=go" alt="go version" /></a>&nbsp;<a href="https://gocover.io/github.com/create-go-app/cli/pkg/cgapp" target="_blank"><img src="https://img.shields.io/badge/Go_Cover-94%25-success?style=for-the-badge&logo=none" alt="go cover" /></a>&nbsp;<a href="https://goreportcard.com/report/github.com/create-go-app/cli" target="_blank"><img src="https://img.shields.io/badge/Go_report-A+-success?style=for-the-badge&logo=none" alt="go report" /></a>&nbsp;<img src="https://img.shields.io/badge/license-apache_2.0-red?style=for-the-badge&logo=none" alt="license" /></p>
88

99
## ⚡️ [Quick start](https://create-go.app/quick-start/)
1010

@@ -141,13 +141,6 @@ project:
141141
# like `github.com/user/template`
142142
- webserver: nginx
143143

144-
# Web/proxy server for your project.
145-
# (Optional, to skip set to `none`)
146-
# String: `postgres`
147-
# User template: supported, set to URL (without protocol),
148-
# like `github.com/user/template`
149-
- database: postgres
150-
151144
# Automation config.
152145
roles:
153146
# Ansible roles for deploy your project.
@@ -270,10 +263,6 @@ cgapp deploy --use-config
270263

271264
- [x] [`nginx`](https://create-go.app/docker-containers/nginx/) — Docker container with [Nginx](https://nginx.org).
272265

273-
**Database:**
274-
275-
- [ ] [`postgres`](https://create-go.app/docker-containers/postgres/) _WIP_ — Docker container with [PostgreSQL](https://postgresql.org).
276-
277266
## 🤔 Why another CLI?
278267

279268
When we started this project, we asked ourselves this question too and... came to the conclusion, that approximately 8 out of 10 routine operations at the start of a new project and/or the deployment of an existing one **can be automated**. And it would be better to have all the necessary functions inside one CLI. That's why we transferred all our experience to the Create Go App CLI, which we use ourselves!

cmd/create.go

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ var runCreateCmd = func(cmd *cobra.Command, args []string) {
5656
backend = strings.ToLower(projectConfig["backend"].(string))
5757
frontend = strings.ToLower(projectConfig["frontend"].(string))
5858
webserver = strings.ToLower(projectConfig["webserver"].(string))
59-
database = strings.ToLower(projectConfig["database"].(string))
6059

6160
// Check, if config file contains `roles` section
6261
if rolesConfig != nil {
@@ -85,7 +84,6 @@ var runCreateCmd = func(cmd *cobra.Command, args []string) {
8584
backend = strings.ToLower(createAnswers.Backend)
8685
frontend = strings.ToLower(createAnswers.Frontend)
8786
webserver = strings.ToLower(createAnswers.Webserver)
88-
database = strings.ToLower(createAnswers.Database)
8987
installAnsibleRoles = createAnswers.InstallAnsibleRoles
9088
}
9189

@@ -161,7 +159,7 @@ var runCreateCmd = func(cmd *cobra.Command, args []string) {
161159
}
162160

163161
// Docker containers.
164-
if webserver != "none" || database != "none" {
162+
if webserver != "none" {
165163

166164
cgapp.SendMsg(true, "* * *", "Configuring Docker containers...", "yellow", false)
167165

@@ -181,23 +179,6 @@ var runCreateCmd = func(cmd *cobra.Command, args []string) {
181179
os.Exit(1)
182180
}
183181
}
184-
185-
if database != "none" {
186-
// Create container with a database.
187-
cgapp.SendMsg(true, "*", "Create container with database...", "cyan", true)
188-
if err := cgapp.CreateProjectFromRegistry(
189-
&registry.Project{
190-
Type: "database",
191-
Name: database,
192-
RootFolder: currentDir,
193-
},
194-
registry.Repositories,
195-
registry.RegexpDatabasePattern,
196-
); err != nil {
197-
cgapp.SendMsg(true, "[ERROR]", err.Error(), "red", true)
198-
os.Exit(1)
199-
}
200-
}
201182
}
202183

203184
// Stop timer

configs/.cgapp.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ project:
4040
# like `github.com/user/template`
4141
- webserver: nginx
4242

43-
# Web/proxy server for your project.
44-
# (Optional, to skip set to `none`)
45-
# String: `postgres`
46-
# User template: supported, set to URL (without protocol),
47-
# like `github.com/user/template`
48-
- database: postgres
49-
5043
# Automation config.
5144
roles:
5245
# Ansible roles for deploy your project.

configs/deploy-playbook.yml

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@
3232
path: ./webserver
3333
register: webserver_folder
3434

35-
- name: Check, if ./database directory is exists
36-
stat:
37-
path: ./database
38-
register: database_folder
39-
4035
#
4136
# The block that builds and runs the backend part of the project.
4237
#
@@ -94,29 +89,3 @@
9489
state: started
9590
# Run block only if ./webserver is a folder and exists.
9691
when: webserver_folder.stat.exists and webserver_folder.stat.isdir
97-
98-
#
99-
# The block that builds and runs the database part of the project.
100-
#
101-
- name: Database block
102-
block:
103-
- name: Builds Docker image for database
104-
docker_image:
105-
name: cgapp_database # name of the database image
106-
build:
107-
path: ./database # folder with Dockerfile
108-
pull: yes
109-
source: build
110-
111-
- name: Runs Docker container with database
112-
docker_container:
113-
name: cgapp-database # name of the database container
114-
image: cgapp_database:latest
115-
recreate: yes
116-
networks:
117-
- name: "{{ network_name }}"
118-
ports:
119-
- "5432:5432"
120-
state: started
121-
# Run block only if ./database is a folder and exists.
122-
when: database_folder.stat.exists and database_folder.stat.isdir

pkg/cgapp/create_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,6 @@ func TestCreateProjectFromRegistry(t *testing.T) {
4444
},
4545
false,
4646
},
47-
{
48-
"successfully created database",
49-
args{
50-
p: &registry.Project{
51-
Type: "database",
52-
Name: "postgres",
53-
RootFolder: "../../tmp",
54-
},
55-
r: registry.Repositories,
56-
m: registry.RegexpDatabasePattern,
57-
},
58-
false,
59-
},
6047
{
6148
"failed to create (not valid repository)",
6249
args{

pkg/embed/blob.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/registry/defaults.go

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import "github.com/AlecAivazis/survey/v2"
3030

3131
const (
3232
// CLIVersion version of Create Go App CLI.
33-
CLIVersion = "1.5.2"
33+
CLIVersion = "1.6.0"
3434
// RegexpAnsiblePattern pattern for Ansible roles.
3535
RegexpAnsiblePattern = "^(deploy)$"
3636
// RegexpBackendPattern pattern for backend.
@@ -39,8 +39,6 @@ const (
3939
RegexpFrontendPattern = "^(p?react:?|vue(:?[\\w]+)?(:?[\\w-_0-9\\/]+)?|angular|svelte|sapper:?)"
4040
// RegexpWebServerPattern pattern for web/proxy servers.
4141
RegexpWebServerPattern = "^(nginx)$"
42-
// RegexpDatabasePattern pattern for databases.
43-
RegexpDatabasePattern = "^(postgres)$"
4442
)
4543

4644
// Project struct for describe project.
@@ -67,7 +65,6 @@ type CreateAnswers struct {
6765
Backend string
6866
Frontend string
6967
Webserver string
70-
Database string
7168
InstallAnsibleRoles bool `survey:"roles"`
7269
AgreeCreation bool `survey:"agree"`
7370
}
@@ -99,13 +96,6 @@ var (
9996
"nginx": "github.com/create-go-app/nginx-docker",
10097
},
10198
},
102-
103-
// Docker containers with databases.
104-
"database": {
105-
List: map[string]string{
106-
"postgres": "github.com/create-go-app/postgres-docker",
107-
},
108-
},
10999
}
110100

111101
// Commands collection.
@@ -178,14 +168,6 @@ var (
178168
Default: "none",
179169
},
180170
},
181-
{
182-
Name: "database",
183-
Prompt: &survey.Select{
184-
Message: "Choose a database:",
185-
Options: []string{"none", "Postgres"},
186-
Default: "none",
187-
},
188-
},
189171
{
190172
Name: "roles",
191173
Prompt: &survey.Confirm{

0 commit comments

Comments
 (0)