From: dusty Date: 2008-12-15T04:47:40+09:00 Subject: Re: Command line utilities in rubygems? On Dec 14, 2:14 am, Ch Ba wrote: > One more quick question if you don't mind, I had been executing the > executable from the base directory of the project, and using "require > 'lib/foo.rb'. Obviously this no longer works, how would I access > "foo.rb" in it's new location after it is installed through a gem? > Sorry, I'm new to this whole gem thing =) > -- > Posted viahttp://www.ruby-forum.com/. In the spec we have: s.require_path = "lib" s.autorequire = "some_gem" So, when you require rubygems, it will know how to find your new gem. Then, when you require 'some_gem', it will look in the require_path based off the root of your gem and automatically require some_gem.rb. In this case it would be lib/some_gem.rb. So, in the executable, you can simply require your gem. Here is an example of what the executable could look like, assuming you have a class method called do_something that is doing what you need. #!/usr/bin/env ruby require 'rubygems' require 'some_gem' SomeGem.do_something