As RIM plough forward and deliver a cascade of development tools – one of the key tools is the Ripple Emulator. The Ripple Emulator allows you to simulate a mobile device in Chrome or Chromium and debug it easily. It’s a great app for creating HTML5 apps.
Unfortunately for us Linux users, we have had the short straw as a quick peek over at the BlackBerry site reveals that there is only a download for Windows or Mac.
Not to be put off – I figured that the code must be pretty much the same for both systems and decided that I’d get it working in Linux. Here’s my howto for getting Ripple working with Ubuntu 12.04 – so please bear in mind that instructions might vary based on your Linux distro.
Get Ripple
The first step is to download Ripple. As there is no Linux variant, we’re going to download the Windows installer from here. Save it to a sensible folder. I’ve used the default Downloads folder for my needs.
Extract the Programs
Browse to the Install_Ripple_Beta.exe file and right-click. Click Extract Here. This will create a folder named Install_Ripple_Beta. Inside are two directories: InstallerData and Windows.
Navigate to InstallerData/Disk1/InstData. In there you’ll find a file called Resource1.zip. Open this with Archive Manager.
Open /$IA_PROJECT_DIR$/ and you’ll find another 3 directories.
Let’s grab the Chromium plugin first: Right-click on Build and select Extract… Navigate to your home folder. Select Create Folder and name the new folder ‘ripple’. Open the ripple folder and click Extract.
Now, let’s get the ripple emulator itself. Back in Archive Manager, open the target folder. Inside you’ll find a file named bd-services_zg_ia_sf.jar. Right-click on this and select Extract… You should still be in the ripple directory from the last step, so just click on Extract. Once done, click Show Files and you should see the .jar file and the build directory.
Cool., the jar file has the services inside. Right-click on it and select Extract Here. This will create a folder called services.
Congratulations – you now have everything ready to run Ripple! (almost)
Configure Your System
We need to install a program called node.js onto the computer to make some magic happen. A simple way to do this is to open the terminal. Then run the following commands:
sudo apt-get -y install nodejs
Install the Plugin
Easy, eh? Now we need to install the Plugin. Open the directory build/ripple-ui-pkg and you’ll find a chrome plugin called chromium.crx. Open up Chrome (or Chromium, which is what I use) and drag the file onto the Chrome window. You’ll see a warning:
Extensions, apps and themes can harm your computer. Are you sure that you want to continue?
Obviously we need that, so click ‘Continue’. That’s the Plugin installed.
Run Ripple
Now that we have everything set, we just need to run the Ripple server to make everything work together. This is documented on the BlackBerry site but it is slightly different here. The easiest way is to open a terminal and type in the following:
cd ~/ripple/services/node node ./node_modules/rbd/app.js 9910
This will fire up the Ripple server, and issue any logging to the terminal screen. Keep it open while you want to use Ripple.
Fix directory Permissions
Because this is a Windows shop, there’s a slight bug with the file permissions where the Ripple sites will live. In another terminal window issue the following command:
chmod 755 ~/RippleSites
Test the Service
Now we can use the plugin. In the Chrome browser, clear the omnibar and type in the following address:
localhost:9910
If you see a page like the following, then everything is working!
All Finished!
That’s it – you’re all done. All you need to do now it copy your HTML files that you are working on into the RippleSites folder and then access them through the localhost we used above.
So if your WebWorks app is in RippleSites/MyApp/index.html – you need to access http://localhost:9910/MyApp/index.html in the browser. Here’s an example showing the plugin working.
Once you press the Ripple button, you’ll see all sorts of nifty things that you can do – but the best bet is to play with it and read the documentation from here, as it will be working exactly as it would on Windows or Mac.
Enjoy the programming!