Skip to content

Instantly share code, notes, and snippets.

@ytjohn
Created March 14, 2016 17:54
Show Gist options
  • Save ytjohn/0acea092a0d56a39c63d to your computer and use it in GitHub Desktop.
Save ytjohn/0acea092a0d56a39c63d to your computer and use it in GitHub Desktop.
on-http makefile
.PHONY: clean deps test deb
SHELL := /bin/bash
CWD ?= $(shell pwd)
BRANCH ?= $(git symbolic-ref --short -q HEAD)
help:
@echo "deps - install build dependencies"
@echo "test - run tests"
@echo "apidoc - build docs"
@echo "
deps-system:
# nodejs-legacy is needed on debian systems
sudo apt-get update
sudo apt-get install -y \
debhelper \
default-jdk \
devscripts \
dh-make \
git \
libkrb5-dev \
maven \
mongodb \
nodejs \
nodejs-legacy \
npm \
rabbitmq-server \
pbuilder \
ubuntu-dev-tools
swagger-codegen:
if [ ! -d swagger-codegen ]; then \
git clone --branch v2.1.5 https://github.com/swagger-api/swagger-codegen.git; \
fi
npm:
npm install
deps: swagger-codegen npm
doc:
npm run apidoc
clean:
rm -rf swagger-codegen
rm -rf *.deb deb/
rm -rf node_modules/
rm -rf coverage/
rm -rf test/
rm commitstring.txt
rm -rf on-http-api1.1/
rm -rf on-http-api2.0/
rm -rf on-http-redfish-1.0/
rm -rf on-http*.tar.gz*
rm -rf *.build
rm -rf packagebuild/
rm -rf python-on-http*
deb: npm swagger-codegen doc
npm prune --production
pushd ./swagger-codegen; mvn package; popd
java -jar ./swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i static/monorail.yml -o on-http-api1.1 -l python --additional-properties packageName=on_http_api1_1
java -jar ./swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i static/monorail-2.0.yaml -o on-http-api2.0 -l python --additional-properties packageName=on_http_api2_0
java -jar ./swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i static/redfish.yaml -o on-http-redfish-1.0 -l python --additional-properties packageName=on_http_redfish_1_0
./build-package.bash python-client "${BRANCH}" "on-http-api1.1"
./build-package.bash python-client "${BRANCH}" "on-http-api2.0"
./build-package.bash python-client "${BRANCH}" "on-http-redfish-1.0"
./build-package.bash on-http "${BRANCH}"
mkdir deb && cp -a *.deb deb/
notest:
# Checks the code against the jshint options
./node_modules/.bin/jshint -c .jshintrc --reporter=checkstyle lib index.js > checkstyle-result.xml || true
./node_modules/.bin/jshint -c .jshintrc lib index.js || true
# Runs the mocha tests and reports the code coerage.
@if [ ! -d test ]; then mkdir test; fi
./node_modules/.bin/istanbul cover -x "**/spec/**" ./node_modules/.bin/_mocha -- $(find spec -name '*-spec.js') -R xunit-file --require spec/helper.js
./node_modules/.bin/istanbul report cobertura
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment