mikegreiling
mikegreiling

Reputation: 1161

Packaging Compiled Binary /w a Ruby Gem

I am creating a small daemon, written in Ruby, which relies in part on a small binary utility compiled from C code. I want to package this as a gem and include this dependency along with it.

Essentially, this daemon will need to run commands such as ip addr add ... without requiring sudo, so I created a small C program to proxy those commands which must be compiled, chowned to root, and have the setuid bit set.

I would like to have the gem compile and install this dependency along with the daemon, but I am unsure how to do so. I understand extensions can be compiled via extconf.rb, but that is specifically meant for managing Ruby extensions, right? Would it be an ugly hack to have this compile and install a binary to /usr/local/bin or similar?

Does anyone know of an existing gem which does a similar thing which I can study as an example?

Upvotes: 3

Views: 426

Answers (1)

Brad Wheel
Brad Wheel

Reputation: 471

Here's a gem that packages the pdftk binary.

https://github.com/charliemaffitt/pdftk-heroku

Upvotes: 2

Related Questions