How does Bundler know how to use a specific gem version?

I noticed that there exists a habit of tagging version releases of gems. This way, I could understand that bundler would try to checkout a specific tag, and try to build that specific gemspec.

But, however, I also found out the gem-release gem from Sven Fuchs. I would have expected that the bump commands are creating tags for each version of a gem. However, all that I see happening is a modification of the version.rb file ( no tags are being created ). Could you shed some light on what exactly happens when I say:

gem "some_gem","0.0.1"

and what happens when I say:

gem "some_gem","0.0.2"

How is bundler installing them? What if instead of the above commands ( assuming that I cloned the gem's repo ), I write:

gem "some_gem","0.0.3",:path => "~/some/path"

How would the correct gem version be used now?

Answers


Bundler by default gets its gems from http://rubygems.org/, not from Github. Rubygems has the actual released versions when an author actually releases them.

If you tell bundler to install from a git address, eg. with :git => "git://github.com/svenfuchs/gem-release.git", or github with :github => "svenfuchs/gem-release", it will actually get it from the repository.

If no other options are specified, bundler will get the latest commit (the HEAD) on the default branch (master). In this case, bundler considers the version to be the commit hash. Similarly if you specify the :branch option, it just uses a different branch.

If you specify a version, it finds the tag which matches the version you request. You should know that tags are not part of commits. A tag in a git repository is a pointer to a commit. You can find all the tags by browsing for them at https://github.com/svenfuchs/gem-release/tags.

You will notice that the tag v0.4.1 refers to the commit hash 34f563bd294c2..., which links to the commit. However, because the tag is not part of the commit, you will not see the tagging action in the commit itself. You will only see that the tag refers to that commit.


Need Your Help

wrong use of class?

php image file upload

there occured a suspect problem during my image upload, i´ll show you:

How to setup durandaljs with Areas?

single-page-application durandal

For the life of me I can't make durandaljs work with Areas. I'm developing an application with multiple mini SPAs, but I'm not sure how to set up durandaljs to work with it. I wasn't able to find

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.