jashkenas / ruby-processing

Code as Art, Art as Code. Processing and Ruby are meant for each other.
http://github.com/jashkenas/ruby-processing/wikis
Other
1.28k stars 94 forks source link

ruby-processing (rp) livecoding editor in ruby-processing #66

Closed marcel12bell closed 11 years ago

marcel12bell commented 11 years ago

I'm trying to implement a editor in ruby-processing and want to know if you tried to something similar?

monkstone commented 11 years ago

Not sure what you mean by live editor! You can easily use jEdit, vim, and probably emacs, textmate and sublime2 text editors to run sketches directly from the currently edited buffer (with appropriate macros). Further watch mode can also be used with these editors, where the sketch automatically updates and reloads on save (this doesn't currently work with P2D and P3D sketches). There is also a live mode equivalent to irb but I've not had to too much success with it myself. However as far as I now there is nothing equivalent to emacs slime repl mode.

marcel12bell commented 11 years ago

I have something like this http://worrydream.com/LearnableProgramming/ in mind...

monkstone commented 11 years ago

Yeah but thats just a dream! There are no magic bullets,

marcel12bell commented 11 years ago

:-) I'll try the simple version of it...

marcel12bell commented 11 years ago

I got it: https://github.com/marcel12bell/simple-live-coding but had problems with generating a working standalone App...

monkstone commented 11 years ago

Looks quite interesting, I thought you had in mind something like pry which would be great if it worked with ruby- processing (apparently it was reported as working with an earlier version of ruby-processing http://forum.processing.org/topic/ruby-processing-app-and-live-coding). Currently with rp5 live which opens irb you need to use prefix $app, but with pry you can set a binding to $app and not use the prefix. Currently we are in state of flux at ruby processing, and I have started a development version at https://github.com/monkstone/ruby-processing.git, I did this to clobber a pile of unused binaries in the git archive (shrinked repo from 70Mb => 10.25Mb), at some stage I would like anyone forking ruby-processing to use the up to date version (which owing to re-writing of github references by the cleanup is not compatible with the original). Now that there is someone (you) actually working on their clone I will be reluctant to clobber the original.

monkstone commented 11 years ago

Regarding standalone App there is problem with the copying of libraries in the export app, they get flattened, rather staying in their folder. The current crap fix is to manually copy the libraries, and then your App works OK. However I have also now implemented require_relative which is an alternative to using library architecture.

marcel12bell commented 11 years ago

Cool, got it working by copying all classes to the main file. I didn't understand the last two sentences of your first answer... This weekend is RailsCamp Germany here in cologne and I hope finding fellows for the project.

monkstone commented 11 years ago

Rather have all the classes in the main file you could put the "library" classes into one file, then use require_relative to include it into main file. To use rp5 live, you need to start it in a folder say sketch, in which there is a skeleton file sketch.rb.

def setup
  size 200, 200
end

Now when you

rp5 live

you will see a a blank sketch, and an irb console should open. If you type

$app.background 0

you will get a black background

$app.fill 200
$app.ellipse 100, 100, 100, 100

Now pry is a cool variant of irb, that was reported as working with an earlier version of ruby-processing and would remove need to type $app. see http://forum.processing.org/topic/ruby-processing-app-and-live-coding but may not now work, possibly because of jruby and pry changes. I have created a clean repo of ruby-processing at monkstone on github, the purpose is to clean archive material that average user does not see, but is stored nevertheless, was 70MB prior to cleanup now only 10.75Mb. The problem is the way github stores its references which all need to get re-written when anything is actually removed from github, so my clean repo is no longer compatible with the original.

If pry would work it would be brilliant!

marcel12bell commented 11 years ago

I changed to 2.1.0, so feel free to clobber the original...

monkstone commented 11 years ago

@marcel12bell hey I thought this could be interesting https://github.com/galsasson/tweakmode/

marcel12bell commented 11 years ago

Yeah, I thing there will be a lot more of this kind of stuff...