Reputation: 5345
I'm parsing Gemfile.lock to create a dependency graph. A sample of the file:
rack-ssl (1.3.4)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (3.2.22.1)
actionmailer (= 3.2.22.1)
actionpack (= 3.2.22.1)
activerecord (= 3.2.22.1)
activeresource (= 3.2.22.1)
activesupport (= 3.2.22.1)
bundler (~> 1.0)
railties (= 3.2.22.1)
rack (1.4.7)
It is a list of specs (gems which need to be installed for this project), followed by an indented list of that spec's dependencies. Because every dependency needs to be installed, they are all listed as specs somewhere else in the file. (E.G. rack is listed as a spec in the bottom of the sample, but is a dependency for two other specs near the top)
The one exception to this rule is bundler
, which is listed as a dependency but not as a spec. Why is this? Is it because gems already installed on a system level aren't included in the Gemfile.lock? Or is this a special case because bundler is the gem that generates Gemfiles, so it doesn't include itself?
Upvotes: 1
Views: 196
Reputation: 23327
If any of the needed gems are already installed, Bundler will use them. After installing any needed gems to your system, bundler writes a snapshot of all of the gems and versions that it installed to Gemfile.lock
https://bundler.io/rationale.html
It's bundler
that creates Gemfile.lock
and it's a list of all dependencies that are installed by bunler
. As bundler
does not install itself, it's not included. It makes it a special gem - the one that needs to be installed to bootstrap a ruby app.
Upvotes: 1