Wednesday, August 12, 2009

Adobe AIR on Gentoo

Balsamiq Mockups for the desktop (www.balsamiq.com) is a nice tool for generating nice looking mockups real fast (much faster than visio, for example).
I've been using the web based trial version until today, when I got my license.

Running Balsamiq locally requires installing Adobe AIR on my machine, something I haven't got to doing until now. Installing the linux version of the AIR on gentoo didn't work at all (the installer binary just exits without any message).

Trying to resolve this, one of the first google search results was a nice guide for gentoo. And it worked flawlessly - basically you need to unpack the AIR SDK instead of using the installer.

I've also written a slightly more sophisticated shell script for running AIR apps, which allows specifying the app on the command line as well as symlinking.

/usr/local/bin/air:

#!/bin/sh

SDK_DIR="/usr/local/air_1.5_sdk"
APPS_DIR="/usr/local/air_apps"

BASE="$(basename $0)"


if [ -n "$1" ]
then
APP_NAME="$1"
if [ ! -d "$APPS_DIR/$APP_NAME" ]
then
echo "App $APP_NAME not found in $APPS_DIR" > /dev/stderr
exit 1
fi

else
APP_NAME="$BASE"
if [ ! -d "$APPS_DIR/$APP_NAME" ]
then echo "App $APP_NAME not found in $APPS_DIR" > /dev/stderr
echo "Usage: $(basename $0) " > /dev/stderr
exit 1
fi
fi

exec "$SDK_DIR/bin/adl" -nodebug "$APPS_DIR/$APP_NAME/META-INF/AIR/application.xml" "$APPS_DIR/$APP_NAME"


Now simply unpack balsamiq in /usr/local/air_apps/balsamiq, symlink and you're ready to go:
$ mkdir /usr/local/air_apps/balsamiq && unzip MockupsForDesktop.air -d /usr/local/air_apps/balsamiq
$ ln -s air /usr/local/bin/balsamiq
$ balsamiq &


Update: Support passing command line arguments to the air application (note that for balsamiq to open a file given on the command line, a full absolute path needs to be given)

#!/bin/sh

SDK_DIR="/usr/local/air_1.5_sdk"
APPS_DIR="/usr/local/air_apps"

BASE="$(basename $0)"

if [ "$BASE" = air -a -n "$1" ]
then
APP_NAME="$1"
if [ ! -d "$APPS_DIR/$APP_NAME" ]
then
echo "App $APP_NAME not found in $APPS_DIR" > /dev/stderr
exit 1
fi

shift

else
APP_NAME="$BASE"
if [ ! -d "$APPS_DIR/$APP_NAME" ]
then
echo "App $APP_NAME not found in $APPS_DIR" > /dev/stderr
echo "Usage: $(basename $0) " > /dev/stderr
exit 1
fi
fi

exec "$SDK_DIR/bin/adl" -nodebug "$APPS_DIR/$APP_NAME/META-INF/AIR/application.xml" "$APPS_DIR/$APP_NAME" -- "$@"

2 comments:

  1. Great post!
    Interesting news about Balsamiq:
    Yesterday, Napkee (dot com) launched another tool that exports your balsamiq mockups to HTML / FLEX ? etc. Check it out!
    Also, I like to use a whitboard and MockupMagnets (dot com) before I use Balsamiq.

    ReplyDelete
  2. Thanks! I'll be sure to check those out.

    ReplyDelete