test
Joe Robinson authored
f84375e1
Name Last commit Last update
README.md
blaunits.rb

blaunits

(aka blaconvert v2)

This is a ruby script for converting between two units. It's a wrapper around GNU Units, with a simpler syntax designed for use in IRC.

It was written as a replacement for 'blaconvert', which served the same function, but used the now deprecated Google conversion API. Rather than using a remote API, it uses the GNU units program on the local system.

It should work with any units in the GNU units database, including currencies. There may be some unexpected behavious with capitalisation.

Currency conversion rates are updated with the 'units_cur' program. It is recommended to run this daily with a cron job.

Usage

ruby blaunits.rb [amount] from-units to-units

e.g

ruby blaunits.rb 10 cm inches

The amount can also be ommited to get the basic conversion rate

e.g

ruby blaunits.rb GBP USD

For units made up of more than one word you'll need to separate them with "to" or "in"

e.g

ruby blaunits.rb US pints to fluid ounces

Installation

Install GNU units on your system. You may also need to run units_cur to initialise currency rates

Linux

Should be available in any Linux distro's package manager, probably as 'units'

OS X

OS X includes an older version of units which is incompatible with blaunits. A compatible version of GNU units can be installed from homebrew, but the binary will be named "gunits".

Rename the reference on line 4 to gunits

Windows

vov

Test