0

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:

  • add gem 'sinatra' to the gemfile
  • use add_runtime_dependency instead of add_dependency
  • require 'rubygems' on top of my gemspec file

1 Answers1

0

TL;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.

Aleksei Matiushkin
  • 119,336
  • 10
  • 100
  • 160
  • I thought `--local` was used to specify the path to the local file. Thank you, you have no idea how much time I was stuck on this! I love you! – user7930453 Apr 27 '17 at 11:21