Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > rbconfig suggestion: ruby_apps

Reply
Thread Tools

rbconfig suggestion: ruby_apps

 
 
Joel VanderWerf
Guest
Posts: n/a
 
      12-08-2003

Now that there are several new apps (testrb, rdoc) distributed with ruby
and installed to bindir, it would be convenient to know what they are,
through some API. Could we have something like

CONFIG["ruby_apps"] = "ruby irb erb testrb rdoc"

Or maybe the key should be "ruby_exes".

My particular reason is for a script that switches symlinks from
ruby->ruby-1.7.3 to ruby->1.8.1p3 and so on.



 
Reply With Quote
 
 
 
 
Yukihiro Matsumoto
Guest
Posts: n/a
 
      12-09-2003

In message "rbconfig suggestion: ruby_apps"
on 03/12/09, Joel VanderWerf <(E-Mail Removed)> writes:

|My particular reason is for a script that switches symlinks from
|ruby->ruby-1.7.3 to ruby->1.8.1p3 and so on.

./configure --program-suffix=-1.8.1p3 will do.

matz.

 
Reply With Quote
 
 
 
 
Joel VanderWerf
Guest
Posts: n/a
 
      12-09-2003
Yukihiro Matsumoto wrote:
> In message "rbconfig suggestion: ruby_apps"
> on 03/12/09, Joel VanderWerf <(E-Mail Removed)> writes:
>
> |My particular reason is for a script that switches symlinks from
> |ruby->ruby-1.7.3 to ruby->1.8.1p3 and so on.
>
> ./configure --program-suffix=-1.8.1p3 will do.
>
> matz.


That's exactly what I do whenever a new snapshot comes out. Then
with my little "switchruby" script I can change what my symlinks named
ruby, irb, and so on point to. And change back again. Sample session:

# switchruby 1.7.3
ruby -> ruby-1.7.3
irb -> irb-1.7.3
erb -> erb-1.7.3
# switchruby
Current versions are:
ruby -> ruby-1.7.3
irb -> irb-1.7.3
erb -> erb-1.7.3
rdoc -> rdoc-1.8.1p3
testrb -> testrb-1.8.1p3
Choices are: 1.7.3 1.8.0 1.8.1-22Nov03 1.8.1p3
# switchruby 1.8.1p3
ruby -> ruby-1.8.1p3
irb -> irb-1.8.1p3
erb -> erb-1.8.1p3
rdoc -> rdoc-1.8.1p3
testrb -> testrb-1.8.1p3

Of course, switching to 1.8.0 doesn't work so well because:

# ruby -r rbconfig -e 1
/usr/local/lib/ruby/1.8/i686-linux/rbconfig.rb:7: ruby lib version
(1.8.1) doesn't match executable version (1.8.0) (RuntimeError)

I guess I could swap the lib dirs as well, but that's getting to be too
much work, and besides I'm really more interested in switching between
different previews or cvs of the same "teeny" version.

== switchruby ==

#!/usr/local/bin/ruby-1.7.3

require 'rbconfig'

ext = ARGV[0]

Dir.chdir Config::CONFIG["bindir"]

exts = []
Dir["ruby*"].grep(/^ruby-(.*)/) { |f| exts << $1 }

ruby_apps = ["ruby", "irb", "erb", "rdoc", "testrb"]
# this should be provided by rbconfig.rb

if ext
unless exts.include? ext
$stderr.puts "Choices are: #{exts.join(" ")}"
exit -1
end

extstr = ext.sub(/^(?!-)/, "-")

ruby_apps.each do |app|
target = app + extstr
if File.exist? target
if File.exist?(app) and not File.symlink?(app)
$stderr.puts "File #{app} exists and is not a symlink. Aborting."
exit -1
end
File.delete(app) and File.symlink(target, app) and
puts "#{app} -> #{target}"
end
end

else

cur =
ruby_apps.map do |app|
" " + `ls -l #{app}`[/\w+ -> .*/]
end

puts "Current versions are:", cur

puts "Choices are: #{exts.join(" ")}"

end



 
Reply With Quote
 
Yukihiro Matsumoto
Guest
Posts: n/a
 
      12-09-2003
Hi,

In message "Re: rbconfig suggestion: ruby_apps"
on 03/12/09, Joel VanderWerf <(E-Mail Removed)> writes:

|Of course, switching to 1.8.0 doesn't work so well because:
|
|# ruby -r rbconfig -e 1
|/usr/local/lib/ruby/1.8/i686-linux/rbconfig.rb:7: ruby lib version
|(1.8.1) doesn't match executable version (1.8.0) (RuntimeError)

This suggest me something. But not in the very near future.
Thanks anyway.

matz.


 
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
rbconfig (LoadError) chris Ruby 8 03-06-2007 11:59 PM
rbconfig.rb problems Glenn M. Lewis Ruby 2 10-08-2004 06:03 PM
rbconfig / libpathflag is wrong Jeff Mitchell Ruby 0 06-25-2004 12:42 PM
[RCR] Include CONFIG::Config['rubydocdir'] in rbconfig.rb Gavin Sinclair Ruby 7 10-01-2003 10:24 PM
finding ruby.h / problem with rbconfig (LoadError) Oliver Obst Ruby 4 09-29-2003 08:54 AM



Advertisments