Skip to content

Building latest gem

Martin Prout edited this page Dec 3, 2021 · 83 revisions

Clone this repository

If you need to, modify the outer Rakefile to use maven wrapper ./mvnw or ./mvnw.cmd instead of mvn if you haven't got maven installed. You will to install java (jdk11.0_3+ be preferably openjdk).

cd JRubyArt

rake

Regular Minitests tests (ideally need an installed jruby) but should run and pass, but the sketch tests will fail without the optional configuration, which will be needed runtime:-

Optional Configuration ( but required for installation )

You also want to install want to install jruby-9.3.2.0), but in case you don't add JRUBY: 'false' to config.yml.

NB: You may need to edit the pom.rb properties to match your 'processing.core' and 'processing.sketchbook' paths on your system.

Config file is config.yml in ~/.jruby_art folder so can co-exist with a ruby-processing install

Typical linux version

YAML configuration file for jruby_art

---
processing_ide: true
library_path: "/home/tux/sketchbook"
MAX_WATCH: 32
JRUBY: true
template: bare
java_args: 
 rake      # compiles and builds jruby_art.jar (from source) depends on config, before building gem
 gem install --local jruby_art-2.0.0.gem
 k9 --install # Downloads and install jruby-complete-9.2.7.0

Create sketches from built in templates

k9 --create fred 200, 200               # basic sketch fred.rb
k9 --create fred 200, 200, p2d          # basic P2D sketch fred.rb

Is the default set template: class or template: emacs to us alternative templates

Simple Sketch

# :sketch_title belongs in setup it is a convenience method of jruby_art
def setup
  sketch_title 'My Sketch'
end

def draw
  background 0
  fill 200
  ellipse width / 2, height / 2, 300, 200
end

# size goes here since processing-3.0, the processing guys hide this
# by doing pre-processing on the pde file (check the java output).
def settings
  size 400, 300
end

Run Sketch

k9 -r sketch.rb or k9 --run sketch.rb

be prepared to KILL the 'rare' java process (that doesn't exit cleanly all the time), watch seems now to work

Watch sketches

k9 --watch sketch.rb # don't try and change render mode, or use the FX2D render mode

Example sketches

Worked Examples more to follow, feel free to add your own, especially ruby-2.3+ syntax now we can. These are installed using k9 --install please move existing rp_samples.

Conversion Tool

I wrote this little script to convert sketches from ruby-processing (processing-2) to jruby_art (processing-3.0) here

Javadocs jruby_art.jar

The javadocs for jruby_art can be generated as follows:-

mvn javadoc:javadoc # see target site