Ruby and Her Gems
Ruby depends on many of her friends which she lovingly refers to as her precious little "gems". A gem is nothing but a ruby code which we extract for later use. "Gemfiles" are the files which we create and use for describing the dependencies of a ruby program on the gems. This Gemfile in turn is treated and evaluated as a ruby code. Ruby likes to keep her friends close and Gemfiles help her do that.
The gemfile must always be present in the root of the project directory. "Bundler" is a manager for Ruby which installs the exact gems and their versions when required. All one needs to do is execute just one commands bundle install from the root of the project directory and voila!, Ruby has been reunited with her gems. Once this is done, a file named "Gemfile.lock" gets created which records the exact versions of the gems which were installed. This file can then be reused later to conform to the same specifications.
The first thing one needs to do is inform the Gemfile where it needs to look for the required gems. This is called the source and it must be a valid Rubygems repository. The most used one is https://rubygems.org. RubyGems.org is maintained by "Ruby Together" which is a grassroots initiative committed to supporting the Ruby infrastructure. The name of the gems which are required and then specified in the file. It is also possible to give the version & source details of each gem too.
Ruby is really effective when she is alone but when she teams up with her gems, she gets added enthusiasm which really kicks up her productivity.
Well written...Good attempt to explain the intricacies of the programming language in the form of a simple and interesting story... Keep up the good work!
ReplyDelete