Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save virtualhobbit/dec8fc520ef416db4b1b5d456ad563be to your computer and use it in GitHub Desktop.
Save virtualhobbit/dec8fc520ef416db4b1b5d456ad563be to your computer and use it in GitHub Desktop.
export cf_server="myServer"
export cf_username="myUser"
export cf_password="myPassword"
export cf_category="c1001"
for i in $(ls *.js);
do
j=$(echo $i | cut -f 1 -d '.');
jsdoc $i -d $j;
zip -r $j.zip $j/;
RESULT=$( curl -u $cf_username:$cf_password -X GET http://$cf_server/rest/docs/2.0/repository/$cf_category/findByName/$j | jq -r '.[] | .id' );
if [ -z $RESULT ];
then
curl -u $cf_username:$cf_password -X PUT --upload-file $j.zip http://$cf_server/rest/docs/2.0/repository/$cf_category/$j;
else
curl -u $cf_username:$cf_password -X POST -H "X-Atlassian-Token":"nocheck" --upload-file $j.zip http://$cf_server/rest/docs/2.0/repository/$cf_category-$RESULT;
fi;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment