From 1e28d0306b125e2449cd4c1a6c1446a54eccab53 Mon Sep 17 00:00:00 2001 From: franklin Date: Mon, 6 Jul 2015 14:41:02 +0200 Subject: [PATCH] updated build script --- .gitignore | 3 +-- Makefile | 11 +++++------ README.md | 36 +++++++++++++++++++++++++++++++--- cli/package.sh => pkg/build.sh | 31 +++++++++++++++++------------ 4 files changed, 58 insertions(+), 23 deletions(-) rename cli/package.sh => pkg/build.sh (60%) diff --git a/.gitignore b/.gitignore index e3727a9..f47ed53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .* *~ /bin/ -/pkg/ -/main +/pkg/tmp/ !.git* diff --git a/Makefile b/Makefile index b9c7cf1..2753ad0 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,12 @@ SHELL := /bin/bash options: - echo "you can clean | test | build | run" + echo "you can clean | test | build | run | package" clean: rm -f bin/content-server -build: - make clean +build: clean go build -o bin/content-server -package: clean build - cli/package.sh +package: build + pkg/build.sh test: - go test -v github.com/foomo/contentserver/server/repo + go test -v github.com/foomo/contentserver/server/repo diff --git a/README.md b/README.md index 778a879..f040dbf 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. +## 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. \ No newline at end of file diff --git a/cli/package.sh b/pkg/build.sh similarity index 60% rename from cli/package.sh rename to pkg/build.sh index 35ab2e9..0f94947 100755 --- a/cli/package.sh +++ b/pkg/build.sh @@ -6,11 +6,12 @@ URL="http://www.foomo.org" DESCRIPTION="Serves content tree structures very quickly through a json socket api." LICENSE="LGPL-3.0" -ARCH="amd64" +# get version VERSION=`bin/content-server --version | sed 's/content-server //'` -PACKAGE=`pwd`/pkg -mkdir -p $PACKAGE +# create temp dir +TEMP=`pwd`/pkg/tmp +mkdir -p $TEMP package() { @@ -19,13 +20,18 @@ package() TYPE=$3 TARGET=$4 + # copy license file + cp LICENSE $LICENSE + + # define source dir + SOURCE=`pwd`/pkg/${TYPE} + # create build folder - BUILD=`pwd`/${NAME}-${VERSION} - mkdir -p $BUILD/usr/bin - cp bin/${NAME} $BUILD/usr/bin/. + BUILD=${TEMP}/${NAME}-${VERSION} + #rsync -rv --exclude **/.git* --exclude /*.sh $SOURCE/ $BUILD/ # 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 fpm -s dir \ @@ -36,16 +42,17 @@ package() --license $LICENSE \ --description "${DESCRIPTION}" \ --architecture $ARCH \ - --package pkg \ + --package $TEMP \ --url "${URL}" \ -C $BUILD \ . - # cleanup - rm -rf $BUILD - # 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