If you are having trouble getting a gem to run in your own gem here is a quick troubleshooting guide.
Is the gem you want to use showing up in your Gemfile.lock
? Your Gemfile.lock
file will display gems that are being called by your Gemfile
and your_gem.gemspec
. If the gem you want to use is not being shown here we will need to get it to show up here.
First, check your Gemfile
to see if the gem you want to be used has been put in this file.
Second, check your gem.gemspec to add_runtime_dependency
Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<gem_name>.freeze, [">= 0"])
end
The your_gem.gemspec
file is pretty much a readme for your gem, here is more info about gemspecs.
Third, make sure to require "gem_name"
in the file you want to use the gem.
This should allow you to use another gem in your gem.
Top comments (0)