10. Supporting Software

The gemwhich script works much like the unix shell ‘which’ command. Given a include file reference, it will locate that file in ruby libraries and gem repositories and display the file path for the file.

For example, if you would like to know where the rake/testtask file might be located, just type:

$ gemwhich rake/testtask
/usr/local/lib/ruby/gems/1.8/gems/rake-0.4.15/lib/rake/testtask.rb

gemwhich will work with regular (non-gem) Ruby libraries as well.

$ gemwhich socket
/usr/local/lib/ruby/1.8/i686-linux/socket.so

Usage

gemwhich -- Find the location of a library module.

Usage: gemwhich [options] libname...
    -v, --verbose       Enable verbose output
    -h, --help          Display this help message

(new in version 0.9.0)

The gemlock script will generate a series of require_gem commands that will lock down an application or library to a particular version of their dependent gems.

For example, if you wish to lock down a particular version of the Rails library, use:

  $ gemlock rails-1.0.0
  require "rubygems" 
  require_gem 'rails', '= 1.0.0'
  require_gem 'rake', '= 0.7.0.1'
  require_gem 'activesupport', '= 1.2.5'
  require_gem 'activerecord', '= 1.13.2'
  require_gem 'actionpack', '= 1.11.2'
  require_gem 'actionmailer', '= 1.1.5'
  require_gem 'actionwebservice', '= 1.0.0'

gemlock will find all the direct and indirect gems required by rails-1.0.0 and specify the most recent, currently installed version of those gems. The output should be place in the application (or library) will it will be run before any other require statement in the program.

If your application depends on more than one gem, just list all the gems in the command line and gemlock will display the locking commands for all of them.

Usage

  Usage: bin/gemlock [options] GEM_NAME-VERSION...

  Where options are:
    -v, --verbose                    Verbose output
    -s, --[no-]strict                Fail if unable to satisfy a dependency
    -h, --help                       Show this message
    -V, --version                    Show version