I a new to ruby, have followed a tutorial to create a gem, and how to use bundler. But I have seen many times when installing a gem that dependant gems are automatically installed … how do I do that? I have tried bundling my Gemfile with the gem package which did nothing. Have also tried requiring “bundler/setup” in my script, which did not work either. How do I go about this?
Share
You are correct you specify dependencies in the gemspec. You should specify both runtime and development dependencies.
One word of caution: If you are building a gem and using
bundler, your Gemfile should only contain the followingFor more info, especially if this is your first time developing a gem you should take a look at yehuda’s post on the subject. Also take a look at the docs
The basic idea, is that bundler will only install gems as specified by your gemspec. This way you only keep your dependencies in one place. This also ensures that bundler isn’t using a lockfile, which can be important to ensure you remain compatible with dependent gems.