Skip to content

Commit

Permalink
Cache dependencies between builds
Browse files Browse the repository at this point in the history
  • Loading branch information
coufalja committed Mar 16, 2018
1 parent 66f9576 commit e880a2c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ matrix:
# tests pass on the stable versions of Go.
fast_finish: true

cache:
directories:
- $GOPATH/pkg
- $GOPATH/bin

env:
- DEP_VERSION="0.4.1"

Expand Down
5 changes: 3 additions & 2 deletions config/cmd/decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ var decryptCmd = &cobra.Command{
Use: "decrypt",
Short: "Decrypt the value server-side and prints the response",
RunE: func(cmd *cobra.Command, args []string) error {
return executeDecrypt(args)
return ExecuteDecrypt(args)
},
}

func executeDecrypt(args []string) error {
//ExecuteDecrypt runs decrypt cmd
func ExecuteDecrypt(args []string) error {
if dp.value == "" {
bytes, err := ioutil.ReadAll(os.Stdin)

Expand Down
4 changes: 2 additions & 2 deletions config/cmd/decrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestExecuteDecrypt(t *testing.T) {

dp.source = ts.URL
dp.value = tp.testContent
err := executeDecrypt(nil)
err := ExecuteDecrypt(nil)

if err != nil {
t.Error("Decrypt failed with: ", err)
Expand All @@ -55,6 +55,6 @@ func ExampleExecuteDecrypt() {

dp.source = ts.URL
dp.value = tp.testContent
executeDecrypt(nil)
ExecuteDecrypt(nil)
//Output: test
}
5 changes: 3 additions & 2 deletions config/cmd/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ var encryptCmd = &cobra.Command{
Use: "encrypt",
Short: "Encrypt the value server-side and prints the response",
RunE: func(cmd *cobra.Command, args []string) error {
return executeEncrypt(args)
return ExecuteEncrypt(args)
},
}

func executeEncrypt(args []string) error {
//ExecuteEncrypt runs encrypt cmd
func ExecuteEncrypt(args []string) error {
if ep.value == "" {
bytes, err := ioutil.ReadAll(os.Stdin)

Expand Down
4 changes: 2 additions & 2 deletions config/cmd/encrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestExecuteEncrypt(t *testing.T) {

ep.source = ts.URL
ep.value = tp.testContent
err := executeEncrypt(nil)
err := ExecuteEncrypt(nil)

if err != nil {
t.Error("Encrypt failed with: ", err)
Expand All @@ -55,6 +55,6 @@ func ExampleExecuteEncrypt() {

ep.source = ts.URL
ep.value = tp.testContent
executeEncrypt(nil)
ExecuteEncrypt(nil)
//Output: test
}
10 changes: 6 additions & 4 deletions config/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,20 @@ var getValuesCmd = &cobra.Command{
Use: "values",
Short: "Get the config values in specified format from the given config server",
RunE: func(cmd *cobra.Command, args []string) error {
return executeGetValues(args)
return ExecuteGetValues(args)
},
}

var getFilesCmd = &cobra.Command{
Use: "files",
Short: "Get the config files from the given config server",
RunE: func(cmd *cobra.Command, args []string) error {
return executeGetFiles(args)
return ExecuteGetFiles(args)
},
}

func executeGetValues(args []string) error {
//ExecuteGetValues runs get values cmd
func ExecuteGetValues(args []string) error {
ext, err := client.ParseExtension(gp.format)

if err != nil {
Expand Down Expand Up @@ -73,7 +74,8 @@ func executeGetValues(args []string) error {
return nil
}

func executeGetFiles(args []string) error {
//ExecuteGetFiles runs get files cmd
func ExecuteGetFiles(args []string) error {
for _, mapping := range gp.fileMappings.Mappings() {
resp, err := client.
NewClient(client.Config{URI: gp.source, Profile: gp.profile, Application: gp.application, Label: gp.label}).
Expand Down
6 changes: 3 additions & 3 deletions config/cmd/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func TestNoArgExecute(t *testing.T) {
err := executeGetFiles(nil)
err := ExecuteGetFiles(nil)
if err != nil {
t.Error("Execute failed with: ", err)
}
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestExecuteGetFiles(t *testing.T) {
gp.fileMappings = FileMappings{mappings: make([]FileMapping, 1)}
gp.fileMappings.mappings[0] = FileMapping{source: tp.srcFileName, destination: tp.destFileName}

if err := executeGetFiles(nil); err != nil {
if err := ExecuteGetFiles(nil); err != nil {
t.Error("Execute failed with: ", err)
}

Expand Down Expand Up @@ -131,7 +131,7 @@ func TestExecuteGetValues(t *testing.T) {
gp.source = ts.URL
gp.destination = tp.destFileName

if err := executeGetValues(nil); err != nil {
if err := ExecuteGetValues(nil); err != nil {
t.Error("Execute failed with: ", err)
}

Expand Down

0 comments on commit e880a2c

Please sign in to comment.