WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: installing ruby class library  (Read 3265 times)

Offline herrMnnn

  • Newbie
  • *
  • Posts: 33
installing ruby class library
« on: April 13, 2012, 03:46:16 AM »
Apologies in advance for the noob post.  I'm not sure if I should be posting this here or at a Ruby forum somewhere.

I want to use a Ruby program I found to access Modbus RTU data over RS485.  I can't post links but google "Tiny Modbus Master in Ruby".

I've installed Ruby in TinyCorePlus, seems to work fine. 

However the program requires the Ruby-serialport class to access the serial ports, and I can't work out how to install that in TinyCore.

There is a Ruby-serialport.rb file in the  files I downloaded - can this just be copied into the appropriate directory (I'm guessing not otherwise why is there an install gem?)  It only requires "serialport.so" which I can't see in the downloaded files.

The Ruby-serialport web page says to install using $ gem install ruby-serialport, but I can't find out how to install Gems in TinyCore.
 
I found a reference to a rubygems.tcz here on this forum but can't find it in the mirrors on my TinyCore installation.

I've been going around in circles for hours.  Can someone point me in the right direction?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14791
Re: installing ruby class library
« Reply #1 on: April 13, 2012, 04:19:16 AM »
I'd guess you could copy the Ruby-serialport.rb file to /usr/local/lib/ruby/1.8/ and things might work - however you'd probably need to manually download/compile serialport.so to /usr/local/lib/ruby/1.8/i686-linux/ rather than use gems.
« Last Edit: April 13, 2012, 04:23:34 AM by Juanito »

Offline herrMnnn

  • Newbie
  • *
  • Posts: 33
Re: installing ruby class library
« Reply #2 on: April 22, 2012, 09:41:53 PM »
I'm still having trouble with this.  Manually compiling seems beyond me so I've tried to get it working using gems as follows:


I installed Ubuntu on my laptop, and managed to install ruby-serialport via the gem with no problems.

I need to get this running on an old P3 desktop though. I  REALLY want to get it running on Tinycore from a USB stick so I don't need a hard drive on that unit.

So far I've done this:

Install Ruby.tcz using AppBrowser.  I installed the Ruby-dev.tcz as well in case it was necessary.

Download the Rubygems zip file from the ruby forge site.

Unzip the file and Install rubygems via

    sudo ruby setup.rb


Download and install ruby-serialport via

    sudo gem install ruby-serialport

This failed first time, and after searching this forum for an answer to the missing terios.h file did this:

Using AppBrowser install compiletc.tcz

tried again, more errors so installed serialport.so using
   sudo gem install serialport

more errors - extract from install log file as follows....

make install
/usr/local/bin/install -c -m 0755 serialport.so /usr/local/lib/ruby/gems/1.8/gems/serialport-1.0.4/lib
make: /usr/local/bin/install: Command not found
make: *** [/usr/local/lib/ruby/gems/1.8/gems/serialport-1.0.4/lib/serialport.so] Error 127


What am I missing?  There is no file called install in /usr/local/bin.

Also, gems command didn't seem to be available after a reboot - is it actually possible to install gems in TinyCore like this, or am I chasing my tail?

I've spent hours searching and trying different options.  If I can't find an answer here I'm going to have to give up on TinyCore for this project, which is really disappointing.  I am a big fan of the concept, but if I can't install the software I need I have no choice.

NB Once this project is running I won't even need a GUI - just boot to command line, schedule (using cron) the ruby program to retrieve data from the modbus device and save it to a text file, then retrieve the text file via ftp where it will be converted and input into a windows only program for analysis and display.

Any help would be greatly appreciated....

EDIT - after posting this decided I might have another read of the WIKI on creating Tinycore extensions. It still seems beyond me for now, but I came across the reference to the coreutils extension. Installed this and all gem packages installed error free  :)

« Last Edit: April 22, 2012, 09:57:36 PM by herrMnnn »