jruby_art 0.3.1.pre → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jruby_art.rb +5 -12
- data/lib/jruby_art/app.rb +9 -6
- data/lib/jruby_art/library_loader.rb +6 -4
- data/lib/jruby_art/runner.rb +20 -24
- data/lib/jruby_art/runners/base.rb +2 -2
- data/lib/jruby_art/runners/run.rb +1 -4
- data/lib/jruby_art/runners/watch.rb +2 -2
- data/lib/jruby_art/version.rb +1 -1
- data/lib/rpextras.jar +0 -0
- data/library/library_proxy/library_proxy.rb +1 -1
- data/library/video_event/video_event.rb +1 -2
- data/vendors/Rakefile +4 -4
- metadata +15 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd9cb0f962dc0a84b23505e358c06629c40f68e6
|
4
|
+
data.tar.gz: fbe671a54abacc8ba092e8a0990a4001f2801eca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 461771d79505d0055e7327292df3c592aa33ad8d5d61a302fc55e09d51f5c40d8f032eb9d9179e47d6fc4c746a0db2fbd875254b4f595572c0f5a0fc9d404746
|
7
|
+
data.tar.gz: 5e4ecc05a81f62637333b4b8a53c669b292c539e797c1012819f665851cd641c4111c701072b58c1873643fec1f4a0dc290461cc90063bf36659e1c645302dba
|
data/lib/jruby_art.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#
|
1
|
+
# JRubyArt is for Code Art.
|
2
2
|
# Send suggestions, ideas, and hate-mail to mamba2928 [at] gmail.com
|
3
3
|
# Also, send samples and libraries.
|
4
|
-
unless defined?
|
4
|
+
unless defined? K9_ROOT
|
5
5
|
$LOAD_PATH << File.expand_path(File.dirname(__FILE__))
|
6
|
-
|
6
|
+
K9_ROOT = File.expand_path(File.dirname(__FILE__) + '/../')
|
7
7
|
end
|
8
8
|
|
9
9
|
SKETCH_ROOT ||= Dir.pwd
|
@@ -12,14 +12,7 @@ require 'jruby_art/version'
|
|
12
12
|
require 'jruby_art/helpers/numeric'
|
13
13
|
require 'jruby_art/helpers/range'
|
14
14
|
|
15
|
-
# The top-level namespace, a home for all
|
15
|
+
# The top-level namespace, a home for all JRubyArt classes.
|
16
16
|
module Processing
|
17
|
-
|
18
|
-
# Autoload a number of path/constants that we may end up using.
|
19
|
-
# mri ruby does not understand ** require 'java' ** and we may otherwise call
|
20
|
-
# it from mri ruby without lazy path loading of autoload
|
21
|
-
# NB: autoload was slated for possible removal by ruby-2.2 never happened
|
22
|
-
autoload :App, 'jruby_art/app'
|
23
|
-
autoload :Runner, 'jruby_art/runner'
|
24
|
-
autoload :Watcher, 'jruby_art/runners/watch'
|
17
|
+
require 'jruby_art/runner'
|
25
18
|
end
|
data/lib/jruby_art/app.rb
CHANGED
@@ -7,15 +7,18 @@ require_relative '../jruby_art/config'
|
|
7
7
|
|
8
8
|
# A wrapper module for the processing App
|
9
9
|
module Processing
|
10
|
+
Dir[format("%s/core/library/\*.jar", RP_CONFIG['PROCESSING_ROOT'])].each do |jar|
|
11
|
+
require jar unless jar =~ /native/
|
12
|
+
end
|
10
13
|
# Include some core processing classes that we'd like to use:
|
11
14
|
include_package 'processing.core'
|
12
15
|
# Load vecmath and fastmath modules
|
13
|
-
Java::
|
14
|
-
Java::
|
15
|
-
Java::
|
16
|
-
Java::
|
17
|
-
AppRender ||= Java::
|
18
|
-
ShapeRender ||= Java::
|
16
|
+
Java::MonkstoneArcball::ArcballLibrary.new.load(JRuby.runtime, false)
|
17
|
+
Java::MonkstoneVecmathVec2::Vec2Library.new.load(JRuby.runtime, false)
|
18
|
+
Java::MonkstoneVecmathVec3::Vec3Library.new.load(JRuby.runtime, false)
|
19
|
+
Java::MonkstoneFastmath::DeglutLibrary.new.load(JRuby.runtime, false)
|
20
|
+
AppRender ||= Java::MonkstoneVecmath::AppRender
|
21
|
+
ShapeRender ||= Java::MonkstoneVecmath::ShapeRender
|
19
22
|
|
20
23
|
# Watch the definition of these methods, to make sure
|
21
24
|
# that Processing is able to call them during events.
|
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# The processing wrapper module
|
2
|
+
require_relative '../jruby_art'
|
3
|
+
|
2
4
|
module Processing
|
3
5
|
|
4
6
|
# Encapsulate library loader functionality as a class
|
@@ -19,7 +21,7 @@ module Processing
|
|
19
21
|
# Usage: load_libraries :opengl, :boids
|
20
22
|
#
|
21
23
|
# If a library is put into a 'library' folder next to the sketch it will
|
22
|
-
# be used instead of the library that ships with
|
24
|
+
# be used instead of the library that ships with JRubyArt.
|
23
25
|
def load_libraries(*args)
|
24
26
|
message = 'no such file to load -- %s'
|
25
27
|
args.each do |lib|
|
@@ -101,8 +103,8 @@ module Processing
|
|
101
103
|
extensions.each do |ext|
|
102
104
|
["#{SKETCH_ROOT}/library/#{library_name}",
|
103
105
|
"#{Processing::RP_CONFIG['PROCESSING_ROOT']}/modes/java/libraries/#{library_name}/library",
|
104
|
-
"#{
|
105
|
-
"#{
|
106
|
+
"#{K9_ROOT}/library/#{library_name}/library",
|
107
|
+
"#{K9_ROOT}/library/#{library_name}",
|
106
108
|
"#{@sketchbook_library_path}/#{library_name}/library"
|
107
109
|
].each do |jpath|
|
108
110
|
if File.exist?(jpath) && !Dir.glob(format('%s/*.%s', jpath, ext)).empty?
|
data/lib/jruby_art/runner.rb
CHANGED
@@ -12,7 +12,7 @@ module Processing
|
|
12
12
|
HELP_MESSAGE ||= <<-EOS
|
13
13
|
Version: #{JRubyArt::VERSION}
|
14
14
|
|
15
|
-
|
15
|
+
JRubyArt is a little shim between Processing and JRuby that helps
|
16
16
|
you create sketches of code art.
|
17
17
|
|
18
18
|
Usage:
|
@@ -110,18 +110,18 @@ module Processing
|
|
110
110
|
proc_root = FileTest.exist?("#{ENV['HOME']}/.jruby_art/config.yml")
|
111
111
|
case choice
|
112
112
|
when /check/
|
113
|
-
check(proc_root, FileTest.exist?("#{
|
113
|
+
check(proc_root, FileTest.exist?("#{K9_ROOT}/lib/ruby/jruby-complete.jar"))
|
114
114
|
when /install/
|
115
115
|
install(proc_root)
|
116
116
|
when /unpack_samples/
|
117
|
-
system "cd #{
|
117
|
+
system "cd #{K9_ROOT}/vendors && rake unpack_samples"
|
118
118
|
else
|
119
119
|
puts 'Usage: k9 setup [check | install | unpack_samples]'
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
123
123
|
def install(root_exist)
|
124
|
-
system "cd #{
|
124
|
+
system "cd #{K9_ROOT}/vendors && rake"
|
125
125
|
return if root_exist
|
126
126
|
set_processing_root
|
127
127
|
warn 'PROCESSING_ROOT set optimistically, run check to confirm'
|
@@ -141,7 +141,7 @@ module Processing
|
|
141
141
|
puts " jruby-complete installed = #{installed}"
|
142
142
|
end
|
143
143
|
|
144
|
-
# Display the current version of
|
144
|
+
# Display the current version of JRubyArt.
|
145
145
|
def show_version
|
146
146
|
puts format('JRubyArt version %s', JRubyArt::VERSION)
|
147
147
|
end
|
@@ -153,10 +153,6 @@ module Processing
|
|
153
153
|
|
154
154
|
private
|
155
155
|
|
156
|
-
def core_classpath
|
157
|
-
Dir["#{Processing::RP_CONFIG['PROCESSING_ROOT']}/core/library/\*.jar"]
|
158
|
-
end
|
159
|
-
|
160
156
|
# Trade in this Ruby instance for a JRuby instance, loading in a starter
|
161
157
|
# script and passing it some arguments.Unless '--nojruby' is passed, the
|
162
158
|
# installed version of jruby is used instead of our vendored jarred one
|
@@ -164,16 +160,14 @@ module Processing
|
|
164
160
|
# jruby-complete by default set JRUBY: false in ~/.k9rc config
|
165
161
|
# (but that will make using other gems in your sketches hard....)
|
166
162
|
def spin_up(starter_script, sketch, args)
|
167
|
-
runner = "#{
|
168
|
-
warn('The --jruby flag is no longer required') if @options.jruby
|
163
|
+
runner = "#{K9_ROOT}/lib/jruby_art/runners/#{starter_script}"
|
169
164
|
@options.nojruby = true if Processing::RP_CONFIG['JRUBY'] == 'false'
|
170
165
|
java_args = discover_java_args(sketch)
|
171
166
|
if @options.nojruby
|
172
|
-
classpath = jruby_complete + core_classpath
|
173
167
|
command = ['java',
|
174
168
|
java_args,
|
175
169
|
'-cp',
|
176
|
-
|
170
|
+
jruby_complete,
|
177
171
|
'org.jruby.Main',
|
178
172
|
runner,
|
179
173
|
sketch,
|
@@ -181,8 +175,6 @@ module Processing
|
|
181
175
|
else
|
182
176
|
command = ['jruby',
|
183
177
|
java_args,
|
184
|
-
'-J-cp',
|
185
|
-
core_classpath.join(path_separator),
|
186
178
|
runner,
|
187
179
|
sketch,
|
188
180
|
args].flatten
|
@@ -190,14 +182,10 @@ module Processing
|
|
190
182
|
begin
|
191
183
|
exec(*command)
|
192
184
|
# exec replaces the Ruby process with the JRuby one.
|
193
|
-
rescue Java::JavaLang::
|
185
|
+
rescue Java::JavaLang::ClassNotFoundException
|
194
186
|
end
|
195
187
|
end
|
196
188
|
|
197
|
-
def path_separator
|
198
|
-
(host_os == :windows) ? ';' : ':'
|
199
|
-
end
|
200
|
-
|
201
189
|
# If you need to pass in arguments to Java, such as the ones on this page:
|
202
190
|
# http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/java.html
|
203
191
|
# add them to a java_args.txt in your data directory next to your sketch.
|
@@ -221,11 +209,19 @@ module Processing
|
|
221
209
|
end
|
222
210
|
|
223
211
|
def jruby_complete
|
224
|
-
rcomplete = File.join(
|
212
|
+
rcomplete = File.join(K9_ROOT, 'lib/ruby/jruby-complete.jar')
|
225
213
|
return [rcomplete] if FileTest.exist?(rcomplete)
|
226
214
|
warn "#{rcomplete} does not exist\nTry running `k9 setup install`"
|
227
215
|
exit
|
228
216
|
end
|
217
|
+
|
218
|
+
def libraries
|
219
|
+
%w(video sound).map { |library| sketchbook_library(library) }.flatten
|
220
|
+
end
|
221
|
+
|
222
|
+
def sketchbook_library(name)
|
223
|
+
Dir["#{Processing::RP_CONFIG['sketchbook_path']}/libraries/#{name}/library/\*.jar"]
|
224
|
+
end
|
229
225
|
|
230
226
|
def host_os
|
231
227
|
detect_os = RbConfig::CONFIG['host_os']
|
@@ -249,7 +245,7 @@ module Processing
|
|
249
245
|
if os == :mac
|
250
246
|
data['PROCESSING_ROOT'] = '/Applications/Processing.app/Contents/Java'
|
251
247
|
else
|
252
|
-
root = "#{ENV['HOME']}/processing-3.
|
248
|
+
root = "#{ENV['HOME']}/processing-3.0a11"
|
253
249
|
data['PROCESSING_ROOT'] = root
|
254
250
|
end
|
255
251
|
data['JRUBY'] = 'true'
|
@@ -261,8 +257,8 @@ module Processing
|
|
261
257
|
@os ||= host_os
|
262
258
|
icon = []
|
263
259
|
if os == :mac
|
264
|
-
icon << '-Xdock:name=
|
265
|
-
icon << "-Xdock:icon=#{
|
260
|
+
icon << '-Xdock:name=JRubyArt'
|
261
|
+
icon << "-Xdock:icon=#{K9_ROOT}/lib/templates/application/Contents/Resources/sketch.icns"
|
266
262
|
end
|
267
263
|
icon
|
268
264
|
end
|
@@ -3,8 +3,8 @@
|
|
3
3
|
SKETCH_PATH ||= ARGV.shift
|
4
4
|
SKETCH_ROOT ||= File.dirname(SKETCH_PATH)
|
5
5
|
|
6
|
-
|
7
|
-
require_relative '
|
6
|
+
# we can safely require app.rb as we are using a jruby runtime
|
7
|
+
require_relative '../app'
|
8
8
|
|
9
9
|
# More processing module
|
10
10
|
module Processing
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'base'
|
2
2
|
|
3
3
|
module Processing
|
4
4
|
# A sketch loader, observer, and reloader, to tighten
|
@@ -12,7 +12,7 @@ module Processing
|
|
12
12
|
start_watching
|
13
13
|
end
|
14
14
|
|
15
|
-
# Kicks off a thread to watch the sketch, reloading
|
15
|
+
# Kicks off a thread to watch the sketch, reloading JRubyArt
|
16
16
|
# and restarting the sketch whenever it changes.
|
17
17
|
def start_watching
|
18
18
|
start_runner
|
data/lib/jruby_art/version.rb
CHANGED
data/lib/rpextras.jar
CHANGED
Binary file
|
data/vendors/Rakefile
CHANGED
@@ -8,8 +8,8 @@ WARNING = <<-EOS
|
|
8
8
|
|
9
9
|
EOS
|
10
10
|
|
11
|
-
JRUBYC_VERSION = '9.0.0.0
|
12
|
-
EXAMPLES = '0.
|
11
|
+
JRUBYC_VERSION = '9.0.0.0'
|
12
|
+
EXAMPLES = '0.4'
|
13
13
|
HOME_DIR = ENV['HOME']
|
14
14
|
MAC_OR_LINUX = /linux|mac|darwin/ =~ RbConfig::CONFIG['host_os']
|
15
15
|
|
@@ -27,7 +27,7 @@ file "jruby-complete-#{JRUBYC_VERSION}.jar" do
|
|
27
27
|
rescue
|
28
28
|
warn(WARNING)
|
29
29
|
end
|
30
|
-
check_sha1("jruby-complete-#{JRUBYC_VERSION}.jar", "
|
30
|
+
check_sha1("jruby-complete-#{JRUBYC_VERSION}.jar", "2479278bdd92d85ca37c5d45a4ec4745c50dfccb")
|
31
31
|
end
|
32
32
|
|
33
33
|
directory "../lib/ruby"
|
@@ -77,5 +77,5 @@ task :copy_examples => file_name do
|
|
77
77
|
end
|
78
78
|
sh "rm -r #{HOME_DIR}/k9_samples" if File.exist? "#{HOME_DIR}/k9_samples"
|
79
79
|
sh "cp -r samples4ruby-processing3-#{EXAMPLES} #{HOME_DIR}/k9_samples"
|
80
|
-
sh "rm -r samples4ruby-processing3-#{EXAMPLES}
|
80
|
+
sh "rm -r samples4ruby-processing3-#{EXAMPLES}"
|
81
81
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jruby_art
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Ashkenas
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-07-
|
13
|
+
date: 2015-07-25 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - ~>
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '1.3'
|
21
21
|
name: bundler
|
@@ -23,13 +23,13 @@ dependencies:
|
|
23
23
|
type: :development
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
|
-
- - ~>
|
26
|
+
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
version: '1.3'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - ~>
|
32
|
+
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '10.3'
|
35
35
|
name: rake
|
@@ -37,13 +37,13 @@ dependencies:
|
|
37
37
|
type: :development
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
|
-
- - ~>
|
40
|
+
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '10.3'
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
|
-
- - ~>
|
46
|
+
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
48
|
version: '0.9'
|
49
49
|
name: rake-compiler
|
@@ -51,13 +51,13 @@ dependencies:
|
|
51
51
|
type: :development
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
|
-
- - ~>
|
54
|
+
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0.9'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - ~>
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '5.3'
|
63
63
|
name: minitest
|
@@ -65,12 +65,12 @@ dependencies:
|
|
65
65
|
type: :development
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
|
-
- - ~>
|
68
|
+
- - "~>"
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '5.3'
|
71
71
|
description: |2
|
72
72
|
JRubyArt is a ruby wrapper for the processing art framework.
|
73
|
-
The current version supports processing-3.
|
73
|
+
The current version supports processing-3.0a11, and uses jruby-9.0.0.0
|
74
74
|
as the glue between ruby and java. You can use both processing libraries and ruby
|
75
75
|
gems in your sketches. Features create/run/watch modes. The "watch" mode,
|
76
76
|
provides a nice REPL-ish way to work on your processing sketches. Includes:-
|
@@ -116,18 +116,18 @@ require_paths:
|
|
116
116
|
- lib
|
117
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
118
118
|
requirements:
|
119
|
-
- -
|
119
|
+
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '2.1'
|
122
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
|
-
- -
|
124
|
+
- - ">="
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version:
|
126
|
+
version: '0'
|
127
127
|
requirements:
|
128
128
|
- A decent graphics card
|
129
129
|
- java runtime >= 1.8+
|
130
|
-
- processing = 3.
|
130
|
+
- processing = 3.0a11+
|
131
131
|
rubyforge_project:
|
132
132
|
rubygems_version: 2.4.8
|
133
133
|
signing_key:
|