Binary not executing using RubyGems

T

Trans

I created a Ruby Gem for one of my projects. I managed to get
everything working okay (it wasn't as easy as I would have liked), but
I have a binary executable in the package and it fails to work after
installation of the gem. These are probably the most relevant sections
of the gemspec:

autorequire: reap/reap
default_executable: reap
bindir: bin
executables:
- reap

The file 'bin/reap' is included in the files list.

When I actualy type 'reap' on the commandline it simple does nothing.
No error, no nothing.

Any suggestions?

Thanks,
T.
 
C

Chad Fowler

I created a Ruby Gem for one of my projects. I managed to get
everything working okay (it wasn't as easy as I would have liked),

What was difficult about it?
autorequire: reap/reap
default_executable: reap
bindir: bin
executables:
- reap

The file 'bin/reap' is included in the files list.

When I actualy type 'reap' on the commandline it simple does nothing.
No error, no nothing.

Any suggestions?

The script wrappers don't work with "if __FILE__ == $0" blocks,
because they use "load" to execute the script. Since you're probably
not ever going to use 'require "bin/reap"', you could take the if
condition out and it would work.

--

Chad Fowler
http://chadfowler.com
http://rubycentral.org
http://rubygarden.org
http://rubygems.rubyforge.org (over 100,000 gems served!)
 
T

Trans

Hi Chad--

Chad said:
What was difficult about it?

Primarily it's still setting up the whole RUBYOPT thing. Not that its
hard per se, just that one has to do it. But also I had to 'gem install
rubygems-update' even though I had installed a very recent verion of
RubyGems. I assume the whole RUBYOPT thing (vs. stubs) arises from
versioning. I'm surprised that there is no other way to do this.
The script wrappers don't work with "if __FILE__ == $0" blocks,
because they use "load" to execute the script. Since you're probably
not ever going to use 'require "bin/reap"', you could take the if
condition out and it would work.

Ah, That'll do it. Thanks.

T.
 
J

Jim Freeze

* Chad Fowler said:
The script wrappers don't work with "if __FILE__ == $0" blocks,
because they use "load" to execute the script. Since you're probably
not ever going to use 'require "bin/reap"', you could take the if
condition out and it would work.

The $0 == __FILE__ is good for facilitating system testing.
Is there a constant that gems can set so that we can do
system testing and have versioning? Something like:

if $0 == __FILE__ || RUBYGEMS
run code
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,170
Messages
2,570,925
Members
47,468
Latest member
Fannie44U3

Latest Threads

Top