Skip to content

Building latest gem

Martin Prout edited this page Feb 22, 2017 · 83 revisions

Clone this repository

Create a local maven artefact for processing core 3.3 (this is why travis is failing)

Install maven (ruby-2.3+ or better is assumed to be installed)

maven-3.3.9

jdk1.8.0_121+ can be openjdk with OpenJFX a separate download works on ArchLinux

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 should install processing-3.3 and the video library independently (maven central only has 3.0.2) furthermore the sketch tests will not run without them and a valid config.yml. You probably also want to install want to install jruby-9.1.8.0 (when available), but in case you don't add JRUBY: 'false' to config.yml.

NB: You will 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
# K9_HOME: "/home/ruby2.3.0 ... /jruby_art" #windows users may need to set this
PROCESSING_ROOT: /home/tux/processing-3.3
sketchbook_path: /home/tux/sketchbook3
# JRUBY: false

Typical macosx version

# YAML configuration file for jruby_art
# K9_HOME: "/home/ruby2.3.0 ... /jruby_art" #windows users may need to set this
PROCESSING_ROOT: /Applications/Processing.app/Contents/Java
sketchbook_path: # (as set by user in processing ide or see preferences.txt)
MAX_WATCH: 32
template: emacs

warning: if you used homebrew to install processing prefix /Application with your home directory, we need path to jars, symbolic links to executable won't do...

Steps

 rake      # compiles and builds rpextras (from source) depends on config, before building gem
 gem install --local jruby_art-1.3.0.gem
 k9 --install # Downloads and install jruby-complete-9.1.8.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 RPExtras

The javadocs for rpextra can be generated as follows:-

mvn javadoc:javadoc # see target site