Ruby-usb gems

Posted by aslak.hellesoy

I’ve packaged ruby-usb as gems, available both for Windows an *nix/linux/os x

gem install ruby-usb # On *nix/linux/os x you must first install Lib-USB

At one of the projects in BEKK we bought a Betabrite Prism sign to display the status of builds. Getting the Betabrite Gem to work via USB on Windows was a bit of a challenge. I got around it, so I’d like to share it with others.

The first hurdle was to get Ruby-usb to work on Windows. Ruby-usb is a Ruby library that uses the Lib-USB C library. Ruby-usb wasn’t available as a binary gem (with compiled C extensions), so I figured I had to make one myself. Luckily there is a Windows port of Lib-USB, and I decided to try to build Ruby-usb’s C extensions against that library.

After a lot of reading and trial and error I finally realised I had to build Ruby-usb’s C extensions with MinGW and MSYS. I even had to build Ruby itself with MinGW/MSYS in order to get rbconfig to work. These tools are great alternatives to Cygwin, as they produce “pure” win32 binaries.

With a working Ruby-usb gem for Windows I tried out the Betabrite gem, and found a little bug that has now been fixed.

So I ended up having to fork Tanaka’s original Ruby-usb project. The code is on Gitorious and the Gem on Rubyforge. Forking is something I hate to do, but I haven’t been able to get in touch with Tanaka, and it seemed like the only way to publish Ruby-usb as gems.

Comments

Leave a response

  1. Luis LavenaMarch 31, 2008 @ 03:35 AM

    Great release Aslak!

    I should buy one of those Betabrite displays, like the idea, need to know if it will work with CC.rb

    BTW, Good to know MinGW+MSYS was simpler then standard build of Ruby, we are heading to it:

    http://blog.mmediasys.com/2008/03/29/progress-of-one-click-installer-rubyinstaller/

  2. The HammerMarch 31, 2008 @ 04:26 AM

    This is great news. Glad to hear about the gem. Have you seen Radiator (http://www.somethingnimble.com/bliki/radiator)? I think we’ve done something similar. The current version even uses Aaron Patterson’s Betabrite library. And a CC.rb plugin is included. Would be excited to learn that it works now on Windows as well.

  3. Luis LavenaMarch 31, 2008 @ 06:38 PM

    Hey, I missed that news bit!

    I think I’m ready to order some betabrites and do cool things with these things, inside and outside the CI stage :-)

    Thank you for the link “sledged” Hammer? :-)

  4. ocApril 03, 2008 @ 12:24 AM

    Great job! Can’t wait getting on my (forced) windows workstation :-)

  5. GHJansomApril 17, 2008 @ 03:40 PM

    Hello

    Needing to spend some finance in jewelry wall boxes will you guys, know of any honest online jewelry websites?

    Many Thanks