Part 5: Ruby Through Rails — Bundler Dsl

In this post, Sanjiv explains what happens under the hood when we do “bundle install”. While learning in detail about how are gems loaded, we learn a few useful Ruby tips and tricks and see some meta-programming at it’s pristine best!


Note: All path are relative to bundler gem path. For these blog, i am currently using ruby 2.1.2 and bundler 1.6.3.

While going through Bundler source code earlier, we have seen how bundler evaluates the Gemfile and creates function for each of keyword like gem, source and etc. Now we are going to see the implementation details of a few of these functions. Here is the `gem` function.

The `gem` function accepts one mandatory parameter – the name of the gem and other parameters is an array (called splat parameters). These can be any of :version, :git, :github, :platforms, :source or :group. The * operator (pronounced “star,” “unarray,” or, among the whimsically inclined, “splat”) does a kind of unwrapping of its operand into its components, those components being the elements of its array representation. This function first checks if gem name is provided as symbol and if it is, it throws an exception. The…

View original post 956 more words

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.