1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-06 19:29:15 +08:00

Move robeaux into it's own package

This commit is contained in:
Adrian Zankich 2014-07-10 11:35:00 -07:00
parent bccc355a19
commit d7b2d04e2d
4 changed files with 12 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
.sass-cache .sass-cache
*.test *.test
robeaux
profile.cov profile.cov

View File

@ -20,15 +20,15 @@ ifeq (,$(shell which go-bindata))
$(error robeaux not built! https://github.com/jteeuwen/go-bindata is required to build robeaux assets ) $(error robeaux not built! https://github.com/jteeuwen/go-bindata is required to build robeaux assets )
endif endif
cd api ; \ cd api ; \
git clone --depth 1 git://github.com/hybridgroup/robeaux.git ; \ git clone --depth 1 git://github.com/hybridgroup/robeaux.git robeaux-tmp; \
cd robeaux ; \ cd robeaux-tmp ; \
rm fonts/* ; \ rm fonts/* ; \
rm Makefile package.json README.markdown robeaux.gemspec css/fonts.css ; \ rm Makefile package.json README.markdown robeaux.gemspec css/fonts.css ; \
touch css/fonts.css ; \ touch css/fonts.css ; \
echo "Updating robeaux to $(shell git rev-parse HEAD)" ; \ echo "Updating robeaux to $(shell git rev-parse HEAD)" ; \
go-bindata -pkg="api" -o robeaux.go -ignore=\\.git ./... ; \ go-bindata -pkg="robeaux" -o robeaux.go -ignore=\\.git ./... ; \
mv robeaux.go .. ; \ mv robeaux.go ../robeaux ; \
cd .. ; \ cd .. ; \
rm -rf robeaux/ ; \ rm -rf robeaux-tmp/ ; \
go fmt ./robeaux.go ; \ go fmt ./robeaux/robeaux.go ; \

View File

@ -4,12 +4,14 @@ import (
"crypto/subtle" "crypto/subtle"
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"github.com/bmizerany/pat"
"github.com/hybridgroup/gobot"
"io/ioutil" "io/ioutil"
"log" "log"
"net/http" "net/http"
"strings" "strings"
"github.com/bmizerany/pat"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/api/robeaux"
) )
// Optional restful API through Gobot has access // Optional restful API through Gobot has access
@ -128,7 +130,7 @@ func (a *api) setHeaders(f func(http.ResponseWriter, *http.Request)) http.Handle
func (a *api) robeaux(res http.ResponseWriter, req *http.Request) { func (a *api) robeaux(res http.ResponseWriter, req *http.Request) {
path := req.URL.Path path := req.URL.Path
buf, err := Asset(path[1:]) buf, err := robeaux.Asset(path[1:])
if err != nil { if err != nil {
log.Println("Error serving static file:", err.Error()) log.Println("Error serving static file:", err.Error())
res.Write([]byte(err.Error())) res.Write([]byte(err.Error()))

View File

@ -1,4 +1,4 @@
package api package robeaux
import ( import (
"bytes" "bytes"