From 9c6c8ee60927422238b6dde16b6e2d73fc46eb80 Mon Sep 17 00:00:00 2001 From: Scott Ivey Date: Sun, 29 Nov 2015 23:19:18 -0500 Subject: [PATCH] simplify client publishing --- Makefile | 46 ++++++++----------- clients/java/Makefile | 4 ++ clients/nodejs/Makefile | 7 +++ .../nodejs/client/test/functionalSmoketest.js | 34 -------------- clients/python/Makefile | 10 +++- clients/ruby/Makefile | 11 +++++ 6 files changed, 50 insertions(+), 62 deletions(-) create mode 100644 clients/java/Makefile create mode 100644 clients/nodejs/Makefile delete mode 100644 clients/nodejs/client/test/functionalSmoketest.js create mode 100644 clients/ruby/Makefile diff --git a/Makefile b/Makefile index b8e5b28..a0a728b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,3 @@ -clean: - rm -f src/*.o - thrift: python -m thrift_compiler.main --gen cpp2 -o src src/RelevancedProtocol.thrift @@ -28,7 +25,7 @@ thrift-java: thrift-0.9 --gen java -o build/thrift src/RelevancedProtocol.thrift mv ./build/thrift/gen-java/org/relevanced/client/protocol ./clients/java/client/src/main/java/org/relevanced/client/ -thrift-all: thrift thrift-py thrift-node thrift-java +thrift-all: thrift thrift-py thrift-node thrift-java thrift-rb build-docker-standalone: rm -f scripts/packaging/containers/standalone_server/data/* @@ -131,34 +128,31 @@ deb-package-remote: docker-sh: sudo docker run --rm -t -i relevanced/relevanced /bin/bash -smoketest-node: - node ./clients/nodejs/client/test/functionalSmoketest.js - smoketest-java: cd ./clients/java/client && sbt run -publish-node: - cd ./clients/nodejs/client/ && npm publish - -publish-python: - cd ./clients/python/client && python setup.py register -r pypi && python setup.py sdist upload -r pypi - -publish-ruby: - rm -f ./clients/ruby/client/*.gem - cd ./clients/ruby/client && gem build relevanced_client.gemspec - mv ./clients/ruby/client/*.gem ./clients/ruby/client/relevanced_client.gem - gem push ./clients/ruby/client/relevanced_client.gem - -publish-jvm: - cd ./clients/java/client && sbt publishSigned - -publish-clients: publish-node publish-python publish-ruby publish-jvm - -.PHONY: publish-node publish-python publish-ruby publish-jvm publish-clients - format-all: find src \( -name "*.h" -o -name "*.cpp" -o -name "*.mm" \) -exec clang-format -i {} + deps: cd external/libstemmer && make libstemmer.o -j4 +TEST_DATA_DIR=$(WORKDIR)/build/test_data + +run-server: + mkdir -p $(TEST_DATA_DIR) && rm -rf $(TEST_DATA_DIR)/* + cd build/bin && cmake ../../ && make relevanced -j4 + cd build/bin && ./src/relevanced --data_dir=$(TEST_DATA_DIR) + +test-clients: + $(MAKE) -C clients/python test + $(MAKE) -C clients/nodejs test + $(MAKE) -C clients/ruby test + +publish-clients: test-clients + $(MAKE) -C clients/python publish + $(MAKE) -C clients/nodejs publish + $(MAKE) -C clients/ruby publish + $(MAKE) -C clients/java publish + +.PHONY: test-clients publish-clients diff --git a/clients/java/Makefile b/clients/java/Makefile new file mode 100644 index 0000000..e703612 --- /dev/null +++ b/clients/java/Makefile @@ -0,0 +1,4 @@ +publish: + cd client && sbt publishSigned + +.PHONY: publish diff --git a/clients/nodejs/Makefile b/clients/nodejs/Makefile new file mode 100644 index 0000000..42e04d7 --- /dev/null +++ b/clients/nodejs/Makefile @@ -0,0 +1,7 @@ +.PHONY: test publish + +test: + cd client && mocha test + +publish: + cd client && npm publish diff --git a/clients/nodejs/client/test/functionalSmoketest.js b/clients/nodejs/client/test/functionalSmoketest.js deleted file mode 100644 index cb147e0..0000000 --- a/clients/nodejs/client/test/functionalSmoketest.js +++ /dev/null @@ -1,34 +0,0 @@ -var RelevancedClient = require('../').RelevancedClient; -var _ = require('lodash'); -var log = _.bind(console.log, console); - -var main = function() { - RelevancedClient.connect('localhost', 8097).then(function(client) { - client.getServerMetadata().then(function(metadata) { - log('server metadata: '); - log(metadata); - client.listAllCentroids().then(function(result) { - var centroids = result.centroids; - log("Centroid count: ", centroids.length); - log(centroids); - centroids = _.filter(centroids, function(x) { - return x.indexOf('wiki') !== -1; - }); - client.listAllDocuments().then(function(docRes) { - var documents = docRes.documents; - log("document count: ", documents.length); - log(documents.slice(0, 10)); - var centroid = centroids[0]; - var doc = documents[5]; - client.getDocumentSimilarity(centroid, doc).then(function(similarity) { - log('got similarity for ', doc, ' against ', centroid); - log('result: ', similarity); - client.disconnect(); - }).catch(log); - }).catch(log); - }).catch(log); - }).catch(log); - }).catch(log); -}; - -main(); diff --git a/clients/python/Makefile b/clients/python/Makefile index 5dfeceb..ba0d959 100644 --- a/clients/python/Makefile +++ b/clients/python/Makefile @@ -1,4 +1,10 @@ lint: - pyflakes client/relevanced_client/client.py client/relevanced_client/exceptions.py + pyflakes client/relevanced_client/client.py -.PHONY: lint +test: + cd client && nosetests relevanced_client/test + +publish: + cd client && python setup.py register -r pypi && python setup.py sdist upload -r pypi + +.PHONY: lint test publish diff --git a/clients/ruby/Makefile b/clients/ruby/Makefile new file mode 100644 index 0000000..64029c4 --- /dev/null +++ b/clients/ruby/Makefile @@ -0,0 +1,11 @@ +.PHONY: test publish + +test: + cd client && rspec + +publish: + cd client && npm publish + rm -f client/*.gem + cd client && gem build relevanced_client.gemspec + mv client/*.gem client/relevanced_client.gem + gem push client/relevanced_client.gem