I'm writing a gem, that includes a C extension. Usually when I write a gem, I follow a process of TDD, where I'll write a failing spec and then work on the code until it passes, etc etc...
With my C extension in "ext/mygem/mygem.c" and a valid extconf.rb configured in the gemspec's "extensions", how do I run my specs and still have my C extension loaded? When I make changes to the C code, what steps do I need to take to recompile the code?
This is probably a stupid question, but typing 'bundle install' from inside my gem's development source tree does not build any native extensions. When I manually run ruby ext/mygem/extconf.rb
I do get a Makefile (in the root of the whole project) and when I then run make
, I do get a shared object (again, in the root of the whole project). I must be following the wrong workflow, since I understand that the .so is supposed to be placed under lib/. Unless I'm just supposed to do that by hand during development?