libvirt-ruby

Access Libvirt's C Library through ruby bindings defined on the fly!


License
MIT
Install
gem install libvirt-ruby -v 2.0.0

Documentation

Libvirt::Ruby

Gem Version Build Status Dependency Status Coverage Status Code Climate

Installation

Add this line to your application's Gemfile:

gem 'libvirt-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install libvirt-ruby

Dependencies

This gem has as a dependency the libvirt package. Google it and u will find how to install it on your distro.

Usage

You may define pointers, callbacks and enums using the FFI gem. Since the main module of this gem extend it, you can call directly on it, just like:

Libvirt::Base.new.typedef :pointer, :pointer
Libvirt::Base.new.callback :virFreeCallback, [:pointer], :void
Libvirt::Base.new.enum :virStorageVolType, [:file, :block]

You should call the c function directly with the same name to attach it to the module:

Libvirt::Base.new.virConnectClose([:int])

The only parameter of the function should be an array passing as arguments all the variables that the c function needs and the return of the C function. After call the first time to attach, you can call the method on Libvirt::Ruby, passing this time the real values if needed.

Libvirt::Base.new.virConnectClose

Migrating to 2.0

To make easy developing on libvirt-ruby-mapping, the module ruby was changed to a class. And a class can't be named ruby, so it is necessary to replace all your calls from Libvirt::Ruby to Libvirt::Base.new.

Mantainers

@plribeiro3000

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request