Description
Golden is a development tool that makes it easier to wrap Go libraries for use in Ruby.
Features
- Usage similar to the every day package manager
- Converts .go files to .so shared libraries
- Manages library exported function metadata in convenient JSON format
- Update notifications as of 0.6.1 - If you have a version prior to 0.6.1, update now to be notified when future updates are pushed to rubygems!
Usage
Building a slightly modified version of the "libsum.go" example
package main
import "C"
//export add
func add(a int, b int) int {
return a + b
}
//export subtract
func subtract(a, b int) int { // as of 0.5.2 this shorthand parameter declaration is supported!
return a - b
}
func main() {}
On the command line:
cd libsum
golden build libsum
cd ../golden-example
golden install libsum
Additionally, as of version 0.6.0, you can add libraries built manually or shared by another developer with the add
command:
golden add path/to/library/directory
or
golden add path/to/library/directory/golden.json
Then, reference the library in your ruby project:
require "golden"
class GoldenExample
def initialize
libsum = Golden.require("libsum")
puts libsum.add(1,2) #prints 3
end
end
Installation
From rubygems:
[sudo] gem install golden
or from the git repository on github:
git clone git://github.com/gmikeska/golden.git
cd golden
bundle install
rake install
License
Golden is covered by the BSD license, also see the LICENSE file. The specs are covered by the same license as ruby/spec, the MIT license.