I've been hacking on a fork of Interactive-MacRuby since a month or so ago, and as I now think I won't be able to find the time to distill my experience to a more presentable form any time soon, I'll just share my not-so-tidy work in progress and my current repl-based workflow in case others may find it useful and/or could take it further.
https://github.com/sohocoke/interactive-macruby/tree/temp-hack is the fork to which I added a few things: - show (mac)ruby ivars inline when inspecting objects - load_rc - loads my .irbrc and .macirbrc files - load_repl - scans the app bundle for and load files with an .rb-repl extension - load_src - relies on a (debug-only) global variable defined in the project's .rb-repl file, to reload the source of a class from the project's source (not bundle) This gives me the ability to open a console window when I need to investigate my app at runtime, and to quickly load some infra to carry for investigation / fixing. Then in my *rc files, I have, among other things, the following definitions: - https://gist.github.com/1320400 - some routines that allow me to obtain quickly references to objects by their id or class - https://gist.github.com/1393479 - some methods that can wrap existing methods for logging or additional investigative behaviour I typically use these to find objects to which I add traces, add or replace behaviour, then when I think I got it right I edit the source in the XCode project and load the changed source. Obviously there are times when the changes need to be around events of the object that I cannot cleanly retrigger from a REPL, such as when nib wiring or awakeFromNib must be changed, so I still find myself restarting the debug session every now and then. But for small tweaks these facilities allow me to make changes and apply them in a relatively short cycle. I also yearned for improved / prettier handling of the code I typed into the console as I was using Interactive-MacRuby, but now I'm mostly satisfied with one-line statements in the console, and reloading source after modifications if it spans a few lines. Hope this is of interest to some. Thanks Eloy and others. On 25 Nov 2011, at 01:28, Michael Johnston wrote: > Thanks Eloy. I was playing with Interactive-MacRuby a bit last night. > > I think the first step to using it would be to make a target to compile as a > framework and make it cocoa pod-able. Then wiring up so can launch in app > terminals with the app delegate or a particular window controller as top > level object. > > I was trying to figure out how to make it indent code as it is typed which > irb does. Any thoughts on that? > > Cheerio, > > Michael Johnston > lastobe...@mac.com > > > > > On 2011-11-24, at 2:13 PM, Eloy Duran wrote: > >> Here’s a GUI approach to using macirb: >> https://github.com/alloy/Interactive-MacRuby >> >> I didn’t have time to finish it yet, but it might still be useful. >> >> On 24 nov. 2011, at 02:52, Michael Johnston wrote: >> >>> I added basic fsevents reloading in my fork >>> (https://github.com/lastobelus/MacRubyReload) >>> >>> Should change to check an environment var first for list of directories to >>> watch, and otherwise use project root. For now I just grabbed the dir of >>> the rb_main.loc.txt entry. >>> >>> I'm curious to experiment with automating the dynamic reloading of nib >>> files. Anyone have any tips for that? The problem is that there are many >>> patterns for using nibs, so it will be difficult to fully automate. But >>> perhaps we can at least make it easy for common cases. >>> >>> Another next step would be to attach a panel to any window with a running >>> macirb in it whose top-level context is the window controller for that >>> window. That might be actually fairly easy to do. >>> >>> >>> Cheerio, >>> >>> Michael Johnston >>> lastobe...@mac.com >>> >>> >>> >>> >>> On 2011-11-15, at 10:01 AM, Jean-Denis MUYS wrote: >>> >>>> Following up on my Friday suggestion, I am happy to announce that I >>>> implemented a first version a Xcode MacRuby projects that dynamically >>>> reloads Ruby source code into a running application, allowing for a very >>>> dynamic incremental programming style. >>>> >>>> go to https://github.com/jdmuys/MacRubyReload to download the project. The >>>> ReadMe.markDown text file gives full instructions. >>>> >>>> Hopefully MacRuby Xcode templates can evolve to automatically provide a >>>> similar facility. >>>> >>>> This is all very simple and very primitive. There is a lot of room for >>>> improvement. I also apologize for my Ruby style: I probably haven't >>>> written more than 100 or so lines of Ruby code overall yet. >>>> >>>> I hope this gets the ball rolling. >>>> >>>> Jean-Denis >>>> >>>> _______________________________________________ >>>> MacRuby-devel mailing list >>>> MacRuby-devel@lists.macosforge.org >>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >>> _______________________________________________ >>> MacRuby-devel mailing list >>> MacRuby-devel@lists.macosforge.org >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel