Note that there are some explanatory texts on larger screens.

plurals
  1. POAvoiding redundant Bundler dependency declarations for Rack
    primarykey
    data
    text
    <p>Imagine a Rack application that, on startup, creates instances of some other Ruby applications and maps routes to those applications. This application has a Rack dependency of 1.2.2.</p> <p>Now imagine we're developing a sub-application which will be run by this application. It has a Sinatra dependency of 1.2.6 and uses Bundler. It's gemfile is a barren:</p> <pre><code>source "http://rubygems.org" gem "sinatra", "1.2.6" </code></pre> <p>Unfortunately, when we <code>bundle install</code> this sub-application, Bundler, with no knowledge of the Rack 1.2.2 dependency of the parent application, will install the most recent version of Rack that is compatible with Sinatra 1.2.6: currently 1.3.2. Our Gemfile.lock will be:</p> <pre><code>GEM remote: http://rubygems.org/ specs: rack (1.3.2) sinatra (1.2.6) rack (~&gt; 1.1) tilt (&lt; 2.0, &gt;= 1.2.2) tilt (1.3.2) PLATFORMS ruby DEPENDENCIES sinatra (= 1.2.6) </code></pre> <p>When we try to start the parent application (which starts our sub-application), we'll get:</p> <p><code>You have already activated rack 1.2.2, but your Gemfile requires rack 1.3.2. Consider using bundle exec. (Gem::LoadError)</code></p> <p>What is the correct way to handle this situation? Yes, we could explicitly require rack 1.2.2, but we'd effectively be stating a dependency of a dependency. I'd imagine that, ideally, the parent application would be a gem which our sub-application would require, but in this situation, we don't have the ability to make it so.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload