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

Advertisements

0 Responses to “ruby gem creation”



  1. Leave a Comment

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


Blog Stats

  • 221,294 hits

%d bloggers like this: