Getting from (Ruby)Cocoa to MacRuby?
The notes in http://www.macruby.org/trac/wiki/MacRubyDifferences, even if completed, would not serve as a "HowTo" for porting an app from RubyCocoa to MacRuby. If folks here will give me a hand, I'd be happy to put together such a document. On a related topic, I'm wondering about the possibility of porting conventional (ie, ObjC) Cocoa apps _incrementally_ to MacRuby. Is there a way, for example, to: - Turn an ObjC Cocoa app into a nominal MacRuby app, but leave all of the actual code on ObjC. - Pick a class and method, comment out the ObjC code, and add a MacRuby version that performs the same job. - See if things still work the same. - Rinse, repeat... -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm@cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development
On Oct 26, 2008, at 12:27 AM, Rich Morin wrote:
On a related topic, I'm wondering about the possibility of porting conventional (ie, ObjC) Cocoa apps _incrementally_ to MacRuby. Is there a way, for example, to:
- Turn an ObjC Cocoa app into a nominal MacRuby app, but leave all of the actual code on ObjC.
- Pick a class and method, comment out the ObjC code, and add a MacRuby version that performs the same job.
- See if things still work the same.
- Rinse, repeat...
There is a way :-) - You modify the project to link against MacRuby.framework - You copy the main.m and rb_main.rb files from an existing MacRuby application (you will override the existing main.m file here, but rb_main.rb will be a new file) - You add a build phase that copies all .rb files into the Resource directory of the application bundle - Then you can start porting the code. You can start by converting a file into MacRuby (MyClass.[m|h] -> MyClass.rb), then remove the C/ Objective-C files from the project. I did this process quite a few times when porting some Objective-C sample code into RubyCocoa/MacRuby. I don't think I forgot to mention a step. Laurent
At 01:06 -0700 10/27/08, Laurent Sansonetti wrote:
There is a way :-)
I edited your notes into http://www.macruby.org/trac/wiki/MacRubyfromObjC Please correct any botches, add detail, etc. -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm@cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development
I assume that this is a free-standing stub article which, upon being fleshed out, will eventually be referenced from some suitable section of MacRubyDevelopment? I ask only because it states the answer to a question which has not, as far as I know, been defined anywhere on the wiki yet and it's a little hard to know what to even do to the page without the calling context. Thanks, - Jordan On Oct 27, 2008, at 10:05 AM, Rich Morin wrote:
At 01:06 -0700 10/27/08, Laurent Sansonetti wrote:
There is a way :-)
I edited your notes into
http://www.macruby.org/trac/wiki/MacRubyfromObjC
Please correct any botches, add detail, etc.
-r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm@cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841
Technical editing and writing, programming, and web development _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
At 10:25 -0700 10/27/08, Jordan K. Hubbard wrote:
I assume that this is a free-standing stub article which, upon being fleshed out, will eventually be referenced from some suitable section of MacRubyDevelopment?
That was the general idea.
I ask only because it states the answer to a question which has not, as far as I know, been defined anywhere on the wiki yet and it's a little hard to know what to even do to the page without the calling context.
It shouldn't be necessary to know which pages link to a page, in order to know the page's purpose, etc. I have added some "motivation" text to the start of the page. Please let me know if you have any other questions that the page's header paragraphs (etc) do not address. One desirable improvement, IMHO, would be the addition of some example code, in ObjC and Ruby, showing a specific change. It might also be useful to have an annotated list of converted projects (with "before" and "after" links) for folks to examine. -r -- http://www.cfcl.com/rdm Rich Morin http://www.cfcl.com/rdm/resume rdm@cfcl.com http://www.cfcl.com/rdm/weblog +1 650-873-7841 Technical editing and writing, programming, and web development
participants (3)
-
Jordan K. Hubbard
-
Laurent Sansonetti
-
Rich Morin