Skip to content

Instantly share code, notes, and snippets.

@Barteks2x
Last active July 2, 2019 16:27
Show Gist options
  • Save Barteks2x/18714ce74788208d9e00f04b9b712154 to your computer and use it in GitHub Desktop.
Save Barteks2x/18714ce74788208d9e00f04b9b712154 to your computer and use it in GitHub Desktop.
A script to start local maven sfile server with live MCPBot exports. Use channel "live" and version number shown just before starting HTTP server in buildscript, add maven repository with URL "http://127.0.0.1:8000/". If everything is working, you should see the mappings file being accessed in HTTP server output.
#!/bin/bash
tmp_dir=$(mktemp -p "" -d -t liveMcpMappings-XXXXXXXXXX)
version_string=$RANDOM
echo Downloading live mappings to temporary directory $tmp_dir
cd $tmp_dir
wget -o /dev/null http://export.mcpbot.bspk.rs/fields.csv || echo "Downloading field.csv failed"
wget -o /dev/null http://export.mcpbot.bspk.rs/methods.csv || echo "Downloading methods.csv failed"
wget -o /dev/null http://export.mcpbot.bspk.rs/params.csv || echo "Downloading params.csv failed"
echo Creating zip file
zip mcp_live-$version_string.zip fields.csv methods.csv params.csv > /dev/null
echo "Deploying to $tmp_dir/maven"
mvn deploy:deploy-file -Durl=file://"$tmp_dir"/maven \
-DrepositoryId=maven.local.repo \
-Dfile=mcp_live-$version_string.zip \
-DgroupId=de.oceanlabs.mcp \
-DartifactId=mcp_live \
-Dversion=$version_string \
-Dpackaging=zip > /dev/null
mvn deploy:deploy-file -Durl=file://"$tmp_dir"/maven \
-DrepositoryId=maven.local.repo \
-Dfile=mcp_live-$version_string.zip \
-DgroupId=de.oceanlabs.mcp \
-DartifactId=mcp_live \
-Dversion="$version_string-1" \
-Dpackaging=zip > /dev/null
echo "=================================="
echo "VERSION: $version_string"
echo "=================================="
echo "Starting HTTP server"
cd maven
python3 -m http.server
cd ..
rm -r -- "$tmp_dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment