updated build script

This commit is contained in:
franklin 2015-07-06 14:41:02 +02:00
parent f580db3dc2
commit 1e28d0306b
4 changed files with 58 additions and 23 deletions

3
.gitignore vendored
View File

@ -1,6 +1,5 @@
.* .*
*~ *~
/bin/ /bin/
/pkg/ /pkg/tmp/
/main
!.git* !.git*

View File

@ -1,13 +1,12 @@
SHELL := /bin/bash SHELL := /bin/bash
options: options:
echo "you can clean | test | build | run" echo "you can clean | test | build | run | package"
clean: clean:
rm -f bin/content-server rm -f bin/content-server
build: build: clean
make clean
go build -o bin/content-server go build -o bin/content-server
package: clean build package: build
cli/package.sh pkg/build.sh
test: test:
go test -v github.com/foomo/contentserver/server/repo go test -v github.com/foomo/contentserver/server/repo

View File

@ -1,7 +1,6 @@
Content Server # Content Server
===========
Serves content tree structures very quickly through a json socket api > Serves content tree structures very quickly through a json socket api
## Concept ## Concept
@ -41,3 +40,34 @@ All you have to do is to provide a tree of content nodes as a JSON encoded RepoN
There is a PHP Proxy implementation for foomo in [Foomo.ContentServer](https://github.com/foomo/Foomo.ContentServer). Feel free to use it or to implement your own proxy in the language you love. The API should be easily to implement in every other framework and language, too. There is a PHP Proxy implementation for foomo in [Foomo.ContentServer](https://github.com/foomo/Foomo.ContentServer). Feel free to use it or to implement your own proxy in the language you love. The API should be easily to implement in every other framework and language, too.
## Usage
```
$ content-server --help
Usage of bin/content-server:
-address="127.0.0.1:8081": address to bind host:port
-logLevel="record": one of error, record, warning, notice, debug
-protocol="tcp": what protocol to server for
-vardir="127.0.0.1:8081": where to put my data
```
## Testing
```
$ git clone https://github.com/foomo/contentserver.git
$ cd content-server
$ make test
```
## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests and examples for any new or changed functionality.
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## License
Copyright (c) foomo under the LGPL 3.0 license.

View File

@ -6,11 +6,12 @@ URL="http://www.foomo.org"
DESCRIPTION="Serves content tree structures very quickly through a json socket api." DESCRIPTION="Serves content tree structures very quickly through a json socket api."
LICENSE="LGPL-3.0" LICENSE="LGPL-3.0"
ARCH="amd64" # get version
VERSION=`bin/content-server --version | sed 's/content-server //'` VERSION=`bin/content-server --version | sed 's/content-server //'`
PACKAGE=`pwd`/pkg # create temp dir
mkdir -p $PACKAGE TEMP=`pwd`/pkg/tmp
mkdir -p $TEMP
package() package()
{ {
@ -19,13 +20,18 @@ package()
TYPE=$3 TYPE=$3
TARGET=$4 TARGET=$4
# copy license file
cp LICENSE $LICENSE
# define source dir
SOURCE=`pwd`/pkg/${TYPE}
# create build folder # create build folder
BUILD=`pwd`/${NAME}-${VERSION} BUILD=${TEMP}/${NAME}-${VERSION}
mkdir -p $BUILD/usr/bin #rsync -rv --exclude **/.git* --exclude /*.sh $SOURCE/ $BUILD/
cp bin/${NAME} $BUILD/usr/bin/.
# build binary # build binary
GOOS=$OS GOARCH=$ARCH go build -o $BUILD/usr/bin/${NAME} contentserver.go GOOS=$OS GOARCH=$ARCH go build -o $BUILD/usr/local/bin/${NAME}
# create package # create package
fpm -s dir \ fpm -s dir \
@ -36,16 +42,17 @@ package()
--license $LICENSE \ --license $LICENSE \
--description "${DESCRIPTION}" \ --description "${DESCRIPTION}" \
--architecture $ARCH \ --architecture $ARCH \
--package pkg \ --package $TEMP \
--url "${URL}" \ --url "${URL}" \
-C $BUILD \ -C $BUILD \
. .
# cleanup
rm -rf $BUILD
# push # push
package_cloud push $TARGET $PACKAGE/${NAME}_${VERSION}_${ARCH}.${TYPE} package_cloud push $TARGET $TEMP/${NAME}_${VERSION}_${ARCH}.${TYPE}
# cleanup
rm -rf $TEMP
rm $LICENSE
} }
package linux amd64 deb foomo/content-server/ubuntu/trusty package linux amd64 deb foomo/content-server/ubuntu/trusty