You are viewing outdated content for BUG. If you have a BUG Y.T. edition or 2.0 series device, please visit our updated wiki: http://wiki.buglabs.net



Develop with Ruby

From BUG Wiki

Jump to: navigation, search

Overview

As of BUG release R1.4, Ruby comes preinstalled on the BUG. Simply type ruby at the commandline:

root@bug:~# ruby --version
ruby 1.8.6 (2008-08-08 patchlevel 286) [arm-linux-eabi]

As of R1.4.3, there are no custom BUG APIs for developing in Ruby. However all of the BUG web services can be called from an HTTP client.

Ruby Gems

R1.4.3 does not include Ruby Gems and the version of Ruby installed has issues that will prevent you from installing Ruby Gems. There is a new version of Ruby in our extras repository. What follows are the commands needed to install the newer Ruby package and Ruby Gems. For more detailed instructions, you can look at this blog post

First install the extras repository if you don't have it already:

root@BUG:~# wget http://repo.buglabs.net/ipkg-extras.conf -O /etc/ipkg/ipkg-extras.conf  
root@BUG:~# ipkg update  

Then update Ruby

root@BUG:~# ipkg install ruby

Verify that you have the new version of Ruby installed. It should be patchlevel 399:

root@BUG:~# ruby --version
ruby 1.8.6 (2010-02-05 patchlevel 399) [arm-linux-eabi]

For compiling gems with native extensions (like serialport), you'll need gcc, binutils, make, etc. All these can be installed at once by running:

root@BUG:~# ipkg install task-poky-sdk  

Next, install Ruby Gems. Go to the downloads page to check for the latest version:

root@BUG:~# wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.6.tgz  
root@BUG:~# tar xvzf rubygems-1.3.6.tgz  
root@BUG:~# cd rubygems-1.3.6  
root@BUG:~# ruby setup.rb install  

You can now get rid of the Ruby Gems install files:

root@BUG:~/rubygems-1.3.6# cd ~
root@BUG:~# rm -rf rubygems-1.3.6
root@BUG:~# rm rubygems-1.3.6.tgz 

And now you're good to go:

root@BUG:~# gem --version
1.3.6