gem help

A

ara.t.howard

i have this

jib:~/eg/ruby/rubyforge/rubyforge-0.1.1 > file bin//rubyforge
bin//rubyforge: a ruby script text executable


jib:~/eg/ruby/rubyforge/rubyforge-0.1.1 > cat ./gemspec.rb
lib, version = File::basename(File::dirname(File::expand_path(__FILE__))).split %r/-/, 2

require 'rubygems'

spec = Gem::Specification.new do |s|
s.name = lib
s.version = version
s.platform = Gem::platform::RUBY
s.summary = lib

s.files = Dir["lib/*"] + Dir["bin/*"]

s.require_path = "lib"
s.autorequire = lib

s.has_rdoc = File::exist? "doc"
s.test_suite_file = "test/#{ lib }.rb" if File::directory? "test"

s.author = "Ara T. Howard"
s.email = "(e-mail address removed)"
s.homepage = "http://codeforpeople.com/lib/ruby/#{ lib }/"
end


and this gem, apparently, does not install a 'rubyforge' script into the system
bin dir. why not?

regards.

-a
 
A

Alex Fenton

and this gem, apparently, does not install a 'rubyforge' script into the
system
bin dir. why not?

Try adding some additional spec items to your gemspec.

The following works for me:

s.bindir = "." # yours looks to be bin
s.executables = [ "weft-qda.rb" ] # or whatever your main script is called
s.default_executable = "weft-qda.rb"

hth
alex
 
A

ara.t.howard

On Tue, 14 Feb 2006, Jim Weirich wrote:


i should have included to complete patched 'gem' script:

#!/usr/bin/env ruby

require 'rubygems'
Gem.manage_gems

required_version = Gem::Version::Requirement.new(">= 1.8.0")
unless required_version.satisfied_by?(Gem::Version.new(RUBY_VERSION))
puts "Expected Ruby Version #{required_version}, was #{RUBY_VERSION}"
exit(1)
end

# We need to preserve the original ARGV to use for passing gem options
# to source gems. If there is a -- in the line, strip all options after
# it...its for the source building process.
args = !ARGV.include?("--") ? ARGV.clone : ARGV[0...ARGV.index("--")]

#
# munge rbconfig from any command line or environment kv pair
#
kvs = []
re = %r/^ \s* ([^=\s]+) \s* = \s* ([^\s]+) \s* $/x
args.delete_if{|arg| (m = re.match(arg)) and (kvs << m.to_a.last(2))}
ENV::each{|k,v| (k =~ %r/^GEM_/) and (kvs << [k.delete('GEM_'), v])}
unless kvs.empty?
require 'rbconfig'
kvs.each{|k,v| Config::CONFIG[k] = v}
end

Gem::GemRunner.new.run(args)


not that env settings affect the install as well. so one can do

GEM_BINDIR=/usr/local/bin gem install somelib.gem

regards.

-a
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top