kenhuuu commented on code in PR #2299:
URL: https://github.com/apache/tinkerpop/pull/2299#discussion_r1410051955


##########
run_examples.sh:
##########
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+#Licensed to the Apache Software Foundation (ASF) under one
+#or more contributor license agreements.  See the NOTICE file
+#distributed with this work for additional information
+#regarding copyright ownership.  The ASF licenses this file
+#to you under the Apache License, Version 2.0 (the
+#"License"); you may not use this file except in compliance
+#with the License.  You may obtain a copy of the License at
+#
+#http://www.apache.org/licenses/LICENSE-2.0
+#
+#Unless required by applicable law or agreed to in writing,
+#software distributed under the License is distributed on an
+#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#KIND, either express or implied.  See the License for the
+#specific language governing permissions and limitations
+#under the License.
+
+open -a Docker
+docker pull tinkerpop/gremlin-server
+docker run -d --rm -p 8182:8182 --name glv-examples --health-cmd="curl -f 
http://localhost:8182/ || exit 1" --health-interval=5s --health-timeout=3s 
tinkerpop/gremlin-server
+
+echo
+echo "Not having docker open initially may cause an error loop. If so, simply 
restart this script."
+echo -n "Starting Gremlin server on port 8182..."
+until docker inspect --format '{{.State.Health.Status}}' glv-examples | grep 
-q "healthy"; do
+     echo -n "."
+     sleep 1
+done
+echo
+
+cd gremlin-driver/src/main/java/examples || exit
+mvn clean install
+
+echo
+echo "Running Java examples"
+java -cp target/run-examples-shaded.jar examples.Connections
+java -cp target/run-examples-shaded.jar examples.BasicGremlin
+cd ../../../../.. || exit
+
+echo
+echo "Running python examples:"
+python3 gremlin-python/src/main/python/examples/connections.py
+python3 gremlin-python/src/main/python/examples/basic_gremlin.py
+
+echo
+echo "Running JavaScript examples:"
+npm install --prefix gremlin-javascript/examples
+node gremlin-javascript/examples/connections.js
+node gremlin-javascript/examples/basic-gremlin.js
+
+echo
+echo "Running .NET examples:"
+dotnet run --project gremlin-dotnet/Examples/Connections
+dotnet run --project gremlin-dotnet/Examples/BasicGremlin
+
+echo
+echo "Running Go examples:"
+cd gremlin-go/examples || exit
+go run connections.go
+go run basic_gremlin.go
+cd ../.. || exit
+
+echo
+echo -n "Shutting down container: "
+docker stop glv-examples

Review Comment:
   Depending on whether or not something went wrong earlier or the user quit in 
the middle, this might not get called. Cleanup should be done in an EXIT trap 
sort like https://github.com/apache/tinkerpop/blob/master/docker/build.sh#L33



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to