I’m developing a library that includes a C extension, so during
development I need to keep re-compiling the extension before testing.
I’m using Hoe for packaging, so I’ve added the following task to my
Rakefile.rb which allows me to rebuild the extension using extconf.rb/
make. My library has a further dependency on an external C library
(libR), at the moment this is semi-hardcoded into the script by
referencing the environment variable R_HOME:
desc “Uses extconf.rb and make to build the extension”
task :build_extension do
system(“ruby extconf.rb --with-R-dir=$R_HOME”)
Two questions (I’m pretty new with Rake/Hoe so forgive me if these
The ‘build_extension’ task works fine, but seems a little hacky,
how do other people build extensions with Rake/Hoe?
Can I retrospectively add this task as a dependency of the ‘test’
task, so that when I run my tests I can ensure the library is freshly