2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 # This a simple script to make running Mojo shell easier (on Linux).
8 DIRECTORY="$(dirname "$0")"/../../out/Debug
9 PORT=$(($RANDOM % 8192 + 2000))
13 Usage: $(basename "$0") [-d DIRECTORY] [-|--] <mojo_shell arguments ...>
15 DIRECTORY defaults to $DIRECTORY.
18 $(basename "$0") mojo:mojo_sample_app
23 echo "Killing SimpleHTTPServer ..."
28 while [ $# -gt 0 ]; do
43 echo alias\ mojosh\=\'\"\$\(pwd\ \|\ sed\ \'\"\'\"\'s\/\\\(\.\*\\\/src\\\
44 \)\.\*\/\\1\/\'\"\'\"\'\)\/mojo\/tools\/mojosh\.sh\"\'
47 # Separate arguments to mojo_shell (e.g., in case you want to pass it -d).
59 echo "Base directory: $DIRECTORY"
61 echo "Running SimpleHTTPServer in directory $DIRECTORY/lib on port $PORT"
62 cd $DIRECTORY/lib || exit 1
63 python -m SimpleHTTPServer $PORT &
64 # Kill the HTTP server on exit (even if the user kills everything using ^C).
66 trap kill_http_server EXIT
70 echo "./mojo_shell --origin=http://127.0.0.1:$PORT --disable-cache $*"
71 ./mojo_shell --origin=http://127.0.0.1:$PORT --disable-cache $*