# \[ANN\] newgem - Create gems for your libraries and apps

**URL:** <https://www.ruby-forum.com/t/ann-newgem-create-gems-for-your-libraries-and-apps/71784>\
**Category:** Ruby\
**Created:** [October 11, 2006, 1:23pm UTC](https://www.ruby-forum.com/t/ann-newgem-create-gems-for-your-libraries-and-apps/71784 "2006-10-11T13:23:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicwilliams](https://www.ruby-forum.com/u/nicwilliams)\
**Post date:** [October 11, 2006, 1:23pm UTC](https://www.ruby-forum.com/t/ann-newgem-create-gems-for-your-libraries-and-apps/71784/1 "2006-10-11T13:23:21Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![nicwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicwilliams](https://www.ruby-forum.com/u/nicwilliams)\
**Post date:** [October 11, 2006, 1:55pm UTC](https://www.ruby-forum.com/t/ann-newgem-create-gems-for-your-libraries-and-apps/71784/2 "2006-10-11T13:55:34Z")

</div>

This is great. You’re cooking up one sweet Ruby library after another.

Calling it “gemify” isn’t an option? Sounds sweeter.

---

<div class="post-metadata">

**Author:** ![nicwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicwilliams](https://www.ruby-forum.com/u/nicwilliams)\
**Post date:** [October 11, 2006, 1:58pm UTC](https://www.ruby-forum.com/t/ann-newgem-create-gems-for-your-libraries-and-apps/71784/3 "2006-10-11T13:58:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nicwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicwilliams](https://www.ruby-forum.com/u/nicwilliams)\
**Post date:** [October 11, 2006, 5:18pm UTC](https://www.ruby-forum.com/t/ann-newgem-create-gems-for-your-libraries-and-apps/71784/4 "2006-10-11T17:18:58Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![nicwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicwilliams](https://www.ruby-forum.com/u/nicwilliams)\
**Post date:** [January 16, 2008, 6:27am UTC](https://www.ruby-forum.com/t/ann-newgem-create-gems-for-your-libraries-and-apps/71784/5 "2008-01-16T06:27:56Z")

</div>

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](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!!!

---

<div class="post-metadata">

**Author:** ![nicwilliams](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/aca169/32.png) [@nicwilliams](https://www.ruby-forum.com/u/nicwilliams)\
**Post date:** [October 12, 2006, 1:54pm UTC](https://www.ruby-forum.com/t/ann-newgem-create-gems-for-your-libraries-and-apps/71784/6 "2006-10-12T13:54:29Z")

</div>

Dr Nic [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> A new version will come out soon that will include the setup.rb file in  
> the generated gems
> 
> [setup.rb](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

Thank you.
