Get Ripple to work in Linux

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.

The Ripple installer extracts 2 folders

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.

The contents of the Resource1.zip file. We’re going to need this stuff…

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.

We’ve nearly got everything we need in the Ripple 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!

404 is usually a bad thing – but this means that the Ripple service is running correctly and that we can access it.

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.

Testing a BlackBerry 10 Dev Alpha with a basic index page is nice and easy!

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!

  • Pingback: Ripple Emulator Working on Linux

  • Pingback: Get Ripple to work in Linux - webdevelopmentbanglore.in

  • http://jumanjanet jumanja

    Greate tutorial but

    sudo apt-get -y install nodejs

    is the right line ? I am getting errors, not sure if the dot (.) is missing, or something, I only am getting node and node.exe in the folder, but no node.js.. it is supposed apt-get should find and download and install, right ? I am using fedore 16 and neither apt*get nor yum finds/download/install nodejs.. could you please give me some suggestions?.. thanks in advance

  • http://johnreid.it John

    Hi Jumanja,

    First of all, the node and node.exe files are Windows and Mac binaries – you can’t use them. If it makes it easier to understand, you can happily delete these files with no consequences.

    In Fedora – there is no node.js in the repository, which is why you can’t install it with the apt-get command.

    If you run this command:
    sudo yum localinstall --nogpgcheck http://nodejs.tchol.org/repocfg/fedora/nodejs-stable-release.noarch.rpm

    Then it should install. For more details, check out http://nodejs.tchol.org/.

    Good luck!

  • kanishkablack

    node ./node_modules/rbd/app.js 9910
    The “sys” module is now called “util”. It should have a similar interface.
    Segmentation fault

  • JohnSReid

    I’m not sure why you are getting the segmentation fault – as the error above is just a warning rather than an error.

    All I can suggest is finding the following line in 3 files and changing it:

    sys = require('sys')
    to
    sys = require('util')

    services/node/node_modules/picard/spec.js
    services/node/node_modules/picard/lib/picard/request.js

    And
    require('sys').puts('Starting in ' + this.env.mode + ' mode.n' +
    to
    require('util').puts('Starting in ' + this.env.mode + ' mode.n' +

    in
    services/node/node_modules/picard/lib/picard/server.js

    But honestly, I don’t think that will fix your problem.

  • http://www.richsage.co.uk/ Rich Sage

    Good stuff – thanks for this. I had to adjust the way I started it – it requires a command eg:

    node ./node_modules/rbd/app.js start 9910

    Except it appears that the command is subsequently trimmed inside app.js to lose the first character; not sure if this is just for a Windows quirk or something. Anyway, using eg “+start” instead worked a treat. Cheers!

  • http://twitter.com/diegodukao Diego Dukão

    Hey man. Thanks for the post, but I can’t make it work. When I run “node ./node_modules/rbd/app.js 9910″, I receive: “The “sys” module is now called “util”. It should have a similar interface.” and that’s it. It doesn’t start the Ripple service. I don’t get segmentation fault, though.
    I’ve managed to still the Ripple extension on Chromium and it works fine with pages servers, but I still can’t run pages at localhost. Do you have any idea of what I should do to try to make it work?

  • http://twitter.com/diegodukao Diego Dukão

    Finally got it! I’ve managed to run ripple server with the command:
    node ./node_modules/rbd/app.js -start 9910

    Almost like Rich’s solution, but with a “-” before “start”.
    Thanks again for the post, John.

  • kanishkablack

    hey i got it working fine now. its not the fault of the code, node.js went wrong

  • annuk

    Hi,

    Thanks for the post.

    I am running ubuntu 10.04.
    I installed nodejs from https://github.com/joyent/node.

    When i run the following command: ~/ripple/services/node$ node ./node_modules/rbd/app.js 9910

    It does not give me any error. But when i type localhost:9910 in my chrome it gives:

    Oops! Google Chrome could not connect to localhost:9910

    How would I know that the server has started.

    Regards,

    Annuk

  • kanishkablack
  • annuk

    Hi,

    Thanks for your reply..
    I did the following:

    node ./node_modules/rbd/app.js -start 9910
    and it is working now.

    Regards,

    Annuk

  • Iktwo

    Thanks for your post! I kinda got it work, I can see my application but I can’t do anything with it, somehow tapping a button doesn’t work, I tried on Windows and my application works fine, maybe I missed some configuration.. Any idea? Thanks!

  • JohnSReid

    So do you actually see the application on the screen?

  • J-Mal.com

    I ended up just using Ripple with the Chromium browser (Ubuntu 13.04). For some reason that worked perfectly. Also don’t use the Ripple version in Google Chrome app store. Get the latest beta version from the RIM/blackberry store.