I’m pretty new to Ruby. I have put together a library of Ruby code for
interfacing with the web APIs of a crash reporting service
(HockeyApp), and a separate library of code for interfacing with the web
APIs of a usage & analytics service (Mixpanel).
Next, I’ve written a utility for our in-house metrics team that knits
together results from both of these service libraries, and packaged it
up with a command line interface as a gem, so that they can “easily”
install it (once they go through the enormous hassle of upgrading the
stock version of Ruby that ships on their machines).
Now I’m writing a second utility for a different department, which will
also utilize the two shared service libraries. I would also like to
package it up as a gem for easy deployment. I’m looking for some advice
as to the best practices for how to organize the code. Here is what I
hockeyapp_services.rb <-- common code to both gems
mixpanel_services.rb <-- common code to both gems
bin/ <-- the command-line interface part is here
… and in my gems, I reference the common code as follows.
Is there a cleaner way of sharing common library code across gems (and
referencing it from within the gems), or is this pretty good as it
stands? I’m not looking for perfection, just something that won’t slow
other Ruby developers down should they inherit the codeline.
Thanks for your help!