Ruby through rails part 6: Bundler Dsl

What happens when you write ‘gemspec’ in your Gemfile? Learn some Ruby by understanding the Bundler DSL in this series of posts.


Earlier we seen detailed working of ‘gem'(present in Gemfile) command. For now, we are now going to introspect the working of ‘gemspec’ which we mostly used during building our rubygems. As i have mentioned in earlier serials that all command, which we used in Gemfile, found in the bundler file(lib/bundler/dsl.rb)

Let see how ‘gemsepec’ is used in gemfile.

Normally, when we write our rubygem, our directory name is the name of gem and gemspec found in same directory as “name_of_gem.gemspec”.

Let see the code of ‘gemspec’ defined in bundler(lib/bundler/dsl.rb).

Let understand above implementation with code example. Consider we have ‘dummy’ as rubygem.
Content of Gemfile of ‘dummy’ gem are:

As we do ‘bundle install’, then gemspec call without any options. Since we did not pass any options, default name, path, development_group get set as ‘.(current_directory)’, ‘{,*}’ and
‘development’ respectively. Line no 6 get ‘#{name}.gemspec’ file if name provided as nation…

View original post 159 more words

About Gautam Rege

Rubyist, Entrepreneur and co-founder of Josh-Software - one of the leading Ruby development shops in India.
This entry was posted in General. Bookmark the permalink.

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 )

Google photo

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

Twitter picture

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

Facebook photo

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

Connecting to %s