Now you can take any library or Rails plugin or command line
application, gemify it, and easily share it with the Ruby world.
With gems you get in-built version support (you can specify which
version of a gem you want when you use it via the require_gem method),
an encapsulated, consistent folder structure for your bin/lib/test
folders, and you get cross-platform support for bin apps. Too much
niftiness to ignore, really.
The New Gem Generator is like the rails command for rails applications,
but it creates the folders and starting files for a new gem. Itâ??s called
newgem.
Installation
gem install newgem
Create new gem
newgem map_by_method
creating: map_by_method
creating: map_by_method/CHANGELOG
creating: map_by_method/README
creating: map_by_method/lib
creating: map_by_method/lib/map_by_method
creating: map_by_method/lib/map_by_method.rb
creating: map_by_method/lib/map_by_method/version.rb
creating: map_by_method/Rakefile
creating: map_by_method/test
creating: map_by_method/test/all_tests.rb
creating: map_by_method/test/test_helper.rb
creating: map_by_method/test/map_by_method_test.rb
creating: map_by_method/examples
creating: map_by_method/bin
And away you go. The rest of the tutorial and comments are at:
http://drnicwilliams.com/2006/10/11/generating-new-gems/
I hope this encourages you to share more code with others (both outside
and inside your own workplace).
Nic
This is great. You’re cooking up one sweet Ruby library after another.
Calling it “gemify” isn’t an option? Sounds sweeter.
Robert MannI wrote:
This is great. You’re cooking up one sweet Ruby library after another.
Calling it “gemify” isn’t an option? Sounds sweeter.
Unfortunately all voting on project names happens before the project is
released. That is, I voted alone between: newgem, gemnew, new_gem,
gem_new. You get the jist of my unimaginative options.
I like gemify as a command name though. Perhaps I’ll add it in the bin
folder as a duplicate, just for you 
Nic
A new version will come out soon that will include the setup.rb file in
the generated gems
http://i.loveruby.net/en/projects/setup/
I never knew it existed, but if your users can’t type the words “gem
install ” then running the setup.rb script for your library
will make them very happy.
Nic
hi friends,
i need help on creating a gem. Am following the Dr. Nic tutorial
“http://drnicwilliams.com/2006/10/11/generating-new-gems/#newgem_remote”
i started with installation of the new gem
step 1)—> gem install newgem
step 2)—> newgem
here it creates the folder successfully with the name i gave, n it
allows the manipulation which is required by me.
here comes my problem???
step 3)—> rake package
while creating a gem with the “rake package command”, I came across an
error saying “could’nt find HOME environment --expanding ‘~/hoerc’”
which is followed by number of error lines…
c:/ruby/lib/ruby/gems/1.8/gems/hoe-1.4.0/lib/hoe.rb:327:in ‘expand_path’
c:/ruby/lib/ruby/gems/1.8/gems/hoe-1.4.0/lib/hoe.rb:327:in ‘with_config’
c:/ruby/lib/ruby/gems/1.8/gems/hoe-1.4.0/lib/hoe.rb:363:in
‘define_tasks’
c:/ruby/lib/ruby/gems/1.8/gems/hoe-1.4.0/lib/hoe.rb:322:in ‘initialize’
./config/hoe.rb:50:in ‘new’
please tell me where iam going wrong!!!
Dr Nic [email protected] writes:
A new version will come out soon that will include the setup.rb file in
the generated gems
setup.rb
I never knew it existed, but if your users can’t type the words “gem
install ” then running the setup.rb script for your library
will make them very happy.
Nic
Thank you.