grunt plugins for Tizen apps, creating zip files, and running mocha tests

The short version

I wrote some grunt plugins for managing Tizen application development and doing related stuff:

  • grunt-tizen: For pushing packages (or other files) to a Tizen device, installing/uninstalling them, and starting/stopping applications (via sdb).
  • grunt-zipup: For creating zip files with customisable, template-based filenames; as Tizen web apps are just zip files with a wgt suffix, it can also be used to create those.
  • grunt-mochaccino: For running mocha tests within a grunt build, using the mocha command line rather than the mocha API. This was developed for unit testing the above plugins, but can be used to run mocha tests for any project.

They are all available from github at the links above, or can be installed via npm (instructions in the READMEs).

They are all released under the Apache v2 license.

The long version

I've been working on Tizen-related applications (most notably some of the web apps) for a few months. (The Slider Puzzle I rewrote should work in very recent Firefox and Chrome.)

One aim was to get these applications to run on Tizen devices, partly as they are included as samples in the Tizen SDK. My colleagues have done some good work on the SDK, but, unfortunately, it doesn't yet support the Linux distribution I use (Fedora, currently version 17). So I had a requirement to install web apps on Tizen, but without the possibility of using the SDK.

Fortunately, one of the key tools for interacting with a Tizen device is sdb (Smart Development Bridge), which is a fork of the Android adb tool. It works over a network connection between the device and a developer machine, usually over a USB cable, enabling file transfer between the two and access to a shell on the device. sdb is very easy to build on Linux, so it wasn't long before I had a way to push web app packages to my device, get a command line on the same device, then use the Tizen package tools (wrt-installer and pkgcmd) to install the package, then running it in debug mode and remotely debugging it (via wrt-launcher).

As with all these things, I soon got bored with entering the same commands over and over, so I wrote some bash scripts to automate pushing the package, starting the shell, executing the command, and opening a debug session. One of my colleagues started using the same scripts, so I made them more portable and robust.

Alongside this, I was using the venerable grunt to minify my JavaScript/CSS/images etc. But this meant two build tools (bash scripts + grunt) in use at once, which would never do. So I started integrating the bash scripts with grunt, and gradually replacing calls to command line programs where possible with grunt plugins.

The result is the three plugins mentioned at the start of this post. They've been tested on Fedora Linux and Windows 7, and are hopefully fairly easy to use (I spent quite a bit of time on documentation).

Please try them, and, if you're so inclined, contribute via github (pull requests and issues).