Archive for the 'gem' Category

27
Nov
09

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

Advertisements
28
May
09

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 = Gem::::Specification.new do |s|
	s.name 	= "module_name"
	s.version 	= "0.0.1"
	s.author 	= "geo"
	s.homepage  = "https://ssscripting.wordpress.com"
	s.has_rdoc	= false
	s.files	= ["script_file.rb"]
	s.summary	= "this is your description"
end

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

  • 225,275 hits