Skip to content

Commit

Permalink
Rename to internals
Browse files Browse the repository at this point in the history
  • Loading branch information
pratishshr committed Oct 16, 2019
1 parent 743b9bf commit d360ce5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 63 deletions.
10 changes: 0 additions & 10 deletions cli/cmd/cmd.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"fmt"
"os"

"github.com/urfave/cli"
Expand All @@ -23,15 +22,6 @@ func Initialize(info *Info) error {
app.Usage = info.Description

app.Commands = []cli.Command{
{
Name: "infrastructure",
Description: "Initialize",
Aliases: nil,
Usage: "Initialize your Application",
Action: func(c *cli.Context) {
fmt.Println("Shift Shift shift")
},
},
cli.Command{
Name: "setup",
Action: func(ctx *cli.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/setup.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/leapfrogtechnology/shift/cli/internal/setup"
"github.com/leapfrogtechnology/shift/cli/internals/setup"
)

// Setup prompts user for required information for creating a project.
Expand Down
File renamed without changes.
77 changes: 25 additions & 52 deletions cli/internal/setup/setup.go → cli/internals/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ import (
"os"

"github.com/AlecAivazis/survey/v2"
"github.com/leapfrogtechnology/shift/cli/internal/config"
"github.com/leapfrogtechnology/shift/cli/internals/config"
"github.com/leapfrogtechnology/shift/core/structs"
)

type projectDetails struct {
ProjectName string
}

type deploymentDetails struct {
DeploymentName string
CloudProvider string
Profile string
Region string
DeploymentType string
Environment string
}

type frontendBuildInformation struct {
BuildCommand string
DistFolder string
DistFolder string
}

type backendBuildInformation struct {
Expand All @@ -33,26 +33,6 @@ type backendBuildInformation struct {
DockerfilePath string
}

type deployment struct {
Name string `json:"name"`
Platform string `json:"platform"`
Profile string `json:"profile"`
Region string `json:"region"`
Type string `json:"type"`
BuildCommand string `json:"buildCommand"`
DistFolder string `json:"distFolder"`
Port string `json:"port"`
HealthCheckPath string `json:"healthCheckPath"`
SlackURL string `json:"slackURL"`
DockerFilePath string `json:"dockerFilePath"`
}

// Project defines the overall structure for a project deployment.
type Project struct {
ProjectName string `json:"projectName"`
Deployment deployment `json:"deployment"`
}

func askProjectDetails() *projectDetails {
questions := []*survey.Question{
{
Expand All @@ -75,12 +55,6 @@ func askProjectDetails() *projectDetails {

func askDeploymentDetails() *deploymentDetails {
questions := []*survey.Question{
{
Name: "deploymentName",
Prompt: &survey.Input{
Message: "Deployment Name:",
},
},
{
Name: "cloudProvider",
Prompt: &survey.Select{
Expand All @@ -105,10 +79,16 @@ func askDeploymentDetails() *deploymentDetails {
{
Name: "deploymentType",
Prompt: &survey.Select{
Message: "Choose Deployment Type:",
Message: "Choose Deployment Type: ",
Options: []string{"Frontend", "Backend"},
},
},
{
Name: "environment",
Prompt: &survey.Input{
Message: "Environment name: ",
},
},
}

answers := &deploymentDetails{}
Expand All @@ -124,16 +104,10 @@ func askDeploymentDetails() *deploymentDetails {

func askFrontendBuildInformation() *frontendBuildInformation {
questions := []*survey.Question{
{
Name: "buildCommand",
Prompt: &survey.Input{
Message: "Build Command: ",
},
},
{
Name: "distFolder",
Prompt: &survey.Input{
Message: "Distribution Folder: ",
Message: "Build Directory: ",
},
},
}
Expand Down Expand Up @@ -208,20 +182,19 @@ func Run() {

slackEndpoint := askSlackEndpoint()

projectRequest := Project{
ProjectName: projectDetails.ProjectName,
Deployment: deployment{
Name: deploymentDetails.DeploymentName,
Platform: deploymentDetails.CloudProvider,
Profile: deploymentDetails.Profile,
Region: deploymentDetails.Region,
Type: deploymentDetails.DeploymentType,
BuildCommand: frontendBuildInformation.BuildCommand,
DistFolder: frontendBuildInformation.DistFolder,
Port: backendBuildInformation.Port,
HealthCheckPath: backendBuildInformation.HealthCheckPath,
SlackURL: slackEndpoint,
DockerFilePath: backendBuildInformation.DockerfilePath,
projectRequest := structs.Project{
Name: projectDetails.ProjectName,
Platform: deploymentDetails.CloudProvider,
Profile: deploymentDetails.Profile,
Region: deploymentDetails.Region,
Type: deploymentDetails.DeploymentType,
DistDir: frontendBuildInformation.DistFolder,
Port: backendBuildInformation.Port,
HealthCheckPath: backendBuildInformation.HealthCheckPath,
SlackURL: slackEndpoint,
DockerFilePath: backendBuildInformation.DockerfilePath,
Env: map[string]structs.Env{
deploymentDetails.Environment: structs.Env{},
},
}

Expand Down

0 comments on commit d360ce5

Please sign in to comment.