Gem,RubyGems and bundler

gem is a packaged Ruby application or library.we can install, remove, and query gem packages using the gem command.RubyGems is the name of the project that developed the gem packaging system and the gem command.For gem installation information use the command “gem environment”

RubyGems doesn’t store the library files directly in standard library search path. It adds the necessary gem packages to the library seach path as needed at run time.This means that RubyGems must be loaded before any gem libraries are accessable.The most direct way to make RubyGems available is to just require it in the source code:

require ‘rubygems’
require ‘some_gem_library’

To explicitly use a particular version of a library, you need to use the gem method. This method specifies the name of a gem package and the version you wish to have loaded.For example, suppose your application uses RedCloth, but needs a version of RedCloth in the 3.x series. You can include explcitly in your code:

require ‘rubygems’
gem ‘RedCloth’, ‘~> 3.0’

Bundler makes it easy to make sure that your application has the dependencies it needs to start up and run without errors. First, you declare these dependencies in a file at the root of your application, called Gemfile. After declaring your first set of dependencies, you tell bundler to go get them:

$ bundle install

Bundler will connect to rubygems.org (and any other sources that you declared), and find a list of all of the required gems that meet the
requirements you specified.

source

http://docs.rubygems.org/read/chapter/1
http://gembundler.com/rails3.html

Follow klairvoyantinfo on Twitter

klairvoyant Infosolutions on LinkedIn

for klairvoyant

Advertisements
This entry was posted in rails, ROR, ruby on rails and tagged , , . Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s