make plugin a package

so that it can be used/imported by other things
This commit is contained in:
Jacob McCann
2018-04-26 14:29:21 -05:00
parent 1fabc3427b
commit 10776ba4d8
3 changed files with 8 additions and 6 deletions
+5 -3
View File
@@ -4,6 +4,8 @@ import (
"fmt"
"os"
"github.com/ipedrazas/drone-helm/plugin"
"github.com/Sirupsen/logrus"
"github.com/joho/godotenv"
"github.com/urfave/cli"
@@ -139,8 +141,8 @@ func run(c *cli.Context) error {
if c.String("env-file") != "" {
_ = godotenv.Load(c.String("env-file"))
}
plugin := Plugin{
Config: Config{
p := plugin.Plugin{
Config: plugin.Config{
APIServer: c.String("api_server"),
Token: c.String("token"),
ServiceAccount: c.String("service-account"),
@@ -169,5 +171,5 @@ func run(c *cli.Context) error {
Force: c.Bool("force"),
},
}
return plugin.Exec()
return p.Exec()
}
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package plugin
import (
"fmt"
+2 -2
View File
@@ -1,4 +1,4 @@
package main
package plugin
import (
"fmt"
@@ -22,7 +22,7 @@ func TestInitialiseKubeconfig(t *testing.T) {
}
configfile := "config3.test"
initialiseKubeconfig(&plugin.Config, "kubeconfig", configfile)
initialiseKubeconfig(&plugin.Config, "../kubeconfig", configfile)
data, err := ioutil.ReadFile(configfile)
if err != nil {
t.Errorf("Error reading file %v", err)