Skip to content

Commit 1175af6

Browse files
authored
Merge pull request #24 from ruby-processing/master
Update to version 1.2.6 as stable
2 parents 70593d4 + 5c533a5 commit 1175af6

49 files changed

Lines changed: 968 additions & 897 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In the spirit of [free software][free-sw], **everyone** is encouraged to help im
44
Here are some ways *you* can contribute:
55

66
* by reporting bugs
7-
* by suggesting/implementing new features ( _export to ruboto would be cool_ )
7+
* by suggesting/implementing new features ( _running sketches from the atom editor would be cool_ )
88
* by writing or editing documentation ( _expert Windows users could help write install instructions_ )
99
* by contributing examples ( _show your creativity, or translate someone elses masterpiece_ )
1010
* by refactoring examples to be more rubyfied

.mvn/extensions.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<extension>
44
<groupId>io.takari.polyglot</groupId>
55
<artifactId>polyglot-ruby</artifactId>
6-
<version>0.1.15</version>
6+
<version>0.1.19</version>
77
</extension>
88
</extensions>

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ addons:
66
-oracle-java8-installer
77

88
rvm:
9-
- jruby-9.0.5.0
9+
- jruby-9.1.2.0
1010
jdk:
1111
- oraclejdk8
1212
os:

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
1+
**v1.2.6** Update to processing-3.2.3 and jruby-9.1.6.0-complete, re-factor to use a Command class to create argument array and exec.
2+
3+
**v1.2.5** Change gemspec description, trying to get people not to ignore changes to documentation?
4+
5+
**v1.2.4** Update to jruby-9.1.5.0-complete.
6+
7+
**v1.2.3** Further refactored sketchwriter.rb. Update to jruby-9.1.4.0-complete.
8+
9+
**v1.2.2** Refactored sketchwriter.rb (adding unit tests) to be more open to change and removing string_extra.rb on the way. Remove sketchbook.rb, because we no-longer guess sketchbook location at runtime (depends on `config.yml`), could pave the way for independent (from processing ide) location of java libraries (and freedom from the tyranny of prisoner john). Update to jruby-9.1.3.0-complete.
10+
11+
12+
**v1.2.1** Use optparse to parse command line options, and related re-factoring. Avoid casting to java Double and Integer and using `to_java` for primitives in jruby extensions. Includes important changes to CLI, `run` becomes `--run` etc and one stop `--install` replacing `setup --install` etc.
13+
Also `--nojruby` is dropped in favor of `config.yml`.
114

215
**v1.1.3** Revert using String refinements in `creator.rb`. Refactor java options to `java_opts.rb`.
316

4-
**v1.1.2** Refactor `runner.rb` to `runner.rb`, `args.rb` and `installer.rb`. The `Installer` classes have the role of installing `jruby-complete`, the examples and providing `setup check` functionality. Refactored and improved default `config.yml` tool, all should make it easier for `collaborators/successors` to follow the code. Refactored `Vec2D` and `Vec3D` `==` and `eql?` methods. New `chooser` library makes it possible to use `select_input` reflection method.
17+
**v1.1.2** Refactor `runner.rb` to `runner.rb`, `args.rb` and `installer.rb`. The `Installer` classes have the role of installing `jruby-complete`, the examples and providing `setup check` functionality. Refactored and improved default `config.yml` tool, all should make it easier for `collaborators/successors` to follow the code. Refactored `Vec2D` and `Vec3D` `==` and `eql?` methods. New `chooser` library makes it possible to use `select_input` using vanilla processing reflection method.
518

619
**v1.1.1** Even more `data_path` fixes in examples, update to jruby-complete-9.1.2.0
720

LICENSE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Martin Prout
3+
Copyright (c) 2015-16 Martin Prout
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

README.md

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,57 @@
22
# JRubyArt
33
[![Gem Version](https://badge.fury.io/rb/jruby_art.svg)](http://badge.fury.io/rb/jruby_art)
44
![Travis CI](https://travis-ci.org/ruby-processing/JRubyArt.svg)
5+
Versions before JRubyArt-1.2.0, are unsupported, please update, preferably to latest version...
6+
7+
_Note the main reason for the current build to fail on travis is when the current version of [processing is not available from maven central][testing], it has only ever been available by third parties (I am eternally hopeful that one day processing.org will see the light), actually rvm with jruby as used by travis-ci is also pretty crap as judged by the build traces._
58

69
## Requirements
7-
A clean start for `jruby_art` that works best with the latest version of [processing-3.1.1](https://github.com/processing/processing/releases) and [jruby-9.1.2.0](http://jruby.org/download) see [wiki](https://github.com/ruby-processing/JRubyArt/wiki/Building-latest-gem) for building gem from this repo. Changes from processing- 2.0 to [processing-3.0 here](https://github.com/processing/processing/wiki/Changes-in-3.0). Should work on same platforms as vanilla processing (windows, mac, linux) for Android see Yuki Morohoshi [rubuto-processing3][].
10+
A clean start for `jruby_art` that works best with the latest version of [processing-3.2.3](https://github.com/processing/processing/releases) and [jruby-9.1.6.0](http://jruby.org/download) see [wiki](https://github.com/ruby-processing/JRubyArt/wiki/Building-latest-gem) for building gem from this repo. Changes from processing- 2.0 to [processing-3.0 here](https://github.com/processing/processing/wiki/Changes-in-3.0). Should work on same platforms as vanilla processing (windows, mac, linux) for Android see Yuki Morohoshi [rubuto-processing3][].
811
## Requirements
9-
10-
A suitable version of ruby (MRI ruby > 2.2 or `jruby-9.1.2.0+`) to download gem.
1112

12-
`processing-3.1.1`
13+
A suitable version of ruby (MRI ruby > 2.3 or `jruby-9.1.6.0+`) to download gem.
14+
15+
`processing-3.2.3`
1316

14-
`jdk1.8.0_92+` can be openjdk with OpenJFX _a separate download works on ArchLinux_, currently FX2D is experimental is expected to replace JAVA2D in the near future see changes above...
17+
`jdk1.8.0_111+` can be openjdk with OpenJFX _a separate download works on ArchLinux_, currently FX2D is experimental is expected to replace JAVA2D in the near future see changes above...
1518

1619
### recommended installs (JRubyArt is currently hard-coded to expect them)
1720

18-
processing `video` and `sound-1.3.2+` libraries _best installed from the processing-3.1 ide_
21+
processing `video` and `sound-1.3.2+` libraries _best installed from the processing-3.2.2 ide_
1922

2023

2124
## Configuration
2225

23-
You can if you wish leave configuration to the `new` autoconfig tool (delete existing config to do this). The config file is `config.yml` in the `~/.jruby_art folder`, the autoconfig gets run on `k9 setup install` expected to just work on `macosx`, output may need tuning on `windows` / `linux` check with `k9 setup check` (run both after gem install for both)
26+
You can if you wish leave configuration to the `new` autoconfig tool (delete existing config to do this). The config file is `config.yml` in the `~/.jruby_art folder`, the autoconfig gets run on `k9 --install` expected to just work on `macOS`, output may need tuning on `windows` / `linux` check with `k9 --check` (run both after gem install for both)
2427

2528
```yaml
2629
# YAML configuration file for jruby_art
27-
# K9_HOME: "/home/ruby2.3.0 ... /jruby_art" #windows users may need to set this
28-
PROCESSING_ROOT: /home/tux/processing-3.1.1 # typical linux shown
30+
# K9_HOME: "/home/ruby2.3.0 ... /jruby_art" # windows users may need to set this
31+
PROCESSING_ROOT: "/home/tux/processing-3.2.3" # typical linux shown
2932
# important sketch_book path may be different for processing-3.0
30-
sketchbook_path: /home/tux/sketchbook
33+
sketchbook_path: "/home/tux/sketchbook"
34+
template: bare
3135
```
3236
33-
## Install Steps (assumes you have requirements above)
37+
## Install Steps (assumes you have requirements above)
3438
3539
```bash
3640
gem install jruby_art
37-
k9 setup install # installs jruby-complete-9.1.2.0
38-
k9 setup unpack_samples # downloads and installs samples to ~/k9_samples
41+
k9 --install # installs jruby-complete-9.1.6.0 and downloads and installs samples to ~/k9_samples
3942
cd ~/k9_samples/contributed
40-
k9 run jwishy.rb # if you have jruby-9.1.2.0 installed or config JRUBY: 'false'
41-
k9 --nojruby run jwishy.rb # to use jruby-complete unless you have set JRUBY: 'false' in config
43+
k9 --run jwishy.rb # if you have jruby-9.1.6.0 installed or config `JRUBY: false`
44+
# to use jruby-complete set `JRUBY: false` in config
4245
```
4346
## Create sketches from built in templates
4447
```bash
45-
k9 create fred 200 200 # basic sketch fred.rb
46-
k9 create fred 200 200 p2d # basic P2D sketch fred.rb
47-
k9 create fred 200 200 --wrap # class wrapped sketch fred.rb
48-
k9 create fred 200 200 p2d --wrap # class wrapped P2D sketch fred.rb
49-
k9 create ted 200 200 --emacs # class wrapped sketch ted.rb for emacs / netbeans
50-
k9 create ted 200 200 p2d --emacs # class wrapped P2D sketch ted.rb for emacs / netbeans
48+
k9 --create fred 200 200 # basic sketch fred.rb
49+
k9 --create fred 200 200 p2d # basic P2D sketch fred.rb
5150
```
51+
To create either a `class` wrapped sketch or `emacs` sketch set `template: class` or `template: emacs` in config.yml
5252

5353
## Simple Sketch
5454
```ruby
55-
# :sketch_title belongs in setup it is a convenience method of jruby_art-3.0+
55+
# :sketch_title belongs in --it is a convenience method of jruby_art-3.0+
5656
def setup
5757
sketch_title 'My Sketch'
5858
end
@@ -64,10 +64,10 @@ def draw
6464
end
6565

6666
# NB: changes for processing-3.0+
67-
# size, full_screen, pixel_density and smooth should all be moved to settings (this is hidden
68-
# to users of processing ide, but not for JRubyArt, or for Eclipse NetBeans users). The FX2D
69-
# rendering mode was introduced, and was expected to replace JAVA2D (as default rendering mode)
70-
# but may not now happen, and not for processing-3.1.1 in any case.
67+
# size, full_screen, pixel_density and smooth should all be moved to settings (this is hidden
68+
# to users of processing ide, but not for JRubyArt, or for Eclipse NetBeans users). The FX2D
69+
# rendering mode was introduced, and was expected to replace JAVA2D (as default rendering mode)
70+
# but may not now happen, and not for processing-3.2.3 in any case.
7171
def settings
7272
size 400, 300
7373
end
@@ -78,15 +78,15 @@ be prepared to `KILL` the odd java process (ie when sketch does not exit cleanly
7878

7979
## Watch sketches
8080
```bash
81-
k9 watch sketch.rb # don't try and change render mode, or use FX2D render mode during watch yet
81+
k9 --watch sketch.rb # don't try and change render mode, or use FX2D render mode during watch yet
8282
```
8383
## Open pry console on sketch
8484
```bash
85-
k9 live sketch.rb # pry is bound to $app # needs `jruby -S gem install pry`
85+
k9 --live sketch.rb # pry is bound to $app # needs `jruby -S gem install pry`
8686
```
8787
## Example sketches
8888

89-
[Worked Examples](https://github.com/ruby-processing/JRubyArt-examples) more to follow, feel free to add your own, especially ruby-2.2+ syntax now we can. These can now be downloaded using `k9 setup unpack_samples` please move existing k9_samples.
89+
[Worked Examples](https://github.com/ruby-processing/JRubyArt-examples) more to follow, feel free to add your own, especially ruby-2.2+ syntax now we can. These can now be downloaded using `k9 --install` please move existing `k9_samples` if you wish to keep them.
9090

9191
## Conversion Tool
9292

@@ -95,3 +95,4 @@ I wrote this little script to convert sketches from ruby-processing (processing-
9595
See The-Nature-of-Code-Examples-in-Ruby converted to [The-Nature-of-Code-Examples-for-JRubyArt](https://github.com/ruby-processing/The-Nature-of-Code-for-JRubyArt) using the script.
9696

9797
[rubuto-processing3]:https://github.com/hoshi-sano/ruboto-processing3
98+
[testing]:http://ruby-processing.github.io/testing/testing/

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ task :test do
3535
sh 'jruby test/math_tool_test.rb'
3636
sh 'jruby test/helper_methods_test.rb'
3737
sh 'jruby test/aabb_spec_test.rb'
38+
sh 'jruby test/create_test.rb'
3839
home = File.expand_path('~')
3940
config = File.exist?(format('%s/.jruby_art/config.yml', home))
4041
if config

jruby_art.gemspec

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ Gem::Specification.new do |spec|
1111
spec.email = 'mamba2928@yahoo.co.uk'
1212
spec.description = <<-EOS
1313
JRubyArt is a ruby wrapper for the processing art framework.
14-
This version supports processing-3.1.1, and uses jruby-9.1.2.0 as the glue
15-
between ruby and java. You can use both processing libraries and ruby gems
16-
in your sketches. Features create/run/watch/live modes. The "watch" mode,
17-
provides a nice REPL-ish way to work on your processing sketches. Includes:-
18-
A "Control Panel" library, so that you can easily create sliders, buttons,
19-
checkboxes and drop-down menus, and hook them into your sketch's instance
20-
variables and hundreds of worked examples to get you started...
14+
Use both processing libraries and ruby gems in your sketches. Features
15+
create/run/watch/live modes. The "--watch" mode, provides a nice REPL-ish
16+
way to work on your processing sketches. NB: See homepage for documentation.
2117
EOS
2218
spec.summary = %q{Code as Art, Art as Code. Processing and Ruby are meant for each other.}
23-
spec.homepage = "https://ruby-processing.github.io/"
24-
spec.post_install_message = %q{Use 'k9 setup install' to install jruby-complete, and 'k9 setup check' to check config.}
19+
spec.homepage = "https://ruby-processing.github.io/JRubyArt/"
20+
spec.post_install_message = %q{Use 'k9 --install' to install jruby-complete, and 'k9 --check' to check config.}
2521
spec.license = 'MIT'
2622

2723
spec.files = FileList['bin/**/*', 'lib/**/*', 'library/**/*', 'samples/**/*', 'vendors/Rakefile'].exclude(/jar/).to_a
@@ -30,10 +26,10 @@ Gem::Specification.new do |spec|
3026
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
3127
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
3228
spec.require_paths = ['lib']
33-
spec.required_ruby_version = '>= 2.2'
34-
spec.add_development_dependency 'rake', '~> 11.1'
29+
spec.required_ruby_version = '>= 2.3'
30+
spec.add_development_dependency 'rake', '~> 11.2'
3531
spec.add_development_dependency 'minitest', '~> 5.8'
3632
spec.requirements << 'A decent graphics card'
37-
spec.requirements << 'java runtime >= 1.8.0_92+'
38-
spec.requirements << 'processing = 3.1.0+'
33+
spec.requirements << 'java runtime >= 1.8.0_111+'
34+
spec.requirements << 'processing = 3.2.1+'
3935
end

lib/jruby_art.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# encoding: utf-8
2-
# frozen_string_literal: false
1+
# frozen_string_literal: true
32
# JRubyArt is for Code Art.
43
# Send suggestions, ideas, and hate-mail to mamba2928 [at] gmail.com
54
# Also, send samples and libraries.

lib/jruby_art/app.rb

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# encoding: utf-8
21
# frozen_string_literal: false
3-
42
require 'java'
53
require_relative '../rpextras'
64
require_relative '../jruby_art/helper_methods'
@@ -32,16 +30,16 @@ module Render
3230
key_pressed: :keyPressed,
3331
key_released: :keyReleased,
3432
key_typed: :keyTyped
35-
}
33+
}.freeze
3634
# All sketches extend this class
3735
class App < PApplet
3836
include HelperMethods, Math, MathTool, Render
3937
# Alias some methods for familiarity for Shoes coders.
4038
# surface replaces :frame, but needs field_reader for access
41-
alias_method :oval, :ellipse
42-
alias_method :stroke_width, :stroke_weight
43-
alias_method :rgb, :color
44-
alias_method :gray, :color
39+
alias oval ellipse
40+
alias stroke_width stroke_weight
41+
alias rgb color
42+
alias gray color
4543
field_reader :surface
4644

4745
def sketch_class
@@ -63,7 +61,7 @@ def load_libraries(*args)
6361
library_loader ||= LibraryLoader.new
6462
library_loader.load_library(*args)
6563
end
66-
alias_method :load_library, :load_libraries
64+
alias load_library load_libraries
6765

6866
def library_loaded?(library_name)
6967
library_loader.library_loaded?(library_name)
@@ -88,7 +86,7 @@ def method_added(method_name) #:nodoc:
8886
def library_loaded?(library_name)
8987
self.class.library_loaded?(library_name)
9088
end
91-
89+
9290
# Since processing-3.0 you should prefer setting the sketch width and
9391
# height and renderer using the size method in the settings loop of the
9492
# sketch (as with vanilla processing) but is hidden see created java.
@@ -109,7 +107,7 @@ def initialize
109107
# NB: this is the processing runSketch() method as used by processing.py
110108
run_sketch
111109
end
112-
110+
113111
def size(*args)
114112
w, h, mode = *args
115113
@width ||= w
@@ -130,8 +128,8 @@ def sketch_path(spath = nil)
130128

131129
def data_path(dat)
132130
dat_root = File.join(SKETCH_ROOT, 'data')
133-
Dir.mkdir(dat_root) unless File.exist?(dat_root)
134-
File.join(dat_root, dat)
131+
Dir.mkdir(dat_root) unless File.exist?(dat_root)
132+
File.join(dat_root, dat)
135133
end
136134

137135
def sketch_size(x, y)
@@ -158,6 +156,7 @@ def close
158156
surface.stopThread
159157
surface.setVisible(false) if surface.isStopped
160158
dispose
159+
$app = nil
161160
end
162161

163162
def exit
@@ -181,8 +180,8 @@ def mix_proxy_into_inner_classes
181180
def import_opengl
182181
# Include processing opengl classes that we'd like to use:
183182
%w(FontTexture FrameBuffer LinePath LineStroker PGL
184-
PGraphics2D PGraphics3D PGraphicsOpenGL PShader
185-
PShapeOpenGL Texture).each do |klass|
183+
PGraphics2D PGraphics3D PGraphicsOpenGL PShader
184+
PShapeOpenGL Texture).each do |klass|
186185
java_import format('processing.opengl.%s', klass)
187186
end
188187
end
@@ -193,6 +192,10 @@ def import_opengl
193192
module Proxy
194193
include Math, HelperMethods, Java::ProcessingCore::PConstants
195194

195+
def respond_to_missing?(name, include_private = false)
196+
$app.respond_to?(name) || super
197+
end
198+
196199
def method_missing(name, *args)
197200
return $app.send(name, *args) if $app && $app.respond_to?(name)
198201
super

0 commit comments

Comments
 (0)