Skip to content

Commit

Permalink
Init a python app using apps init
Browse files Browse the repository at this point in the history
  • Loading branch information
ericcheatham committed Mar 28, 2022
1 parent b4c92f5 commit 879c793
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/meroxa/root/apps/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ import (
type Apps struct{}

const (
Python = "python"
JavaScript = "javascript"
GoLang = "golang"
NodeJs = "nodejs"
LanguageNotSupportedError = "Currently, we support \"javascript\" and \"golang\""
LanguageNotSupportedError = "Currently, we support \"javascript\", \"golang\", and \"python\""
)

var (
Expand Down
11 changes: 9 additions & 2 deletions cmd/meroxa/root/apps/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ import (
"fmt"
"os/exec"

turbinejs "github.com/meroxa/cli/cmd/meroxa/turbine_cli/javascript"

"github.com/meroxa/cli/cmd/meroxa/builder"
turbineCLI "github.com/meroxa/cli/cmd/meroxa/turbine_cli"
turbinejs "github.com/meroxa/cli/cmd/meroxa/turbine_cli/javascript"
"github.com/meroxa/cli/log"
turbine "github.com/meroxa/turbine/init"
)
Expand Down Expand Up @@ -96,6 +95,14 @@ func (i *Init) Execute(ctx context.Context) error {
err = turbine.Init(name, i.path)
case "js", JavaScript, NodeJs:
err = turbinejs.Init(ctx, i.logger, name, i.path)
case "py", Python:
cmd := exec.Command("turbine", "--generate", name, i.path)
stdout, err := cmd.CombinedOutput()
if err != nil {
i.logger.Error(ctx, string(stdout))
return err
}
i.logger.Info(ctx, string(stdout))
default:
return fmt.Errorf("language %q not supported. %s", lang, LanguageNotSupportedError)
}
Expand Down

0 comments on commit 879c793

Please sign in to comment.