Tutorial by Examples

This guide assumes you already have Ruby installed. If you're using Ruby < 1.9 you'll have to manually install RubyGems as it won't be included natively. To install a ruby gem, enter the command: gem install [gemname] If you are working on a project with a list of gem dependencies, then the...
You can install a gem from github or filesystem. If the gem has been checked out from git or somehow already on the file system, you could install it using gem install --local path_to_gem/filename.gem Installing gem from github. Download the sources from github mkdir newgem cd newgem git clon...
To check if a required gem is installed, from within your code, you can use the following (using nokogiri as an example): begin found_gem = Gem::Specification.find_by_name('nokogiri') require 'nokogiri' .... <the rest of your code> rescue Gem::LoadError end However, this can ...
A Gemfile is the standard way to organize dependencies in your application. A basic Gemfile will look like this: source 'https://rubygems.org' gem 'rack' gem 'sinatra' gem 'uglifier' You can specify the versions of the gem you want as follows: # Match except on point release. Use only 1.5....
Sometimes you need to make a script for someone but you are not sure what he has on his machine. Is there everything that your script needs? Not to worry. Bundler has a great function called in line. It provides a gemfile method and before the script is run it downloads and requires all the necessa...

Page 1 of 1