[Rubygems-developers] Thoughts on handling bin and man files

Richard Kilmer rich at infoether.com
Fri Mar 19 11:25:18 EST 2004


On Mar 19, 2004, at 11:22 AM, Chad Fowler wrote:

> $ rake  # runs rake out of a directory that's normally in the path
> $ gem --run rake --version 0.3.0   # runs a specific version of the 
> rake
> executable from its gem directory

Hm...this creates an interesting issue.

if you run the 'rake' script it would normally have:

   require 'rake'

at the top of the script...this is bad...because if you just run this 
script the gem for rake has not been loaded.

if this changes to...

   require 'rubygems'
   require_gem 'rake'

...then this executable script is dependent on RubyGems, which limits 
its usability outside of RubyGems (as a .tar.gz).

now, what if the installed 'rake' executable was generated by our gem 
installer that would have:

   require 'rubygems'
   require_gem 'rake', "= 0.3.0" #=> or whatever version of the gem this 
was generated for.
   load 'bin/rake'  #=> or whatever the binary that this is referring to 
is.

then we would effectively be 'wrapping' the 'rake' executable script.  
Also, we could generate at .cmd on Win32 instead of a chmod +x script 
file.  As well, its easier to identify these for removal upon gem 
uninstall.

Thoughts?

-rich



More information about the Rubygems-developers mailing list