rubygems executables don't seem to work
Hi,
I'm having a bit of trouble getting executables to work in rubygems. Take for example the gem bio-plasmoap version 0.0.2.
I'm using jeweler here, and my bin directory has this bin/plasmoap.rb script in it (permssions executable). Looking in the generated gemspec I see
s.executables = [%q{plasmoap.rb}]
and there is an executable installed when I install the gem:
$ which plasmoap.rb
/usr/bin/plasmoap.rb
However that's not my script, it has been put in place by rubygems
$ cat `which plasmoap.rb`
#!/usr/bin/ruby1.8
#
# This file was generated by RubyGems.
#
# The application 'bio-plasmoap' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
gem 'bio-plasmoap', version
load Gem.bin_path('bio-plasmoap', 'plasmoap.rb', version)
Which I don't especially find annoying, except that the script doesn't do anything when I run it. It isn't very facilitative!
$ plasmoap.rb
(no output)
One way around this is to specify the script itself, using something like
$ gem contents bio-plasmoap
...
/usr/lib/ruby/gems/1.8/gems/bio-plasmoap-0.0.2/bin/plasmoap.rb
...
$ /usr/lib/ruby/gems/1.8/gems/bio-plasmoap-0.0.2/bin/plasmoap.rb
<script executes properly>
I'm using the rubygems 1.8.14, and was able to reproduce the above on ruby 1.9.2 for good measure (with the same version of rubygems).
Thanks - I hope I'm not missing anything obvious here, but this
isn't the first time I've come across this so it isn't just an off
moment.
ben
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Nick Quaranto on 04 Aug, 2012 06:40 PM
Sorry, this comment was buried in our spam inbox.
Did you get this figured out?
3 Posted by donttrustben on 04 Aug, 2012 10:27 PM
Yes, I did thanks.
The issue was that I was surrounding my code with this if statement:
Once that was removed, there was no further issues.
Thanks,
ben
Nick Quaranto closed this discussion on 07 Sep, 2012 03:43 AM.