简体   繁体   中英

Gemspec resolve dependencies

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM