From: Rein Henrichs Date: 2010-06-11T16:35:08+09:00 Subject: Re: creating a gem structure for command line program On 2010-06-11 00:15:24 -0700, R.. Kumar said: > I've written a command line program. Would like to distribute it as a > gem. > I've run jeweler and generated a structure. > > However, I am not sure how to go about it. My project consists of one > main file (lets call it main.rb), it include a couple other files. The > main file is executable, so when installed should go into the path (e.g. > /opt/local/bin). > > Should my main file go into "lib" or "bin"? > > Looking at jeweler itself, i see a file installed in > /opt/local/bin/jeweler that loads jeweler, it says its been generated by > rubygems. How is this done? > > I presume the support files should go into lib/. > > Also, currently I do the argument parsing (optparse) in a if __FILE__ = > $0 block in the main file. Will this have to be moved to a method in the > class of the main file. Or will this have to be moved to a file in bin > folder? > > thx for help. Put your executable in bin/ and any supporting code in lib/ Rubygems will take care of distributing your executable in the way you mentioned, you don't have to do anything except add it to the gemspec. -- Rein Henrichs http://puppetlabs.com http://reinh.com