Didn’t really know how to title this. First time writing a gem so not sure about the best way to do it.
I am releasing a “Graphics” Ruby gem that uses a 2D Array class that I wrote. Which of the following 2 approaches is best?
- Put the 2D Array class in the gem. This is fine, but I will be updating the class and I don’t want to have a complicated process of updating it in one place and then copying the files into the gem and updating it.
- Release the 2D Array class as a separate gem, and have the Graphics gem depend on it. I guess bundler handles this dependency so it is easy for people to use…?
Are there any other reasons to choose one over the other? Which is the best practice?
Actually, your users don’t need bundler: rubygems itself handles the dependencies of gems, and yes it will be easy for people to use.
The choice between 1 and 2 is up to you. There will be some extra overhead involved to document and maintain two separate gems. If you know for sure that the 2D array class is useful on its own and you have other places where you want to use it, making two gems is a decent idea.