tom | 6a9f272 | 2014-09-13 17:00:02 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ONOS developer BASH profile conveniences |
| 3 | |
| 4 | # Root of the ONOS source tree |
| 5 | export ONOS_ROOT=${ONOS_ROOT:-~/onos-next} |
| 6 | |
| 7 | # Setup some environmental context for developers |
| 8 | export JAVA_HOME=$(/usr/libexec/java_home) |
| 9 | export MAVEN=${MAVEN:-~/Applications/apache-maven-3.2.2} |
| 10 | export KARAF=${KARAF:-~/Applications/apache-karaf-3.0.1} |
| 11 | export KARAF_LOG=$KARAF/data/log/karaf.log |
| 12 | |
| 13 | # Setup a path |
| 14 | export PS=":" |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame] | 15 | export PATH="$PATH:$ONOS_ROOT/tools/dev:$ONOS_ROOT/tools/build" |
| 16 | export PATH="$PATH:$ONOS_ROOT/tools/test/bin" |
tom | 6a9f272 | 2014-09-13 17:00:02 -0700 | [diff] [blame] | 17 | export PATH="$PATH:$MAVEN/bin:$KARAF/bin" |
| 18 | export PATH="$PATH:." |
| 19 | |
| 20 | # Convenience utility to warp to various ONOS source projects |
| 21 | # e.g. 'o api', 'o dev', 'o' |
| 22 | function o { |
| 23 | cd $(find $ONOS_ROOT/ -type d | egrep -v '.git|target|src' | \ |
| 24 | egrep "${1:-$ONOS_ROOT}" | head -n 1) |
| 25 | } |
| 26 | |
| 27 | # Short-hand for 'mvn clean install' for us lazy folk |
| 28 | alias mci='mvn clean install' |
| 29 | |
| 30 | # Short-hand for ONOS build from the top of the source tree. |
| 31 | alias ob='o && mvn clean install javadoc:aggregate' |
| 32 | |
| 33 | # Short-hand for tailing the ONOS (karaf) log |
| 34 | alias tl='$ONOS_ROOT/tools/dev/watchLog' |
| 35 | alias tlo='tl | grep --colour=always org.onlab' |
| 36 | |
| 37 | # Pretty-print JSON output |
| 38 | alias pp='python -m json.tool' |
| 39 | |
| 40 | # Short-hand to launch API docs and sample topology viewer GUI |
| 41 | alias docs='open $ONOS_ROOT/target/site/apidocs/index.html' |
| 42 | alias gui='open http://localhost:8181/onos/tvue' |
tom | 5c25570 | 2014-09-18 06:57:39 -0700 | [diff] [blame] | 43 | |
| 44 | |
| 45 | # Miscellaneous |
| 46 | function spy { |
| 47 | ps -ef | egrep "$@" | grep -v egrep |
| 48 | } |
| 49 | |
| 50 | function nuke { |
| 51 | spy | cut -c7-11 | xargs kill |
| 52 | } |