I wanted to create a gem with some dependencies. I followed a tutorial, here is the full code.
I have
s.add_dependency "sinatra"
In the gemspec. I build the gem. When I tried to install it with
gem install --local gemname.gem
I got
ERROR: Could not find a valid gem 'sinatra' (>= 0) in any repository
I instead expected that gem install
will first install sinatra and then proceed with my gem.
How can I make it install any dependencies prior to my gem? I tried to:
gem 'sinatra'
to the gemfileadd_runtime_dependency
instead of add_dependency
require 'rubygems'
on top of my gemspec fileTL;DR:
gem install gemname.gem # NO --local switch
When given, --local
restricts all the actions to local domain, as clearly written in gem help install
output:
Local/Remote Options:
-l, --local Restrict operations to the LOCAL domain
That said, the above will succeed if and only sinatra
is already available in local.