Skip to content

Commit

Permalink
First pass at renaming and cleaning up old stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
bmonkman committed May 22, 2020
1 parent f146c26 commit be28f27
Show file tree
Hide file tree
Showing 25 changed files with 89 additions and 97 deletions.
4 changes: 2 additions & 2 deletions .gitignore
@@ -1,9 +1,9 @@
main-packr.go
packrd
/commit0
/zero
.history/
tmp
.vscode
example/
test-reports/
.circleci/config-compiled.yml
.circleci/config-compiled.yml
8 changes: 4 additions & 4 deletions Dockerfile
Expand Up @@ -22,15 +22,15 @@ RUN chmod +x /usr/local/bin/* && \

# Hydrate the dependency cache. This way, if the go.mod or go.sum files do not
# change we can cache the depdency layer without having to reinstall them.
WORKDIR /tmp/commit0
WORKDIR /tmp/zero
COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN make build && \
mv commit0 /usr/local/bin && \
upx --lzma /usr/local/bin/commit0
mv zero /usr/local/bin && \
upx --lzma /usr/local/bin/zero

FROM alpine:3.10
ENV \
Expand All @@ -45,4 +45,4 @@ COPY --from=builder /usr/local/bin /usr/local/bin
COPY --from=builder /go/src/github.com/grpc-ecosystem/grpc-gateway ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway
WORKDIR /project

ENTRYPOINT ["/usr/local/bin/commit0"]
ENTRYPOINT ["/usr/local/bin/zero"]
18 changes: 9 additions & 9 deletions Makefile
@@ -1,6 +1,6 @@
VERSION = 0.0.1
BUILD ?=$(shell git rev-parse --short HEAD)
PKG ?=github.com/commitdev/commit0
PKG ?=github.com/commitdev/zero
BUILD_ARGS=-v -ldflags=all="-X ${PKG}/cmd.appVersion=${VERSION} -X ${PKG}/cmd.appBuild=${BUILD}"

check:
Expand All @@ -10,24 +10,24 @@ fmt:
go fmt ./...

build-docker-local:
docker build . -t commit0:v0
docker build . -t zero:v0

build-example-docker: clean-example
mkdir -p example
docker run -v "$(shell pwd)/example:/project" --user $(shell id -u):$(shell id -g) commit0:v0 create "hello-world"
docker run -v "$(shell pwd)/example/hello-world:/project" --user $(shell id -u):$(shell id -g) commit0:v0 generate -l go
docker run -v "$(shell pwd)/example:/project" --user $(shell id -u):$(shell id -g) zero:v0 create "hello-world"
docker run -v "$(shell pwd)/example/hello-world:/project" --user $(shell id -u):$(shell id -g) zero:v0 generate -l go

build:
go build ${BUILD_ARGS}
go build ${BUILD_ARGS}

# Installs the CLI int your GOPATH
install-go:
go build -o ${GOPATH}/bin/commit0
go build -o ${GOPATH}/bin/zero

# CI Commands used on CircleCI
ci-docker-build:
docker build . -t commitdev/commit0:${VERSION_TAG} -t commitdev/commit0:latest
docker build . -t commitdev/zero:${VERSION_TAG} -t commitdev/zero:latest

ci-docker-push:
echo "${DOCKERHUB_PASS}" | docker login -u commitdev --password-stdin
docker push commitdev/commit0:${VERSION_TAG}
docker push commitdev/zero:${VERSION_TAG}
38 changes: 19 additions & 19 deletions OLD-README.md
Expand Up @@ -13,30 +13,30 @@ Status: Proof of Concept
## About Commit0
Commit0 is a project skaffolding framework and ecosystem created to:

1. Maximize knowledge sharing across an organization
1. Maximize knowledge sharing across an organization
2. Easily maintain a state of the art and easily reusable implementations of production grade solutions to recurring problems
3. Re-create the seamless deployment experience offered by PaaS solutions but with a fully open source stack that follows industry best practices

With Commit0:
- Easily deploy and integrate various boilerplate solutions
- Instantly integrate commonly used open source microservices for authentication, user management, file encryption, image resizing etc.
- Instantly integrate commonly used open source microservices for authentication, user management, file encryption, image resizing etc.
- Get a simple Push-To-Deploy workflow that you are accustomed to with popular PaaS solutions [TODO]
- There's no vendor lock-in. It's all implemented with open source tools and deployed to your own cloud provider.

## Commit0 Generator CLI
Commit0 CLI is an opinionated, yet fully modular code generation tool with declarative syntax that allows developers to easily integrate user prompts and interactions.
## Commit0 Generator CLI
Commit0 CLI is an opinionated, yet fully modular code generation tool with declarative syntax that allows developers to easily integrate user prompts and interactions.

Problems we encountered:
Problems we encountered:
- It was tedious to create reusable templates and hard to maintain
- Lack of standardization and integration interface between the templates
- Difficult to integrate individually templated codebases

How we aim to address those issues:
How we aim to address those issues:
- Make templating behaviour simple and declarative
- Clear strategy and guideline around what are clear and reusable templates
- Standardize how templated code should get dependent parameters and start up

This is inspired by:
This is inspired by:
- [Yeoman Generator](https://github.com/yeoman/generator)
- [JHipster](https://github.com/jhipster/generator-jhipster)
- [Boilr](https://github.com/tmrts/boilr)
Expand Down Expand Up @@ -83,18 +83,18 @@ This is a guide on how to configure your project manually with a single file `co
* [output](#template-output)

## Commit0.yaml<a name="commit0-yaml"></a>
Your project config file. It describes the project
Your project config file. It describes the project
Example:
```
name: newProject
context:
context:
cognitoPoolID: xxx
modules:
- source: "github.com/commitdev/commit0-aws-eks-stack"
modules:
- source: "github.com/commitdev/commit0-aws-eks-stack"
output: "infrastructure"
- source: "github.com/zthomas/react-mui-kit"
- source: "github.com/zthomas/react-mui-kit"
output: "web-app"
```
```

## Name<a name="name"></a>
Name of your project. This will be used to name the github repos as well as in other parts of the generated code.
Expand All @@ -105,7 +105,7 @@ Required | True
Type | String

## Context<a name="context"></a>
A key value map of global context parameters to use in the templates.
A key value map of global context parameters to use in the templates.

[]() | |
--- | ---
Expand Down Expand Up @@ -159,13 +159,13 @@ The module config file. You can configure how the templating engine should proce
Example:
```
name: react-mui-kit
template:
template:
extension: '.tmplt'
delimiters:
delimiters:
- '<%'
- '%>'
output: web-app
```
```

## Name<a name="module-name"></a>
Name of your module. This will be used as the default module directory as well as a display name in the prompts.
Expand Down Expand Up @@ -207,7 +207,7 @@ Required | False
Type | Map[String]

## Output<a name="template-output"></a>
The default template output directory that you want the template engine to write to. This will be overwritten by the
The default template output directory that you want the template engine to write to. This will be overwritten by the

[]() | |
--- | ---
Expand Down Expand Up @@ -268,7 +268,7 @@ cd test-app

To run a single test for development
```
go test -run TestGenerateModules "github.com/commitdev/commit0/internal/generate" -v
go test -run TestGenerateModules "github.com/commitdev/zero/internal/generate" -v
```

### Building locally
Expand Down
6 changes: 3 additions & 3 deletions cmd/create.go
@@ -1,9 +1,9 @@
package cmd

import (
"github.com/commitdev/commit0/internal/config"
"github.com/commitdev/commit0/internal/context"
"github.com/commitdev/commit0/pkg/util/exit"
"github.com/commitdev/zero/internal/config"
"github.com/commitdev/zero/internal/context"
"github.com/commitdev/zero/pkg/util/exit"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/create_test.go
Expand Up @@ -25,6 +25,6 @@ func TestCreateWorks(t *testing.T) {
// }

// if st.Size() == 0 {
// t.Fatalf("commit0.yml is empty")
// t.Fatalf("zero.yml is empty")
// }
}
6 changes: 3 additions & 3 deletions cmd/generate.go
@@ -1,9 +1,9 @@
package cmd

import (
"github.com/commitdev/commit0/configs"
"github.com/commitdev/commit0/internal/config"
"github.com/commitdev/commit0/internal/generate"
"github.com/commitdev/zero/configs"
"github.com/commitdev/zero/internal/config"
"github.com/commitdev/zero/internal/generate"
"github.com/spf13/cobra"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Expand Up @@ -17,7 +17,7 @@ func init() {

var versionCmd = &cobra.Command{
Use: "version",
Short: "Print the version number of commit0",
Short: "Print the version number of zero",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("version: %v\n", appVersion)
fmt.Printf("build: %v\n", appBuild)
Expand Down
4 changes: 2 additions & 2 deletions cmd/commit0.go → cmd/zero.go
Expand Up @@ -8,8 +8,8 @@ import (
)

var rootCmd = &cobra.Command{
Use: "commit0",
Short: "Commit0 is a modular service generator.",
Use: "zero",
Short: "zero gets you to writing code quicker.",
Long: `TODO`,
Run: func(cmd *cobra.Command, args []string) {
},
Expand Down
8 changes: 4 additions & 4 deletions cmd/commit0_ui.go → cmd/zero_ui.go
@@ -1,17 +1,17 @@
package cmd

import (
"github.com/commitdev/commit0/internal/api"
"github.com/commitdev/zero/internal/api"
"github.com/spf13/cobra"
)

func init() {
rootCmd.AddCommand(commit0api)
rootCmd.AddCommand(zeroApi)
}

var commit0api = &cobra.Command{
var zeroApi = &cobra.Command{
Use: "ui",
Short: "Run Commit0 Api",
Short: "Run zero Api",
Run: func(cmd *cobra.Command, args []string) {
api.Commit0Api()
},
Expand Down
4 changes: 2 additions & 2 deletions configs/configs.go
Expand Up @@ -2,7 +2,7 @@ package configs

const (
TemplatesDir = "tmp/templates"
CommitYml = "commit0.yml"
IgnoredPaths = "(?i)commit0.module.yml|.git/"
CommitYml = "zero.yml"
IgnoredPaths = "(?i)zero.module.yml|.git/"
TemplateExtn = ".tmpl"
)
14 changes: 2 additions & 12 deletions go.mod
@@ -1,28 +1,18 @@
module github.com/commitdev/commit0
module github.com/commitdev/zero

go 1.12

require (
github.com/aws/aws-sdk-go v1.25.33
github.com/chzyer/logex v1.1.10 // indirect
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 // indirect
github.com/commitdev/commit0 v0.0.0-20200515235753-f146c26933bd
github.com/google/uuid v1.1.1
github.com/gorilla/handlers v1.4.2
github.com/gorilla/mux v1.7.3
github.com/hashicorp/go-getter v1.4.0
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a // indirect
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/k0kubun/pp v3.0.1+incompatible
github.com/kr/pretty v0.1.0 // indirect
github.com/kyokomi/emoji v2.1.0+incompatible
github.com/logrusorgru/aurora v0.0.0-20191017060258-dc85c304c434
github.com/lunixbochs/vtclean v1.0.0 // indirect
github.com/manifoldco/promptui v0.3.0
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.4.0 // indirect
golang.org/x/sys v0.0.0-20191010194322-b09406accb47 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/yaml.v2 v2.2.5
)
2 changes: 2 additions & 0 deletions go.sum
Expand Up @@ -24,6 +24,8 @@ github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5P
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/commitdev/commit0 v0.0.0-20200515235753-f146c26933bd h1:yx1qTGWxpwl31GbF95fwHZQj6VdJYq4sqt1BZXOsZvE=
github.com/commitdev/commit0 v0.0.0-20200515235753-f146c26933bd/go.mod h1:9Z/JXBx0sPP8DQxWThSpiazpzT/NFd2KIv2B7F4Cq7g=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
Expand Down
4 changes: 2 additions & 2 deletions internal/api/README.md
@@ -1,8 +1,8 @@
# Commit0 Api
# zero Api

## Usage
- To run:
`commit0 api`
`zero api`
- Endpoint:
- POST `localhost:8080/{version}/generate`
- Post request body json example:
Expand Down
2 changes: 1 addition & 1 deletion internal/api/generate_api.go
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"net/http"

"github.com/commitdev/commit0/internal/config"
"github.com/commitdev/zero/internal/config"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
)
Expand Down
10 changes: 5 additions & 5 deletions internal/config/create_example.go
Expand Up @@ -5,13 +5,13 @@ import (
"io/ioutil"
"path"

"github.com/commitdev/commit0/pkg/util/exit"
"github.com/commitdev/zero/pkg/util/exit"
)

const exampleConfig = `name: %s
# Context is normally populated automatically but could be used to inject global params
context:
context:
# module can be in any format the go-getter supports (path, github, url, etc.)
# supports https://github.com/hashicorp/go-getter#url-format
Expand All @@ -20,13 +20,13 @@ context:
# - output: "github-actions"
modules:
- source: "github.com/commitdev/commit0-aws-eks-stack"`
- source: "github.com/commitdev/zero-aws-eks-stack"`

func CreateExample(projectName string) {
content := []byte(fmt.Sprintf(exampleConfig, projectName))

err := ioutil.WriteFile(path.Join(projectName, "commit0.yml"), content, 0644)
err := ioutil.WriteFile(path.Join(projectName, "zero.yml"), content, 0644)
if err != nil {
exit.Fatal("Failed to create example commit.yml")
exit.Fatal("Failed to create example zero.yml")
}
}
8 changes: 4 additions & 4 deletions internal/context/create.go
Expand Up @@ -10,10 +10,10 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sts"
"github.com/commitdev/commit0/internal/config"
project "github.com/commitdev/commit0/pkg/credentials"
"github.com/commitdev/commit0/pkg/util/exit"
"github.com/commitdev/commit0/pkg/util/flog"
"github.com/commitdev/zero/internal/config"
project "github.com/commitdev/zero/pkg/credentials"
"github.com/commitdev/zero/pkg/util/exit"
"github.com/commitdev/zero/pkg/util/flog"
"github.com/manifoldco/promptui"
)

Expand Down
10 changes: 5 additions & 5 deletions internal/generate/generate_infrastructure.go
Expand Up @@ -5,11 +5,11 @@ import (
"os/exec"
"path/filepath"

"github.com/commitdev/commit0/internal/config"
"github.com/commitdev/commit0/internal/util"
"github.com/commitdev/commit0/pkg/credentials"
project "github.com/commitdev/commit0/pkg/credentials"
"github.com/commitdev/commit0/pkg/util/flog"
"github.com/commitdev/zero/internal/config"
"github.com/commitdev/zero/internal/util"
"github.com/commitdev/zero/pkg/credentials"
project "github.com/commitdev/zero/pkg/credentials"
"github.com/commitdev/zero/pkg/util/flog"
)

// @TODO: These are specific to a k8s version. If we make the version a config option we will need to change this
Expand Down

0 comments on commit be28f27

Please sign in to comment.