From 320a41fcd91a51b05ac9d4eb281ae989289aef81 Mon Sep 17 00:00:00 2001 From: Ian Kent Date: Sun, 19 Apr 2015 18:06:05 +0100 Subject: [PATCH] Remove gotcha (fix #42) --- Makefile | 21 ++++++++++++++++++++- main.go | 22 ++++++++++++---------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 97301e0..407dac2 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +VERSION=0.1.7 + all: deps fmt combined combined: @@ -14,7 +16,6 @@ deps: go get github.com/mailhog/MailHog-UI cd ../MailHog-UI; make bindata go get github.com/mailhog/http - go get github.com/ian-kent/gotcha/gotcha go get github.com/ian-kent/go-log/log go get github.com/ian-kent/envconf go get github.com/ian-kent/goose @@ -31,4 +32,22 @@ test-deps: release-deps: go get github.com/mitchellh/gox +pull: + git pull + cd ../data; git pull + cd ../http; git pull + cd ../MailHog-Server; git pull + cd ../MailHog-UI; git pull + cd ../smtp; git pull + cd ../storage; git pull + +tag: + git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION} + cd ../data; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION} + cd ../http; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION} + cd ../MailHog-Server; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION} + cd ../MailHog-UI; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION} + cd ../smtp; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION} + cd ../storage; git tag -a -m 'v${VERSION}' ${VERSION} && git push origin ${VERSION} + .PNONY: all combined release fmt deps test-deps release-deps diff --git a/main.go b/main.go index 1bda7d5..a8ccb3a 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,10 @@ import ( "flag" "os" + gohttp "net/http" + + "github.com/gorilla/pat" "github.com/ian-kent/go-log/log" - gotcha "github.com/ian-kent/gotcha/app" "github.com/mailhog/MailHog-Server/api" cfgapi "github.com/mailhog/MailHog-Server/config" "github.com/mailhog/MailHog-Server/smtp" @@ -32,19 +34,19 @@ func main() { exitCh = make(chan int) if uiconf.UIBindAddr == apiconf.APIBindAddr { - cb := func(app *gotcha.App) { - web.CreateWeb(uiconf, app) - api.CreateAPIv1(apiconf, app) - api.CreateAPIv2(apiconf, app) + cb := func(r gohttp.Handler) { + web.CreateWeb(uiconf, r.(*pat.Router), assets.Asset) + api.CreateAPIv1(apiconf, r.(*pat.Router)) + api.CreateAPIv2(apiconf, r.(*pat.Router)) } go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb) } else { - cb1 := func(app *gotcha.App) { - api.CreateAPIv1(apiconf, app) - api.CreateAPIv2(apiconf, app) + cb1 := func(r gohttp.Handler) { + api.CreateAPIv1(apiconf, r.(*pat.Router)) + api.CreateAPIv2(apiconf, r.(*pat.Router)) } - cb2 := func(app *gotcha.App) { - web.CreateWeb(uiconf, app) + cb2 := func(r gohttp.Handler) { + web.CreateWeb(uiconf, r.(*pat.Router), assets.Asset) } go http.Listen(apiconf.APIBindAddr, assets.Asset, exitCh, cb1) go http.Listen(uiconf.UIBindAddr, assets.Asset, exitCh, cb2)