[macruby-changes] [4614] DietRB/trunk/lib

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 8 03:48:51 PDT 2010


Revision: 4614
          http://trac.macosforge.org/projects/ruby/changeset/4614
Author:   eloy.de.enige at gmail.com
Date:     2010-10-08 03:48:50 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
When running on MacRuby, load AppKit and start the main runloop. Cocoa dev from IRB baby!

It needs more work though.

From: Eloy Duran <eloy.de.enige at gmail.com>

Modified Paths:
--------------
    DietRB/trunk/lib/irb.rb

Added Paths:
-----------
    DietRB/trunk/lib/irb/ext/
    DietRB/trunk/lib/irb/ext/macruby.rb

Added: DietRB/trunk/lib/irb/ext/macruby.rb
===================================================================
--- DietRB/trunk/lib/irb/ext/macruby.rb	                        (rev 0)
+++ DietRB/trunk/lib/irb/ext/macruby.rb	2010-10-08 10:48:50 UTC (rev 4614)
@@ -0,0 +1,15 @@
+framework 'AppKit'
+
+module IRB
+  class Context
+    alias_method :_run, :run
+    
+    def run
+      Thread.new do
+        _run
+        NSApplication.sharedApplication.terminate(self)
+      end
+      NSApplication.sharedApplication.run
+    end
+  end
+end
\ No newline at end of file

Modified: DietRB/trunk/lib/irb.rb
===================================================================
--- DietRB/trunk/lib/irb.rb	2010-10-08 10:48:40 UTC (rev 4613)
+++ DietRB/trunk/lib/irb.rb	2010-10-08 10:48:50 UTC (rev 4614)
@@ -1,2 +1,6 @@
 require 'irb/context'
-require 'irb/source'
\ No newline at end of file
+require 'irb/source'
+
+if defined?(RUBY_ENGINE) && RUBY_ENGINE == "macruby"
+  require 'irb/ext/macruby'
+end
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/598bd53b/attachment-0001.html>


More information about the macruby-changes mailing list