I wanted to play around with creating my own gems so today I decided to try the jeweler gem.

Install went fine:

io@love:~$ sudo gem install jeweler
Successfully installed jeweler-1.4.0
1 gem installed
Installing ri documentation for jeweler-1.4.0...
Installing RDoc documentation for jeweler-1.4.0...

But when i attempted to create “the perfect gem” I ran into a bit of a problem:

io@love:~/ruby/gem_test$ jeweler the-perfect-gem
/usr/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/lib.rb:700:in `command': git config "--global" "--list"  2>&1:fatal: unable to read config file /home/io/.gitconfig: No such file or directory (Git::GitExecuteError)
	from /usr/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/lib.rb:672:in `command_lines'
	from /usr/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git/lib.rb:352:in `global_config_list'
	from /usr/lib/ruby/gems/1.8/gems/git-1.2.5/lib/git.rb:148:in `global_config'
	from /usr/lib/ruby/gems/1.8/gems/jeweler-1.4.0/bin/../lib/jeweler/generator/options.rb:15:in `initialize'
	from /usr/lib/ruby/gems/1.8/gems/jeweler-1.4.0/bin/../lib/jeweler/generator/application.rb:9:in `new'
	from /usr/lib/ruby/gems/1.8/gems/jeweler-1.4.0/bin/../lib/jeweler/generator/application.rb:9:in `run!'
	from /usr/lib/ruby/gems/1.8/gems/jeweler-1.4.0/bin/jeweler:5
	from /usr/bin/jeweler:19:in `load'
	from /usr/bin/jeweler:19

And after some research… looks like i had not done some mandatory git setup steps… as i SHOULD have.

The solution…

io@love:~/ruby/gem_test$ git config --global user.name "iouser"
io@love:~/ruby/gem_test$ git config --global user.email "[email protected]"
io@love:~/ruby/gem_test$ git config --global github.user iouser

And finally the glory:

io@love:~/ruby/gem_test$ jeweler the-perfect-gem
	create	.gitignore
	create	Rakefile
	create	LICENSE
	create	README.rdoc
	create	.document
	create	lib
	create	lib/the-perfect-gem.rb
	create	test
	create	test/helper.rb
	create	test/test_the-perfect-gem.rb
Jeweler has prepared your gem in the-perfect-gem

Note: If you see the this error

io@love:~/ruby/gem_test$ jeweler the-perfect-gem
No github.user found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt

it means you forgot to do this part:

io@love:~/ruby/gem_test$ git config --global github.user iouser