33# Gets called when the user doesn't provide any args
44function HELP {
55 echo -e " \nusage: source_file.py --key API_KEY [--url ALT_URL]"
6- echo " API_KEY - Rosette API key (required)"
7- echo " FILENAME - Python source file (optional)"
8- echo " ALT_URL - Alternate service URL (optional)"
9- echo " GIT_USERNAME - Git username where you would like to push regenerated gh-pages (optional)"
10- echo " VERSION - Build version (optional)"
11- echo " Compiles and runs the source file(s) using the local development source."
6+ echo " API_KEY - Rosette API key (required)"
7+ echo " FILENAME - Python source file (optional)"
8+ echo " ALT_URL - Alternate service URL (optional)"
9+ echo " Compiles and runs the source file(s) using the published rosette-api"
1210 exit 1
1311}
1412
1513# Gets API_KEY, FILENAME and ALT_URL if present
16- while getopts " :API_KEY:FILENAME:ALT_URL:GIT_USERNAME:VERSION " arg; do
14+ while getopts " :API_KEY:FILENAME:ALT_URL" arg; do
1715 case " ${arg} " in
1816 API_KEY)
1917 API_KEY=${OPTARG}
@@ -27,14 +25,6 @@ while getopts ":API_KEY:FILENAME:ALT_URL:GIT_USERNAME:VERSION" arg; do
2725 FILENAME=${OPTARG}
2826 usage
2927 ;;
30- GIT_USERNAME)
31- GIT_USERNAME=${OPTARG}
32- usage
33- ;;
34- VERSION)
35- VERSION={OPTARG}
36- usage
37- ;;
3828 esac
3929done
4030
@@ -48,46 +38,25 @@ function checkAPI {
4838}
4939
5040# Copy the mounted content in /source to current WORKDIR
51- cp -r -n /source/* .
41+ cp -r /source/* .
5242
5343# Run the examples
5444if [ ! -z ${API_KEY} ]; then
5545 checkAPI
5646 # Prerequisite
57- python /python-dev /setup.py install
58- cd /python-dev/ examples
47+ python /python/setup.py install
48+ cd examples
5949 if [ ! -z ${FILENAME} ]; then
6050 if [ ! -z ${ALT_URL} ]; then
61- python ${FILENAME} --key ${API_KEY} --url ${ALT_URL}
62- else
63- python ${FILENAME} --key ${API_KEY}
64- fi
51+ python ${FILENAME} --key ${API_KEY} --url ${ALT_URL}
52+ else
53+ python ${FILENAME} --key ${API_KEY}
54+ fi
6555 elif [ ! -z ${ALT_URL} ]; then
66- find -maxdepth 1 -name ' *.py' -print -exec python {} --key ${API_KEY} --url ${ALT_URL} \;
56+ find -maxdepth 1 -name ' *.py' -print -exec python {} --key ${API_KEY} --url ${ALT_URL} \;
6757 else
68- find -maxdepth 1 -name ' *.py' -print -exec python {} --key ${API_KEY} \;
58+ find -maxdepth 1 -name ' *.py' -print -exec python {} --key ${API_KEY} \;
6959 fi
7060else
7161 HELP
7262fi
73-
74- # Run unit tests
75- cd /python-dev
76- tox
77-
78- # Generate gh-pages and push them to git account (if git username is provided)
79- if [ ! -z ${GIT_USERNAME} ] && [ ! -z ${VERSION} ]; then
80- # clone python git repo
81- cd /
82- git clone
[email protected] :
${GIT_USERNAME} /python.git
83- cd python
84- git checkout origin/gh-pages -b gh-pages
85- git branch -d develop
86- # generate gh-pages and set ouput dir to git repo (gh-pages branch)
87- cd /python-dev
88- .tox/py27/bin/epydoc -v --no-private --no-frames --css epydoc.css -o /python rosette/* .py
89- cd /python
90- git add .
91- git commit -a -m " publish python apidocs ${VERSION} "
92- git push
93- fi
0 commit comments