Extending DrQueue / Ruby bindings howto

Note: If you want to use the bindings, it could happen that there are some incompatibilities between the current development branch and the current stable release. The Ruby bindings also use the Drqueue C library but there are some extensions in the sources which could be missing in the stable release. Always try to prevent mixing of different DrQueue versions.

The Ruby bindings are a requirement for DrQueueOnRails.

Software requirements: ruby-1.8.x, swig-1.3.x, scons-0.98+, git-1.5+

The Ruby bindings are now also available as a RubyGem which is hosted at http://rubygems.org/gems/DrQueueRubyBindings. This makes the installation much easier.

automated build process

1. Install RubyGems from http://www.rubygems.org

2. Run

gem install DrQueueRubyBindings

3. Try to load the module in Ruby.


irb(main):001:0> require 'drqueue'
=> true

manual build process

  1. Clone the Ruby bindings sources from Git:
    git clone https://ssl.drqueue.org/git/DrQueueRubyBindings.git
  2. Change into the ext directory:
    cd drqueue-rubygem/source/ext
  3. Generate SWIG wrapper and makefile:
    ruby extconf.rb
  4. If you get this error when you do try to generate swig wrapper you miss the ruby dev libary (ruby1.8-dev):
    extconf.rb:1:in @require': no such file to load -- mkmf (LoadError)
            from extconf.rb:1
  5. Build Ruby bindings:
  6. Install Ruby module:
    sudo make install
  7. Try to load the module in Ruby:
    irb(main):001:0> require 'drqueue'
    => true
  8. Now here is small test if drqueue is able to get a list of current jobs:
    irb(main):001:0> require 'drqueue'
    => true
    irb(main):002:0> job_list = Drqueue::request_job_list(Drqueue::CLIENT)
    => [#<Drqueue::Job:0x4522c>, #<Drqueue::Job:0x45204>, #<Drqueue::Job:0x451dc>, 
    #<Drqueue::Job:0x45178>, #<Drqueue::Job:0x45150>, #<Drqueue::Job:0x45128>]
    irb(main):003:0> job_list.each do |j| 
    irb(main):004:1* print j.name+" " 
    irb(main):005:1> end
    Haus box Test job Haus2 Testprjekt Mine3 => [#<Drqueue::Job:0x4522c>, #<Drqueue::Job:0x45204>, 
    #<Drqueue::Job:0x451dc>, #<Drqueue::Job:0x45178>, #<Drqueue::Job:0x45150>, #<Drqueue::Job:0x45128>]

example1.rb Magnifier - Example 1 (525 Bytes) Andreas Schröder, 07/11/2007 02:11 am

example2.rb Magnifier - Example 2 (853 Bytes) Andreas Schröder, 07/11/2007 02:38 am

example3.rb Magnifier - Example 3 (883 Bytes) Andreas Schröder, 07/12/2007 01:50 am

example4.rb Magnifier - Example 4 (698 Bytes) Andreas Schröder, 07/12/2007 01:50 am

example5.rb Magnifier - Example 5 (159 Bytes) Andreas Schröder, 07/12/2007 01:51 am