Skip to content

Commit

Permalink
Remove gotcha (fix #42)
Browse files Browse the repository at this point in the history
  • Loading branch information
ian-kent committed Apr 19, 2015
1 parent f4a8a8c commit 320a41f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
21 changes: 20 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VERSION=0.1.7

all: deps fmt combined

combined:
Expand All @@ -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
Expand All @@ -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
22 changes: 12 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down

0 comments on commit 320a41f

Please sign in to comment.