From 7739c7802c14f1b5339e22c520707ea933e434c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Lafoucrie=CC=80re?= Date: Sat, 9 Jul 2016 10:08:30 -0400 Subject: [PATCH 1/3] Fix debian packages --- debian/control | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index 1c9e8b0..fcfe167 100644 --- a/debian/control +++ b/debian/control @@ -1,14 +1,14 @@ Source: gemnasium-toolbelt Section: devel Priority: extra -Maintainer: Gemnasium -Build-Depends: debhelper (>= 8.0.0) -Standards-Version: 3.9.3 +Maintainer: Gemnasium +Build-Depends: debhelper (>= 9.1.0), golang-go +Standards-Version: 3.9.4 + Homepage: https://github.com/gemnasium/toolbelt Vcs-Git: https://github.com/gemnasium/toolbelt.git Vcs-Browser: https://github.com/gemnasium/toolbelt Package: gemnasium-toolbelt Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} Description: Gemnasium toolbelt From a3a9d5d1a8ddee617202d39e947d108b0f0a6063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Lafoucrie=CC=80re?= Date: Sat, 9 Jul 2016 10:15:29 -0400 Subject: [PATCH 2/3] Code cleanup --- CHANGELOG.md | 5 +++++ commands/auth.go | 10 ++-------- commands/auto-update.go | 14 ++++---------- commands/configure.go | 14 ++++---------- commands/dependencies.go | 7 ++----- commands/dependency_alerts.go | 7 ++----- commands/dependency_files.go | 14 ++++---------- commands/live_evaluation.go | 5 +---- commands/projects.go | 31 ++++++++----------------------- main.go | 7 ++++++- 10 files changed, 38 insertions(+), 76 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8c8ac8..1389be5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +0.2.9 / 2016-07-09 + +* Fix debian packages +* Code cleaning + 0.2.8 / 2016-07-07 * Add a Dockerfile, to build `gemnasium/toolbelt` image diff --git a/commands/auth.go b/commands/auth.go index 0443588..09e99b0 100644 --- a/commands/auth.go +++ b/commands/auth.go @@ -12,10 +12,7 @@ var login = func() error { // auth.Login wrapper with a cli.Content func Login(ctx *cli.Context) error { err := login() - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } var logout = func() error { @@ -25,8 +22,5 @@ var logout = func() error { // auth.Logout wrapper with a cli.Content func Logout(ctx *cli.Context) error { err := logout() - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } diff --git a/commands/auto-update.go b/commands/auto-update.go index c6a3520..82a6701 100644 --- a/commands/auto-update.go +++ b/commands/auto-update.go @@ -19,24 +19,18 @@ func AutoUpdateRun(ctx *cli.Context) error { auth.AttemptLogin(ctx) project, err := models.GetProject(ctx.String("project")) if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } err = auRunFunc(project.Slug, ctx.Args()) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } func AutoUpdateApply(ctx *cli.Context) error { auth.AttemptLogin(ctx) project, err := models.GetProject(ctx.String("project")) if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } err = auApplyFunc(project.Slug, ctx.Args()) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } diff --git a/commands/configure.go b/commands/configure.go index f62de7f..6db4418 100644 --- a/commands/configure.go +++ b/commands/configure.go @@ -10,26 +10,20 @@ import ( var confFunc = func(project *models.Project) error { f, err := os.Create(".gemnasium.yml") if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } defer f.Close() err = project.Configure(project.Slug, os.Stdin, f) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } func Configure(ctx *cli.Context) error { slug := ctx.Args().First() project, err := models.GetProject(slug) if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } err = confFunc(project) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } diff --git a/commands/dependencies.go b/commands/dependencies.go index 61a7578..aa7023d 100644 --- a/commands/dependencies.go +++ b/commands/dependencies.go @@ -8,11 +8,8 @@ import ( func DependenciesList(ctx *cli.Context) error { project, err := models.GetProject(ctx.Args().First()) if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } err = models.ListDependencies(project) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } diff --git a/commands/dependency_alerts.go b/commands/dependency_alerts.go index e44547f..d6146ce 100644 --- a/commands/dependency_alerts.go +++ b/commands/dependency_alerts.go @@ -8,12 +8,9 @@ import ( func DependencyAlertsList(ctx *cli.Context) error { project, err := models.GetProject(ctx.Args().First()) if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } err = models.ListDependencyAlerts(project) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } diff --git a/commands/dependency_files.go b/commands/dependency_files.go index 3c72921..0f49e0e 100644 --- a/commands/dependency_files.go +++ b/commands/dependency_files.go @@ -10,19 +10,16 @@ import ( func DependencyFilesList(ctx *cli.Context) error { project, err := models.GetProject() if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } err = models.ListDependencyFiles(project) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } func DependenciesPush(ctx *cli.Context) error { project, err := models.GetProject() if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } var files []string if ctx.IsSet("files") { @@ -30,8 +27,5 @@ func DependenciesPush(ctx *cli.Context) error { files = strings.Split(ctx.String("files"), ",") } err = models.PushDependencyFiles(project.Slug, files) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } diff --git a/commands/live_evaluation.go b/commands/live_evaluation.go index f3bdf73..1c3bfb7 100644 --- a/commands/live_evaluation.go +++ b/commands/live_evaluation.go @@ -12,8 +12,5 @@ func LiveEvaluation(ctx *cli.Context) error { auth.AttemptLogin(ctx) files := strings.Split(ctx.String("files"), ",") err := liveeval.LiveEvaluation(files) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } diff --git a/commands/projects.go b/commands/projects.go index 01a80c1..dc0e9a8 100644 --- a/commands/projects.go +++ b/commands/projects.go @@ -9,29 +9,23 @@ import ( func ProjectsList(ctx *cli.Context) error { err := models.ListProjects(ctx.Bool("private")) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } func ProjectsShow(ctx *cli.Context) error { project, err := models.GetProject(ctx.Args().First()) if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } err = project.Show() - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } func ProjectsUpdate(ctx *cli.Context) error { project, err := models.GetProject(ctx.Args().First()) if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } var name, desc *string var monitored *bool @@ -48,31 +42,22 @@ func ProjectsUpdate(ctx *cli.Context) error { monitored = &mon } err = project.Update(name, desc, monitored) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } func ProjectsCreate(ctx *cli.Context) error { projectName := ctx.Args().First() // will scan from os.Stding if projectName is empty err := models.CreateProject(projectName, os.Stdin) - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } func ProjectsSync(ctx *cli.Context) error { project, err := models.GetProject(ctx.Args().First()) if err != nil { - return cli.NewExitError(err.Error(), 1) + return err } err = project.Sync() - if err != nil { - return cli.NewExitError(err.Error(), 1) - } - return nil + return err } diff --git a/main.go b/main.go index 9bcc562..2eccf43 100644 --- a/main.go +++ b/main.go @@ -4,9 +4,14 @@ import ( "os" "github.com/gemnasium/toolbelt/commands" + "github.com/wsxiaoys/terminal/color" ) func main() { app := commands.App() - app.Run(os.Args) + err := app.Run(os.Args) + if err != nil { + color.Printf("@{r!}%s", err.Error()) + os.Exit(1) + } } From 5878f6ac8247ed0bf5534b58a4169288b8b2502b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Lafoucrie=CC=80re?= Date: Sat, 9 Jul 2016 10:16:46 -0400 Subject: [PATCH 3/3] Bump version to 0.2.9 --- .goxc.json | 2 +- config/config.go | 2 +- debian/changelog | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.goxc.json b/.goxc.json index 459778f..8287277 100644 --- a/.goxc.json +++ b/.goxc.json @@ -2,5 +2,5 @@ "AppName": "gemnasium", "BuildConstraints": "linux darwin windows", "ConfigVersion": "0.9", - "PackageVersion": "0.2.8" + "PackageVersion": "0.2.9" } diff --git a/config/config.go b/config/config.go index 4544612..9b72559 100644 --- a/config/config.go +++ b/config/config.go @@ -18,7 +18,7 @@ var ( ) const ( - VERSION = "0.2.8" + VERSION = "0.2.9" CONFIG_FILE_PATH = ".gemnasium.yml" // Don't forget to update DisplayEnvVars func bellow when updating vars diff --git a/debian/changelog b/debian/changelog index ec56ac9..c760f4b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +gemnasium-toolbelt (0.2.9-1) stable; urgency=low + + * Fix debian packages + * Code cleaning + +gemnasium-toolbelt (0.2.8-1) stable; urgency=low + + * Add a Dockerfile, to build `gemnasium/toolbelt` image + * Remove deprecation warnings when running commands gemnasium-toolbelt (0.2.8-1) stable; urgency=low * Add a Dockerfile, to build `gemnasium/toolbelt` image