# Problems with first gem using Rake/Hoe

**URL:** <https://www.ruby-forum.com/t/problems-with-first-gem-using-rake-hoe/125783>\
**Category:** Ruby\
**Created:** [January 12, 2008, 1:03am UTC](https://www.ruby-forum.com/t/problems-with-first-gem-using-rake-hoe/125783 "2008-01-12T01:03:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ba8739/32.png) [@jimc](https://www.ruby-forum.com/u/jimc)\
**Post date:** [January 12, 2008, 1:03am UTC](https://www.ruby-forum.com/t/problems-with-first-gem-using-rake-hoe/125783/1 "2008-01-12T01:03:02Z")

</div>

Hi,

I’m trying to package my first gem using Hoe (1.4.0) and am having  
difficulties with Rake (0.8.1) on a Windows XP system. What I notice is  
that when I execute the task through Rake, it will fail yet I can  
execute the task outside of Rake. For instance:

C:\rubylogparser\>rake install\_gem  
(in C:/rubylogparser)  
zip -r rubylogparser-0.1.0.zip rubylogparser-0.1.0  
Successfully built RubyGem  
Name: rubylogparser  
Version: 0.1.0  
File: rubylogparser-0.1.0.gem  
gem install pkg/_.gem  
rake aborted!  
Command failed with status (0): [gem install pkg/_.gem…]

(See full trace by running task with --trace)

C:\rubylogparser\>rake install\_gem --trace  
(in C:/rubylogparser)  
\*\* Invoke install\_gem (first\_time)  
\*\* Invoke clean (first\_time)  
\*\* Invoke clobber\_docs (first\_time)  
\*\* Execute clobber\_docs  
\*\* Invoke clobber\_package (first\_time)  
\*\* Execute clobber\_package  
\*\* Execute clean  
\*\* Invoke package (first\_time)  
\*\* Invoke pkg/rubylogparser-0.1.0.zip (first\_time)  
\*\* Invoke pkg/rubylogparser-0.1.0 (first\_time)  
\*\* Invoke EXAMPLES.txt (first\_time, not\_needed)  
\*\* Invoke GUIDE.txt (first\_time, not\_needed)  
\*\* Invoke History.txt (first\_time, not\_needed)  
\*\* Invoke Manifest.txt (first\_time, not\_needed)  
\*\* Invoke README.txt (first\_time, not\_needed)  
\*\* Invoke Rakefile (first\_time, not\_needed)  
\*\* Invoke examples/event\_log.rb (first\_time, not\_needed)  
\*\* Invoke examples/files.rb (first\_time, not\_needed)  
\*\* Invoke examples/queryinfo.rb (first\_time, not\_needed)  
\*\* Invoke examples/registry.rb (first\_time, not\_needed)  
\*\* Invoke lib/rubylogparser.rb (first\_time, not\_needed)  
\*\* Invoke test/test\_rubylogparser.rb (first\_time, not\_needed)  
\*\* Execute pkg/rubylogparser-0.1.0  
\*\* Invoke EXAMPLES.txt (not\_needed)  
\*\* Invoke GUIDE.txt (not\_needed)  
\*\* Invoke History.txt (not\_needed)  
\*\* Invoke Manifest.txt (not\_needed)  
\*\* Invoke README.txt (not\_needed)  
\*\* Invoke Rakefile (not\_needed)  
\*\* Invoke examples/event\_log.rb (not\_needed)  
\*\* Invoke examples/files.rb (not\_needed)  
\*\* Invoke examples/queryinfo.rb (not\_needed)  
\*\* Invoke examples/registry.rb (not\_needed)  
\*\* Invoke lib/rubylogparser.rb (not\_needed)  
\*\* Invoke test/test\_rubylogparser.rb (not\_needed)  
\*\* Execute pkg/rubylogparser-0.1.0.zip  
zip -r rubylogparser-0.1.0.zip rubylogparser-0.1.0  
\*\* Invoke gem (first\_time)  
\*\* Invoke pkg/rubylogparser-0.1.0.gem (first\_time)  
\*\* Invoke pkg (first\_time, not\_needed)  
\*\* Invoke EXAMPLES.txt (not\_needed)  
\*\* Invoke GUIDE.txt (not\_needed)  
\*\* Invoke History.txt (not\_needed)  
\*\* Invoke Manifest.txt (not\_needed)  
\*\* Invoke README.txt (not\_needed)  
\*\* Invoke Rakefile (not\_needed)  
\*\* Invoke examples/event\_log.rb (not\_needed)  
\*\* Invoke examples/files.rb (not\_needed)  
\*\* Invoke examples/queryinfo.rb (not\_needed)  
\*\* Invoke examples/registry.rb (not\_needed)  
\*\* Invoke lib/rubylogparser.rb (not\_needed)  
\*\* Invoke test/test\_rubylogparser.rb (not\_needed)  
\*\* Execute pkg/rubylogparser-0.1.0.gem  
Successfully built RubyGem  
Name: rubylogparser  
Version: 0.1.0  
File: rubylogparser-0.1.0.gem  
\*\* Execute gem  
\*\* Execute package  
\*\* Execute install\_gem  
gem install pkg/_.gem  
rake aborted!  
Command failed with status (0): [gem install pkg/_.gem…]  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:899:in `sh' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:906:in`call’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:906:in `sh' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:985:in`sh’  
c:/ruby/lib/ruby/gems/1.8/gems/hoe-1.4.0/lib/hoe.rb:486:in  
`define_tasks' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in`call’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in`each’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in`invoke\_with\_call\_c  
hain’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in  
`synchronize' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in`invoke\_with\_call\_c  
hain’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in `invoke' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in`invoke\_task’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in  
`top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in`each’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in  
`top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in`standard\_exceptio  
n\_handling’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in  
`top_level' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in`run’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in  
`standard_exceptio n_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in`run’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31  
c:/ruby/bin/rake:16:in `load’  
c:/ruby/bin/rake:16

C:\rubylogparser\>gem install pkg/\*.gem  
Successfully installed rubylogparser, version 0.1.0  
Installing ri documentation for rubylogparser-0.1.0…  
Installing RDoc documentation for rubylogparser-0.1.0…

C:\rubylogparser\>rake ridocs  
(in C:/rubylogparser)  
rdoc --ri -o ri .  
rake aborted!  
undefined method `exitstatus’ for nil:NilClass

(See full trace by running task with --trace)

C:\rubylogparser\>rake ridocs --trace  
(in C:/rubylogparser)  
\*\* Invoke ridocs (first\_time)  
\*\* Invoke clean (first\_time)  
\*\* Invoke clobber\_docs (first\_time)  
\*\* Execute clobber\_docs  
\*\* Invoke clobber\_package (first\_time)  
\*\* Execute clobber\_package  
\*\* Execute clean  
\*\* Execute ridocs  
rdoc --ri -o ri .  
rake aborted!  
undefined method `exitstatus' for nil:NilClass c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:899:in`sh’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:906:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:906:in`sh’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:985:in `sh' c:/ruby/lib/ruby/gems/1.8/gems/hoe-1.4.0/lib/hoe.rb:546:in`define\_tasks’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in `call' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:546:in`execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:541:in`execute’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:508:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in`synchronize’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:501:in  
`invoke_with_call_c hain' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:494:in`invoke’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1931:in  
`invoke_task' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in`top\_level’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in `each' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1909:in`top\_level’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in  
`standard_exceptio n_handling' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1903:in`top\_level’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1881:in `run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1948:in`standard\_exceptio  
n\_handling’  
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/lib/rake.rb:1878:in `run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.1/bin/rake:31 c:/ruby/bin/rake:16:in`load’  
c:/ruby/bin/rake:16

C:\rubylogparser\>rdoc --ri -o ri .

```
                   event_log.rb:
                       files.rb:
                   queryinfo.rb:
                    registry.rb:
               rubylogparser.rb: c...............
          test_rubylogparser.rb: c......

```

Generating RI…

Files: 6  
Classes: 2  
Modules: 0  
Methods: 21  
Elapsed: 1.803s

C:\rubylogparser\>

Using Google, I see that I am not the only one who has seen these errors  
in various incarnations. Does anyone understand why Rake fails when the  
tasks succeed otherwise?

Thanks in advance,  
Jim

---

<div class="post-metadata">

**Author:** ![jimc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ba8739/32.png) [@jimc](https://www.ruby-forum.com/u/jimc)\
**Post date:** [January 12, 2008, 2:35pm UTC](https://www.ruby-forum.com/t/problems-with-first-gem-using-rake-hoe/125783/2 "2008-01-12T14:35:56Z")

</div>

On 11 ene, 22:02, Jim C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> in various incarnations. Does anyone understand why Rake fails when the  
> tasks succeed otherwise?

The problem is related to system() and ruby.

It don’t take as valid “executables” the batch files (.bat or .cmd)  
that ruby on Windows need to get gem, rake, or other gem installed  
tools run.

Try the following in a IRB session:  
irb(main):005:0\> system “gem”, “-v”  
=\> false  
irb(main):006:0\> system “gem.bat”, “-v”  
0.9.4  
=\> true

I you take a closer look, you see that I needed to provide the file  
extension to get it working.  
Hoe task lack the extension of the command, mostly because it need to  
be cross-platform compatible, and is just Windows that needs it.

You can suggest a patch to Hoe project that takes RUBY\_PLATFORM in  
consideration and set the correct system call.

HTH,

---

<div class="post-metadata">

**Author:** ![jimc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ba8739/32.png) [@jimc](https://www.ruby-forum.com/u/jimc)\
**Post date:** [January 12, 2008, 9:46pm UTC](https://www.ruby-forum.com/t/problems-with-first-gem-using-rake-hoe/125783/3 "2008-01-12T21:46:50Z")

</div>

Luis L. wrote:

> 0.9.4  
> =\> true

OK, I see this in IRB too. I’m still a little confused just because the  
tasks that Rake is failing on I am typing in exactly as Rake is issuing  
them (well, I haven’t traced it inside a debugger but based on the  
–trace output to the screen).

> I you take a closer look, you see that I needed to provide the file  
> extension to get it working.  
> Hoe task lack the extension of the command, mostly because it need to  
> be cross-platform compatible, and is just Windows that needs it.

Case in point, Rake fails on the “rake install\_gem” command on the “gem  
install pkg/\*.gem” yet this works verbatim on the command line. I don’t  
need “gem.bat install…” on the command line.

> You can suggest a patch to Hoe project that takes RUBY\_PLATFORM in  
> consideration and set the correct system call.

Obviously I do need to trace this inside a debugger and understand it  
better before I suggest a patch. Being my first gem, I am in that grey  
area where when things go wrong, I’m not sure whether it is how I have  
things configured or other sometimes Windows specific issues.

Thanks for the help.

Regards,  
Jim

---

<div class="post-metadata">

**Author:** ![jimc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ba8739/32.png) [@jimc](https://www.ruby-forum.com/u/jimc)\
**Post date:** [January 13, 2008, 3:50pm UTC](https://www.ruby-forum.com/t/problems-with-first-gem-using-rake-hoe/125783/4 "2008-01-13T15:50:45Z")

</div>

On 12 ene, 17:46, Jim C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > irb(main):006:0\> system “gem.bat”, “-v”  
> > 0.9.4  
> > =\> true
> 
> OK, I see this in IRB too. I’m still a little confused just because the  
> tasks that Rake is failing on I am typing in exactly as Rake is issuing  
> them (well, I haven’t traced it inside a debugger but based on the  
> –trace output to the screen).

There isn’t too much for you to get confused.

Hoe is creating a series of Rake tasks that do system calls. The way  
#system method works in Ruby is that unless it is a executable (.exe)  
you need the extension for the file, so you need pass the .bat or .cmd  
to it.

The verbatim copy of the commandline works in the Command Prompt  
because the execution is done by the cmd.exe and not by ruby.

> > I you take a closer look, you see that I needed to provide the file  
> > extension to get it working.  
> > Hoe task lack the extension of the command, mostly because it need to  
> > be cross-platform compatible, and is just Windows that needs it.
> 
> Case in point, Rake fails on the “rake install\_gem” command on the “gem  
> install pkg/\*.gem” yet this works verbatim on the command line. I don’t  
> need “gem.bat install…” on the command line.

Again, is a known problem of Ruby #system method.

> > You can suggest a patch to Hoe project that takes RUBY\_PLATFORM in  
> > consideration and set the correct system call.
> 
> Obviously I do need to trace this inside a debugger and understand it  
> better before I suggest a patch. Being my first gem, I am in that grey  
> area where when things go wrong, I’m not sure whether it is how I have  
> things configured or other sometimes Windows specific issues.

No need for a debugger. If you take a look inside lib/hoe.rb (part of  
Hoe gem) you will find the exact code that creates the install\_gem  
task.

Is nothing related on how you have things configured, is a known  
problem of Ruby #system method on Windows.

> Thanks for the help.

Regards,
