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:
parent
bccc355a19
commit
d7b2d04e2d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
.sass-cache
|
.sass-cache
|
||||||
*.test
|
*.test
|
||||||
robeaux
|
|
||||||
profile.cov
|
profile.cov
|
||||||
|
12
Makefile
12
Makefile
@ -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 ; \
|
||||||
|
|
||||||
|
@ -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()))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package api
|
package robeaux
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
Loading…
x
Reference in New Issue
Block a user