Skip to content

Commit 74729d9

Browse files
authored
Merge pull request #33 from leapfrogtechnology/dev
Merge to master
2 parents a7429ee + dad63b2 commit 74729d9

File tree

5 files changed

+41
-26
lines changed

5 files changed

+41
-26
lines changed

core/structs/structs.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ package structs
22

33
// Env defines the structure for a single environment
44
type Env struct {
5-
Bucket string `json:"bucket"`
6-
Cluster string `json:"cluster"`
7-
BuildCommand string `json:"buildCommand"`
5+
Bucket string `json:"bucket,omitempty"`
6+
Cluster string `json:"cluster,omitempty"`
7+
BuildCommand string `json:"buildCommand,omitempty"`
88
}
99

1010
// Project defines the overall structure for a project deployment.
1111
type Project struct {
12-
Name string `json:"name"`
13-
Platform string `json:"platform"`
14-
Profile string `json:"profile"`
15-
Region string `json:"region"`
16-
Type string `json:"type"`
17-
DistDir string `json:"distDir"`
18-
SlackURL string `json:"slackURL"`
19-
Port string `json:"port"`
20-
DockerFilePath string `json:"dockerFilePath"`
21-
HealthCheckPath string `json:"healthCheckPath"`
12+
Name string `json:"name,omitempty"`
13+
Platform string `json:"platform,omitempty"`
14+
Profile string `json:"profile,omitempty"`
15+
Region string `json:"region,omitempty"`
16+
Type string `json:"type,omitempty"`
17+
DistDir string `json:"distDir,omitempty"`
18+
SlackURL string `json:"slackURL,omitempty"`
19+
Port string `json:"port,omitempty"`
20+
DockerFilePath string `json:"dockerFilePath,omitempty"`
21+
HealthCheckPath string `json:"healthCheckPath,omitempty"`
2222
Env map[string]Env `json:"env"`
2323
}
2424

deployment/services/platforms/aws/s3/s3.go

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
package s3
22

33
import (
4+
"fmt"
45
"os"
56
"path/filepath"
7+
"strconv"
68
"strings"
79

810
"github.com/aws/aws-sdk-go/aws"
911
"github.com/aws/aws-sdk-go/service/s3/s3manager"
1012
awsService "github.com/leapfrogtechnology/shift/core/services/platforms/aws"
1113
fileUtil "github.com/leapfrogtechnology/shift/core/utils/file"
12-
"github.com/leapfrogtechnology/shift/core/utils/logger"
13-
"github.com/leapfrogtechnology/shift/core/utils/spinner"
14+
15+
"github.com/schollz/progressbar/v2"
1416
)
1517

1618
// Data contains the data needed to deploy to S3 bucket
@@ -43,17 +45,23 @@ func Deploy(data Data) error {
4345
return nil
4446
})
4547

46-
spinner.Start("Uploading")
48+
bar := progressbar.NewOptions(len(fileList),
49+
progressbar.OptionEnableColorCodes(true),
50+
progressbar.OptionSetWidth(30),
51+
progressbar.OptionShowIts(),
52+
progressbar.OptionSetTheme(progressbar.Theme{
53+
Saucer: "[green]▌▌[reset]",
54+
SaucerPadding: "[green]░[reset]",
55+
BarStart: "╢",
56+
BarEnd: "╟",
57+
}))
4758

4859
for _, file := range fileList {
4960
f, _ := os.Open(file)
5061

51-
logger.Log("Uploading: " + file)
52-
5362
key := strings.TrimPrefix(file, data.DistDir)
5463
contentType := fileUtil.GetFileContentType(file)
5564

56-
// Upload the file to S3.
5765
_, err := uploader.Upload(&s3manager.UploadInput{
5866
Bucket: aws.String(data.Bucket),
5967
Key: aws.String(key),
@@ -64,13 +72,11 @@ func Deploy(data Data) error {
6472
if err != nil {
6573
return err
6674
}
67-
68-
logger.Success("Success")
75+
bar.Describe("Uploading... " + file)
76+
bar.Add(1)
6977
}
7078

71-
logger.Info("🎉 🎉 🎉 Files Uploaded Successfully. 🎉 🎉 🎉")
72-
73-
spinner.Stop()
79+
fmt.Println("\n\n" + strconv.Itoa(len(fileList)) + " Files Uploaded Successfully. 🎉 🎉 🎉")
7480

7581
return nil
7682
}

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/flosch/pongo2 v0.0.0-20190707114632-bbf5a6c351f4
1010
github.com/go-resty/resty/v2 v2.0.0
1111
github.com/logrusorgru/aurora v0.0.0-20190803045625-94edacc10f9b
12+
github.com/schollz/progressbar/v2 v2.14.0
1213
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271
1314
github.com/urfave/cli v1.22.1
1415
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect

go.sum

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ github.com/briandowns/spinner v1.6.1 h1:LBxHu5WLyVuVEtTD72xegiC7QJGx598LBpo3ywKT
99
github.com/briandowns/spinner v1.6.1/go.mod h1://Zf9tMcxfRUA36V23M6YGEAv+kECGfvpnLTnb8n4XQ=
1010
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
1111
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
12+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1213
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
1314
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1415
github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
@@ -48,15 +49,22 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
4849
github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw=
4950
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
5051
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
52+
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db h1:62I3jR2EmQ4l5rM/4FEfDWcRD+abF5XlKShorW5LRoQ=
53+
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw=
5154
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
5255
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5356
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
5457
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
58+
github.com/schollz/progressbar v1.0.0 h1:gbyFReLHDkZo8mxy/dLWMr+Mpb1MokGJ1FqCiqacjZM=
59+
github.com/schollz/progressbar/v2 v2.14.0 h1:vo7bdkI9E4/CIk9DnL5uVIaybLQiVtiCC2vO+u9j5IM=
60+
github.com/schollz/progressbar/v2 v2.14.0/go.mod h1:6YZjqdthH6SCZKv2rqGryrxPtfmRB/DWZxSMfCXPyD8=
5561
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
5662
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
5763
github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
64+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
5865
github.com/stretchr/testify v1.2.1 h1:52QO5WkIUcHGIR7EnGagH88x1bUzqGXTC5/1bDTUQ7U=
5966
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
67+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
6068
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
6169
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
6270
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

infrastructure/internals/terraform/terraform.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func getTerraformOutput(workspaceDir string) (string, error) {
6565
cmd.Dir = workspaceDir
6666
var stdout bytes.Buffer
6767
var stderr bytes.Buffer
68-
cmd.Stdout = os.Stdout
69-
cmd.Stderr = os.Stderr
68+
cmd.Stdout = &stdout
69+
cmd.Stderr = &stderr
7070
err := cmd.Run()
7171

7272
if err != nil {

0 commit comments

Comments
 (0)