RubyGems 0.9.5 ignoring spec.bindir

Hello,

I want to make a gem for a small (< 200 lines) project of mine. The
entire project is stored in one Ruby source file, so I don’t want to
create a separate “bin/” directory. I read about RubyGems’ bindir
parameter which allows you to override the “bin/” directory requirement
and basically put your executable anywhere inside your project
directory.

The problem is that RubyGems 0.9.5 is ignoring my

spec.bindir = ‘.’

assignment and looking for a “bin/” directory instead.

I tried using

spec.bindir = nil

but that does not work either.


Here is a complete example to reproduce the problem:

$ ls -l
-rw-r–r-- 1 sun sun 371 2007-12-09 18:53 Rakefile
-rwxr-xr-x 1 sun sun 39 2007-12-09 18:53 foobar*

$ ./foobar
hello world

$ cat foobar
#!/usr/bin/env ruby
puts “hello world”

$ cat Rakefile
require ‘rake/gempackagetask’

spec = Gem::Specification.new do |s|
s.name = ‘foobar’
s.version = ‘0’
s.summary = ‘summary’
s.files = ‘foobar’
s.executables = ‘foobar’
s.bindir = ‘.’ # our executable is not inside ‘bin/’
end

does nothing unless block given, dunno why…

Rake::GemPackageTask.new(spec) do end

$ rake -T
(in /home/sun/lab/gemspec)
rake clobber_package # Remove package products
rake gem # Build the gem file foobar-0.gem
rake package # Build all the packages
rake repackage # Force a rebuild of the package files

$ rake gem
(in /home/sun/lab/gemspec)
Successfully built RubyGem
Name: foobar
Version: 0
File: foobar-0.gem

$ gem install pkg/foobar-0.gem -i my_out_dir
ERROR: While executing gem … (Errno::ENOENT)
No such file or directory -
/home/sun/lab/gemspec/my_out_dir/gems/foobar-0/bin/foobar

See this error? Why is it looking for a “bin/” directory when I
assigned spec.bindir?!

Thanks for your consideration.

Suraj K. wrote:

The problem is that RubyGems 0.9.5 is ignoring my

spec.bindir = ‘.’

assignment and looking for a “bin/” directory instead.

I filed a bug report about this on the RubyGems bug tracker:
http://rubyforge.org/tracker/index.php?func=detail&aid=16202&group_id=126&atid=575

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs