Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Problems with first gem using Rake/Hoe

Reply
Thread Tools

Problems with first gem using Rake/Hoe

 
 
Jim Clark
Guest
Posts: n/a
 
      01-12-2008
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


 
Reply With Quote
 
 
 
 
Luis Lavena
Guest
Posts: n/a
 
      01-12-2008
On 11 ene, 22:02, Jim Clark <(E-Mail Removed)> wrote:
> 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:
>
> [...]
>
> 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?
>


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,
--
Luis Lavena
 
Reply With Quote
 
 
 
 
Jim Clark
Guest
Posts: n/a
 
      01-12-2008
Luis Lavena wrote:
> 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
>

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




 
Reply With Quote
 
Luis Lavena
Guest
Posts: n/a
 
      01-13-2008
On 12 ene, 17:46, Jim Clark <(E-Mail Removed)> wrote:
> Luis Lavena wrote:
> > 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

>
> 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,
--
Luis Lavena
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with 'gem require' and test-unit gem Daniel Berger Ruby 2 09-12-2008 07:15 PM
RubyGems 0.9.1 calling a gem with gem '<gem>' Austin 7873 Ruby 5 01-27-2007 10:05 PM
[GEM PATCH] allow gem to install bin file to different location Ara.T.Howard Ruby 0 10-26-2005 11:52 PM
ERROR: While executing gem ... (Gem::GemNotFoundException) Could not find rubygems-upodate (> 0) in the repository han Ruby 1 10-24-2005 10:28 PM
[ANN] Getopt-Declare 1.12 (gem/zip) and GGEnv (gem/zip) gga Ruby 0 07-18-2005 03:21 PM



Advertisments