[macruby-changes] [1897] MacRuby/branches/experimental/bin/ruby_select

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 19 19:29:48 PDT 2009


Revision: 1897
          http://trac.macosforge.org/projects/ruby/changeset/1897
Author:   lsansonetti at 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
   + *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090619/d489dc06/attachment.html>


More information about the macruby-changes mailing list