Skip to content

Instantly share code, notes, and snippets.

@millermedeiros
Created March 25, 2014 16:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save millermedeiros/9765537 to your computer and use it in GitHub Desktop.
Save millermedeiros/9765537 to your computer and use it in GitHub Desktop.
shell aliases and commands to help Gaia/B2G (Firefox OS) development - specially for the "productivity" apps
# based on https://github.com/gnarf/.dotfiles/blob/master/b2g.sh
# =============================================================================
export FIREFOX="/Applications/FirefoxNightly.app/Contents/MacOS/firefox"
export GAIA_DIR="/Users/millermedeiros/Projects/gaia"
alias firefox="$FIREFOX"
alias b2g-bin="$GAIA_DIR/b2g/Contents/MacOS/b2g-bin"
alias b2g="b2g-bin"
# profile path should use full path (no tailing "/")
GAIA_PROFILE="$GAIA_DIR/profile"
GAIA_PROFILE_DEBUG="$GAIA_DIR/profile-debug"
# ---
# IMPORTAT! you need to run `DEBUG=1 make` before running most commands since
# they require the $GAIA_PROFILE_DEBUG
gaia() {
if [ -z "$1" ]; then
firefox -no-remote -profile $GAIA_PROFILE_DEBUG
else
firefox -no-remote -profile $GAIA_PROFILE_DEBUG "http://${1}.gaiamobile.org:8080/"
fi
}
# apps doesn't work the same way when outside system app, but it can be useful
# when you need to access the console quickly
alias gaia-cal="gaia calendar"
alias gaia-clock="gaia clock"
alias gaia-mail="gaia email"
gaia-install-app() {
DEBUG=0 APP=$1 make && BUILD_APP_NAME=$1 make install-gaia
}
alias gaia-install-cal="gaia-install-app calendar"
alias gaia-install-mail="gaia-install-app email"
alias gaia-install-clock="gaia-install-app clock"
gaia-test() {
# if port 8789 is used it means server is already running
nc -z -w5 127.0.0.1 8789
if [ "$?" = "1" ]; then
make test-agent-server &
fi
firefox -no-remote -marionette -profile $GAIA_PROFILE_DEBUG http://test-agent.gaiamobile.org:8080 > /dev/null 2>&1
}
gaia-marionette() {
TEST_FILES=$1 "$GAIA_DIR/bin/gaia-marionette" --reporter spec
}
gaia-b2g() {
# b2g-bin doesn't work well with DEBUG flag
b2g-bin -profile $GAIA_PROFILE
}
adb-console() {
# looooooongcat :P
adb shell logcat | grep GeckoConsole
}
adb-screen() {
adb shell screencap -p /sdcard/screenshot.png && \
adb pull /sdcard/screenshot.png ~/Desktop/devicescreenshot.png && \
open ~/Desktop/devicescreenshot.png
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment