Revision: 1897 http://trac.macosforge.org/projects/ruby/changeset/1897 Author: lsansonetti@apple.com Date: 2009-06-19 19:29:48 -0700 (Fri, 19 Jun 2009) Log Message: ----------- added macruby_select(1) tool Added Paths: ----------- MacRuby/branches/experimental/bin/ruby_select Added: MacRuby/branches/experimental/bin/ruby_select =================================================================== --- MacRuby/branches/experimental/bin/ruby_select (rev 0) +++ MacRuby/branches/experimental/bin/ruby_select 2009-06-20 02:29:48 UTC (rev 1897) @@ -0,0 +1,28 @@ +#!/usr/bin/ruby + +MACRUBY_FRAMEWORK = '/Library/Frameworks/MacRuby.framework' + +unless File.exist?(MACRUBY_FRAMEWORK) + $stderr.puts "Can't locate '#{MACRUBY_FRAMEWORK}'." + exit 1 +end + +versions = Dir.glob(File.join(MACRUBY_FRAMEWORK, 'Versions/*')) + +if ARGV.empty? + $stderr.puts "Usage: $ macruby_select [version] [ruby args ...]" + $stderr.puts "Example: $ macruby_select 0.4 -e 'p 42'" + $stderr.puts "Versions: #{versions.map{|x|File.basename(x)}.join(', ')}" + exit 1 +end + +vers = ARGV.shift +path = versions.find { |x| File.basename(x) == vers } +if path.nil? + $stderr.puts "Given version '#{vers}' cannot be found." + exit 1 +end + +line = "#{path}/usr/bin/macruby" +ARGV.each { |x| line << ' \'' << x << '\' ' } +system(line) Property changes on: MacRuby/branches/experimental/bin/ruby_select ___________________________________________________________________ Added: svn:executable + *
participants (1)
-
source_changes@macosforge.org