-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c694652
commit a0a908f
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/deislabs/porter/pkg/porter" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func buildBundleCommands(p *porter.Porter) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "bundle", | ||
Short: "bundle commands", | ||
} | ||
|
||
cmd.AddCommand(buildBundleInstallCommand(p)) | ||
|
||
return cmd | ||
} | ||
|
||
func buildBundleInstallCommand(p *porter.Porter) *cobra.Command { | ||
opts := porter.InstallOptions{} | ||
cmd := &cobra.Command{ | ||
Use: "install", | ||
Short: "Install a bundle", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return p.InstallBundle(opts) | ||
}, | ||
} | ||
|
||
cmd.Flags().BoolVar(&opts.Insecure, "insecure", false, "Allow installing unsigned bundles, or bundles signed by untrusted publishers") | ||
return cmd | ||
} | ||
|
||
func buildInstallCommand(p *porter.Porter) *cobra.Command { | ||
return buildBundleInstallCommand(p) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCommandWiring(t *testing.T) { | ||
testcases := []string{ | ||
"build", | ||
"create", | ||
"install", | ||
"run", | ||
"schema", | ||
"bundle install", | ||
"list mixins", | ||
"version", | ||
} | ||
|
||
for _, tc := range testcases { | ||
t.Run(tc, func(t *testing.T) { | ||
osargs := strings.Split(tc, " ") | ||
|
||
rootCmd := buildRootCommand() | ||
_, _, err := rootCmd.Find(osargs) | ||
assert.NoError(t, err) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package porter | ||
|
||
import "fmt" | ||
|
||
type InstallOptions struct { | ||
Insecure bool | ||
} | ||
|
||
func (p *Porter) InstallBundle(opts InstallOptions) error { | ||
err := p.Config.LoadManifest() | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Fprintf(p.Out, "installing %s...\n", p.Manifest.Name) | ||
return nil | ||
} |