Archive for the 'gem' Category


quick tip:uninstalling a specific version of a ruby gem

I had two version of ParseTree installed on my computer: 3.0.4 and 3.0.3. Here’s how I removed 3.0.4:

gem uninstall ParseTree -v 3.0.4


ruby gem creation

To create a ruby gem using the gem tool, you have to create a gem specification file, next to your sources :

specification = do |s| 	= "module_name"
	s.version 	= "0.0.1" 	= "geo"
	s.homepage  = ""
	s.has_rdoc	= false
	s.files	= ["script_file.rb"]
	s.summary	= "this is your description"

If you need a gem dependency, you can add some lines like the following :

s.add_dependency("some_gem",">= x.y")

where some_gem is the name of the gem ( like you would require it,ex: require “hpricot” ) and x and y are version numbers.

I think this is the minimum gem specification that works. To create the gem from the specification & sources, you need to run the gem command :

gem build gem_spec.spec

This will create a .gem file, that can be installed.

To install the gem, you run gem like this :

gem install gem_name.gem

Blog Stats

  • 215,481 hits