Getting Started Manjaro
If Manjaro does not come with a pre-installed java, then the first step is to install a jdk
the distro version (jdk16) should work.
sudo pacman -S jre-openjdk # current distro version jdk17
You can also use pacman to install jruby
sudo pacman -S jruby # current version jruby-9.3.0.0
It is probably a good idea to create a local gem store (rather needing to use sudo to install gems)
sudo pacman -S vim # all you need if your happy with vim
Vim is not installed by default
sudo pacman -S geany # if you prefer a GUI
Geany is not installed by default
mkdir -p ~/.gem/ruby/2.6.0 # current MRI version supported by jruby
Now set your GEM_HOME
, GEM_PATH
and amend your PATH
as follows:-
echo "export GEM_HOME=\"\${HOME}/.gem/ruby/${MRI_RUBY}\"" >> ~/.bashrc
echo "export GEM_PATH=\"\${HOME}/.gem/ruby/${MRI_RUBY}\"" >> ~/.bashrc
echo "export PATH=\"\${PATH}:\${GEM_PATH}/bin\"" >> ~/.bashrc
source ~/.bashrc # to update environment without re-logging in
Now should be ready to install picrate
and other gems. But speed up install time you should set --no-document
option in ~/.gemrc
touch ~/.gemrc
echo "gem: --no-document" > ~/.gemrc
To install latest picrate and its dependencies:-
jgem install picrate
Geany is a good editor/ide for PiCrate on the RaspberryPI (install via pacman), but some may prefer vim. For geany you should edit/preferences/Terminal to Execute programs in the VTE
.
For a first install:-
picrate --install # no args, install samples and geany config
# or
picrate -i Samples # to omit geany config
This installs example sketches in ~/projects/examples
and ties them into a geany
project examples.geany
. It should also be possible to run sketches from the geany
ide. The geany config creates picrate.rb
template sketch so you can create a new sketch with template.
To create a template sketch from the command line:-
picrate -c my_sketch 600 400
creates file my_sketch.rb
#!/usr/bin/env jruby
# frozen_string_literal: false
require 'picrate'
class MySketch < Processing::App
def settings
size 200, 200
end
def setup
sketch_title 'My Sketch'
end
def draw
end
end
MySketch.new
Edit in vim
(at command line) or geany
(gui), you may need to install vim
vim my_sketch.rb
:!jruby % # from vim runs the sketch
To run sketches from command line:-
jruby --dev my_sketch.rb
Or even chmod +x my_sketch.rb
to make an executable script.
See editors geany, for how to run sketches from a gui.