Installation
Installing from a gem
gem install port
Manual installation – if you have rake.
rake
sudo rake install
To uninstall: sudo rake uninstall
Manual installation – if you do NOT have rake.
change directory to ext sub-directory.
ruby extconf.rb -> generates the Makefile.
make -> compiles the extension. Requires gcc .
copy port.so to:
/usr/lib/ruby/site_ruby/1.8/i386-linux
or another path in your ruby $LOAD_PATH .
Usage
If installed via gem:
require 'rubygems'
require 'port'
otherwise
require 'port'
will suffice.
Example
For an example run. time.rb as follows:
sudo ./time.rb
time.rb is in the example sub-directory. This requires root permissions to access the IO ports.
time.rb listing:
:include:example/time.rb
Who wrote port?
Port was written by Loh Siu Yin <[email protected]> as he needed to control external hardware devices and he wanted to do it from ruby.