Login Register Actian.com  

Actian Community Wiki

Navigation
Learn About
Developing With
Ingres Talk
Information
Toolbox

Ruby/Projects/Gem Package

From Ingres Community Wiki

Jump to: navigation, search

Contents

Introduction

This project will look at better ways to distribute and install the Ingres Ruby driver and Ruby on Rails (RoR) adapter.

Current Situation

Obtaining, building and installing the Ingres Ruby and RoR adapter is an onerous task that could be simplified in to a single step. The current process goes like this for Linux/UNIX

  1. download the source code from http://esd.ingres.com/product/drivers/Ruby_on_Rails
  2. unpack the source code
  3. cd to unpacked directory
  4. build the Ruby driver using ruby extconf.rb && make
    1. Making sure $II_SYSTEM is defined
  5. install the Ruby driver using sudo make install
  6. enter password prompted
  7. copy ingres_adapter.rb to ${GEMDIR}/activerecord-x.x.x/lib/active_record/connection_adapters/
    1. Where x.x.x is the version of activerecord/rails currently installed

Each time Rails is updated the last step has to be repeated to make sure the new version of activerecord can access Ingres.

Proposal(s)

User View

Using RubyGems it's possible to combine the above 7-8 steps into a single command:

gem install activerecord-ingres-adapter

This one command would:

  • download the activerecord-ingres-adapter from http://rubyforge.org
  • lay the files down in ${GEMDIR}/activerecord-ingres-adapter-x.x.x
  • Add ${GEMDIR}/activerecord-ingres-adapter-x.x.x/lib to the list of required library directories
  • compile the Ruby driver
    • assuming $II_SYSTEM is defined
    • install the driver into the correct location
  • Build the documentation

Developer / Maintainer View

The traditional way to define what is contained within a gem is to use the Gem Specification. E.g.

spec = Gem::Specification.new do |s|
    s.name = 'example'
    s.version = '1.0'
    s.summary = 'Example gem specification'
    ...
end

Once you have your gemspec you generate the gem using following command:

gem build

and out pops the generated gem

Since the original Gem Specification was developed a number of gems have been developed to improve upon the original specification to provide the following features:

Test Gem

A test gem based on 1.4.0 is available for download from http://dl.dropbox.com/u/2191213/ruby/activerecord-ingres-adapter-1.4.0.gem. Since this gem builds the driver you will need a C compiler and an Ingres environment

Personal tools
© 2011 Actian Corporation. All Rights Reserved