
On Windows
We have pushed the CUBRID Connector to Gemcutter. Use the above command (gem install cubrid) in the command line to install the latest version of Ruby Driver for CUBRID on Windows.
On Linux
Linux users can also install the CUBRID Connector through gem. Remember to add -E flag when installing the gem with sudo like "sudo -E gem install cubrid". The -E flag is necessary to make sure sudo does not reset the user path where CUBRID Database has been installed.
What if I don't have Gem Installer?
On Windows
- Install Ruby 1.8.7. You can download it from RubyInstaller site at http://rubyinstaller.org/downloads/.
- Install DevKit. Most Ruby gems out there require the mingw compiler to build gems written in C. CUBRID gem has C codes as well, so DevKit is required to install the latest CUBRID gem. You can download the DevKit from the same RubyInstaller site at http://rubyinstaller.org/downloads/.
- In the command line navigate to the location where you installed the DevKit and initialize DevKit by typing the following command. This will generate the config.yml file to be used later in this Step. Your installed Rubies will be listed there (only those installed by a RubyInstaller package are detected at present).
ruby dk.rb init
- If necessary, edit config.yml file to include installed Rubies not automagically discovered or remove Rubies you do not want to use the DevKit with. This step is not required if you have installed Ruby from http://rubyinstaller.org/downloads/.
- Install DevKit by typing the following command in the command line. This step installs (or updates) an operating_system.rb file into the relevant directory needed to implement a RubyGems pre_install hook and a devkit.rb helper library file into <RUBY_INSTALL_DIR>lib ubysite_ruby.
ruby dk.rb install
For more information on DevKit, refer to http://github.com/oneclick/rubyinstaller/wiki/Development-Kit.
Before trying to install cubrid, make sure that the "make" and "gcc" commands are available in your command line. If not, add C:\DevKit\bin\ and C:\DevKit\mingw\bin\ to your PATH environment variable (we assumed DevKit is in C:\DevKit).
Install CUBRID gem by typing the following command.
gem install cubrid
On Linux
- Install Ruby 1.8.7 by typing the following command.
sudo apt-get -y install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby rubygems1.8
You can see that ruby1.8-dev package has also been installed. It is necessary to compile the C code of the gem. If you do not have ruby1.8-dev package already in your system, install it by typing the following command.
sudo apt-get install ruby1.8-dev
Create a symbolic link for ruby to be able to run ruby command from the terminal.
sudo ln -s /usr/bin/ruby1.8 /usr/bin/ruby
Install CUBRID gem by typing the following command. Do not forget to add -E flag after sudo to include the path to CUBRID.
sudo -E gem install cubrid
Here is a test_cubrid.rb file to see if CUBRID driver is correctly installed. Run the following command to execute the code:
ruby -rubygems test_cubrid.rb
Note: If you don't want to use "-rubygems" attribute, then you must copy the cubrid.so file from C:\Ruby187\lib\ruby\gems\1.8\gems\cubrid-0.65\ext to C:\Ruby187\lib\ruby\site_ruby\1.8\i386-msvcrt (the paths may vary according to your ruby installation).