Skip to content

Commit

Permalink
move gitignore to turbine and simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
janelletavares committed Mar 7, 2022
1 parent 6719b87 commit 8dd4ab9
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 45 deletions.
37 changes: 0 additions & 37 deletions cmd/meroxa/root/apps/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"os"
"os/exec"

"github.com/meroxa/cli/cmd/meroxa/builder"
Expand Down Expand Up @@ -65,7 +64,6 @@ func (i *Init) ParseArgs(args []string) error {
}

func (i *Init) GitInit(ctx context.Context, path string) error {
// should this be in turbine?
if path == "" {
return errors.New("path is required")
}
Expand All @@ -77,41 +75,6 @@ func (i *Init) GitInit(ctx context.Context, path string) error {
return err
}

pwd, err := os.Getwd()
if err != nil {
return err
}
err = os.Chdir(path)
if err != nil {
return err
}

filesToIgnore := []byte("") // @todo populate with files to ignore
err = os.WriteFile(".gitignore", filesToIgnore, 0664) // nolint
if err != nil {
return err
}

// thoughts?
cmd = exec.Command("git", "add", ".gitignore", "*")
output, err = cmd.CombinedOutput()
if err != nil {
i.logger.Error(ctx, string(output))
return err
}

cmd = exec.Command("git", "commit", "-am", "Meroxa Data Application skeleton only")
output, err = cmd.CombinedOutput()
if err != nil {
i.logger.Error(ctx, string(output))
return err
}

err = os.Chdir(pwd)
if err != nil {
return err
}

return nil
}

Expand Down
9 changes: 4 additions & 5 deletions cmd/meroxa/root/apps/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"strings"
"testing"

"github.com/meroxa/cli/cmd/meroxa/global"

"github.com/google/uuid"

"github.com/meroxa/cli/cmd/meroxa/builder"
"github.com/meroxa/cli/log"
"github.com/meroxa/cli/utils"
)

Expand Down Expand Up @@ -89,9 +89,7 @@ func TestGitInit(t *testing.T) {

for _, tt := range tests {
cc := &Init{}
cc.Logger(global.NewLogger())

circleCiGitWorkaround(t)
cc.Logger(log.NewTestLogger())

err := cc.GitInit(context.Background(), tt.path)
if err != nil {
Expand All @@ -112,6 +110,7 @@ func TestGitInit(t *testing.T) {
os.RemoveAll(testDir)
}

// nolint:deadcode,unused
func circleCiGitWorkaround(t *testing.T) {
cmd := exec.Command("git", "config", "--list")
output, err := cmd.CombinedOutput()
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ require (
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

replace github.com/meroxa/turbine => ../turbine
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,6 @@ github.com/meroxa/funtime v0.0.0-20220113012133-85e6e898fc73/go.mod h1:K2y2GvcA4
github.com/meroxa/meroxa-go v0.0.0-20220208195203-71ddc3133fab/go.mod h1:HDFszURCM1cOpKE699o5Hs0T2tEIXqY+vFcsur3RiwY=
github.com/meroxa/meroxa-go v0.0.0-20220304141736-3e708e76b666 h1:FWwzyreRc5RXbOTVjcNNfiBwNYaqTOqfppmyNGefVDA=
github.com/meroxa/meroxa-go v0.0.0-20220304141736-3e708e76b666/go.mod h1:BsqYa9jqfyGOAgfkggfK567b2Ahkb+RCH3lXDQGgrh8=
github.com/meroxa/turbine v0.0.0-20220301211444-5662995ad65f h1:fWCA+cO4aPIzePOuz4drdOQAgUTM6UG7lRYgtbWLHv0=
github.com/meroxa/turbine v0.0.0-20220301211444-5662995ad65f/go.mod h1:4A2E9icHDi3x4Flp9CunWyRBvNkZy6h8MS8zLvWUlmw=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs=
github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4=
Expand Down
1 change: 1 addition & 0 deletions vendor/github.com/meroxa/turbine/init/template/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ github.com/mattn/go-shellwords
## explicit; go 1.17
github.com/meroxa/meroxa-go/pkg/meroxa
github.com/meroxa/meroxa-go/pkg/mock
# github.com/meroxa/turbine v0.0.0-20220301211444-5662995ad65f
# github.com/meroxa/turbine v0.0.0-20220301211444-5662995ad65f => ../turbine
## explicit; go 1.17
github.com/meroxa/turbine/deploy
github.com/meroxa/turbine/init
Expand Down Expand Up @@ -361,3 +361,4 @@ gopkg.in/ini.v1
# gopkg.in/yaml.v2 v2.4.0
## explicit; go 1.15
gopkg.in/yaml.v2
# github.com/meroxa/turbine => ../turbine

0 comments on commit 8dd4ab9

Please sign in to comment.