Ruby wrapper around the ifconfig command.
Ruby
#1 Compare This branch is 7 commits ahead of dudemeister:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ifconfig_examples
lib
test
.gitignore
COPYING
Changelog
INSTALL
README
Rakefile
TODO
ruby-ifconfig.gemspec
setup.rb

README

This is a Ruby wrapper around the ifconfig command.  The goal is to make
getting any information that ifconfig provides easy to access.

It was developed on Linux 2.6 with ifconfig from net-tools 1.60.  It also has
support for SunOS, Darwin and Open, Free, Net, and DragonflyBSD.  These have
not been thoroughly tested.  Non Linux platforms call netstat for interface
packet information

Please send me ifconfig / netstat output for platforms that don't work.

see test/*.rb for usage examples.

Thanks to Peter Johnson for the *BSD examples
Thanks to Jeremy Tregunna for Darwin and DragonflyBSD support

INSTALLATION
------------

Please see the INSTALL file for details of how to install Ruby-Ifconfig

TESTING
-------
> rake
to run all the unit tests.

Prerequisites
------

You must have a working ifconfig binary in your path.
The output format of you particular version of ifconfig must be supported.
Currently this has only been tested with net-tool 1.6 on Linux

Example
------
require 'ifconfig'

cfg = IfconfigWrapper.new.parse        # parses the output of ifconfig

cfg.interfaces           # returns list of interfaces

cfg['eth0'].addresses('inet')   # returns ipv4 address of eth0

cfg.addresses('inet')        # returns list of all ipv4 addresses

cfg['eth0'].status   # returns true if interface is up

cfg.each { block } # run a block on each interface object

LICENCE
-------

This software is offered under the GNU GENERAL PUBLIC LICENSE, a copy of which
is included.

Section 2, paragraph b and section 5 of the GNU General Public License does not apply when the Software (Ruby/Ifconfig) is included in the program Corgi.

--
Daniel Hobe
daniel@nightrunner.com